Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e16d20e996 | ||
|
|
bfab0f8538 | ||
|
|
4752a98456 | ||
|
|
e63a3ec6a9 | ||
|
|
4dc30d7d98 | ||
|
|
71f6825b00 | ||
|
|
d56b0bfccc | ||
|
|
39ff956076 | ||
|
|
faa22fc634 | ||
|
|
f5ce395371 | ||
|
|
b986d4cb5d | ||
|
|
9c39cd9255 | ||
|
|
43e2c44ac1 | ||
|
|
3507a74d60 | ||
|
|
97797d64f1 | ||
|
|
88d7207102 | ||
|
|
1616b014b3 | ||
|
|
c20538f6f7 | ||
|
|
e77c2dd78c | ||
|
|
6e7ce901ab | ||
|
|
3396ed6010 | ||
|
|
09ec89ae62 | ||
|
|
a7d78ff6eb | ||
|
|
868043a22b | ||
|
|
0310582056 | ||
|
|
629b9b486e | ||
|
|
500e2022c3 | ||
|
|
f8c2701751 | ||
|
|
d70ef05b54 | ||
|
|
4b1d4c7335 | ||
|
|
c79939e650 | ||
|
|
8f298ba2a0 | ||
|
|
da6311d584 | ||
|
|
d589adf208 | ||
|
|
dfbfaf12eb | ||
|
|
91989e1a2b | ||
|
|
86c2a96ed4 | ||
|
|
9f3dab39c0 | ||
|
|
a02687c9fb |
+23
-2
@@ -1,5 +1,26 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 7.5.1 Jan 23, 2022
|
||||
|
||||
Upgrade priority: Low. Recommended for users of the latest contract pallet and ink! versions.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Add additional namespaced contract tests (Thanks to https://github.com/VargSupercolony)
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust `Registry` consistency, augment extensions
|
||||
- Add `.multi` support on `api.at(...).<section>.<method>`
|
||||
- Add support for ink! metadata V3 with payable constructors
|
||||
- Cleanup ink! metadata parsing, allowing for easier extension
|
||||
- Expose `contract.{query, tx}.<method>.meta`, aligning with API
|
||||
- Fix storage metadata, aligning method with decorated name
|
||||
- Adjust typegen, only using exportInterface
|
||||
- Added Kusama/Polkadot 9151 upgrade block (known types)
|
||||
- Update to latest Substrate, Kusama & Polkadot static metadata
|
||||
|
||||
|
||||
## 7.4.1 Jan 15, 2022
|
||||
|
||||
Upgrade priority: Medium. Required for all chains using `Range` and `RangeInclusive` types. Also includes better error handling for number conversions.
|
||||
@@ -70,9 +91,9 @@ Changes:
|
||||
|
||||
Upgrade priority: Low. Recommended for TS users with their own non-Polkadot/Kusama chains.
|
||||
|
||||
- **Breaking changes** For TS users the default API augmentation is now optional. This means that the API, for TypeScript, is not decorated by default with the Substrate types and encpoints. TS users should add a singular `import '@polkadot/api-augment';` in their code to retore old behavior.
|
||||
- **Breaking changes** For TS users the default API augmentation is now optional. This means that the API, for TypeScript, is not decorated by default with the Substrate types and encpoints. TS users should add a singular `import '@polkadot/api-augment';` in their code to restore old behavior. A full writeup of the rationale and other options can be found [in the FAQ](https://polkadot.js.org/docs/api/FAQ#since-upgrading-to-the-7x-series-typescript-augmentation-is-missing)
|
||||
|
||||
- **Breaking change** To cater for the above, chain-specific interfaces generated with older versions may not be compaitible with the current version of the API. Additionally, TS interfaces generated with this version of the API is not compatible with older API versions.
|
||||
- **Breaking change** To cater for the above, chain-specific interfaces generated with older versions may not be compatible with the current version of the API. Additionally, TS interfaces generated with this version of the API is not compatible with older API versions.
|
||||
|
||||
Contributed:
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
2763 Jaco 7.4.1 (#4454)
|
||||
2782 Jaco 7.5.1 (#4492)
|
||||
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
|
||||
36 Keith Ingram Storage deposit limit changes (#4370)
|
||||
35 Stefanie Doll Updated child storage parameters (#1709)
|
||||
@@ -75,6 +75,7 @@
|
||||
1 Nazar Mokrynskyi Performance tweaks (#4143)
|
||||
1 Nikhil Ranjan add vestingPerBlock and vestingEndBlock in DeriveBalancesAll when doing calcBalances (#2563)
|
||||
1 Nikolay Volf Fix typo (#1730)
|
||||
1 Oleksandr Mykhailenko Add more complex namespaced contracts & test cases for them (#4472)
|
||||
1 Paul M Fox Basic BTreeMaps codec support (#1474)
|
||||
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
|
||||
1 qiuhao update DeriveCustom type (#2581)
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "commonjs",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
@@ -31,15 +31,15 @@
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.7",
|
||||
"@babel/core": "^7.16.12",
|
||||
"@babel/register": "^7.16.9",
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/dev": "^0.65.37",
|
||||
"@polkadot/dev": "^0.65.43",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^27.4.0",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"typescript": "^4.5.3"
|
||||
"typescript": "^4.5.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/api-base": "7.4.1",
|
||||
"@polkadot/rpc-augment": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-augment": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2"
|
||||
"@polkadot/api-base": "7.5.1",
|
||||
"@polkadot/rpc-augment": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-augment": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,6 +1022,11 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
* Para is not registered in our system.
|
||||
**/
|
||||
NotRegistered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The PVF pre-checking statement cannot be included since the PVF pre-checking mechanism
|
||||
* is disabled.
|
||||
**/
|
||||
PvfCheckDisabled: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The given validator already has cast a vote.
|
||||
**/
|
||||
|
||||
@@ -574,6 +574,21 @@ declare module '@polkadot/api-base/types/events' {
|
||||
* A new head has been noted for a Para. `para_id`
|
||||
**/
|
||||
NewHeadNoted: AugmentedEvent<ApiType, [u32]>;
|
||||
/**
|
||||
* The given validation code was rejected by the PVF pre-checking vote.
|
||||
* `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckAccepted: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* The given validation code was accepted by the PVF pre-checking vote.
|
||||
* `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckRejected: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* The given para either initiated or subscribed to a PVF check for the given validation
|
||||
* code. `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckStarted: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -139,7 +139,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Set the balances of a given account.
|
||||
*
|
||||
* This will alter `FreeBalance` and `ReservedBalance` in storage. it will
|
||||
* also decrease the total issuance of the system (`TotalIssuance`).
|
||||
* also alter the total issuance of the system (`TotalIssuance`) appropriately.
|
||||
* If the new free or reserved balance is below the existential deposit,
|
||||
* it will reset the account nonce (`frame_system::AccountNonce`).
|
||||
*
|
||||
@@ -150,7 +150,6 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Transfer some liquid free balance to another account.
|
||||
*
|
||||
* `transfer` will set the `FreeBalance` of the sender and receiver.
|
||||
* It will decrease the total issuance of the system by the `TransferFee`.
|
||||
* If the sender's account is below the existential deposit as a result
|
||||
* of the transfer, the account will be reaped.
|
||||
*
|
||||
@@ -2133,7 +2132,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* - be less than the number of possible candidates. Note that all current members and
|
||||
* runners-up are also automatically candidates for the next round.
|
||||
*
|
||||
* If `value` is more than `who`'s total balance, then the maximum of the two is used.
|
||||
* If `value` is more than `who`'s free balance, then the maximum of the two is used.
|
||||
*
|
||||
* The dispatch origin of this call must be signed.
|
||||
*
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -983,6 +983,11 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
* Para is not registered in our system.
|
||||
**/
|
||||
NotRegistered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The PVF pre-checking statement cannot be included since the PVF pre-checking mechanism
|
||||
* is disabled.
|
||||
**/
|
||||
PvfCheckDisabled: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The given validator already has cast a vote.
|
||||
**/
|
||||
|
||||
@@ -552,6 +552,21 @@ declare module '@polkadot/api-base/types/events' {
|
||||
* A new head has been noted for a Para. `para_id`
|
||||
**/
|
||||
NewHeadNoted: AugmentedEvent<ApiType, [u32]>;
|
||||
/**
|
||||
* The given validation code was rejected by the PVF pre-checking vote.
|
||||
* `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckAccepted: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* The given validation code was accepted by the PVF pre-checking vote.
|
||||
* `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckRejected: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* The given para either initiated or subscribed to a PVF check for the given validation
|
||||
* code. `code_hash` `para_id`
|
||||
**/
|
||||
PvfCheckStarted: AugmentedEvent<ApiType, [H256, u32]>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -139,7 +139,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Set the balances of a given account.
|
||||
*
|
||||
* This will alter `FreeBalance` and `ReservedBalance` in storage. it will
|
||||
* also decrease the total issuance of the system (`TotalIssuance`).
|
||||
* also alter the total issuance of the system (`TotalIssuance`) appropriately.
|
||||
* If the new free or reserved balance is below the existential deposit,
|
||||
* it will reset the account nonce (`frame_system::AccountNonce`).
|
||||
*
|
||||
@@ -150,7 +150,6 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Transfer some liquid free balance to another account.
|
||||
*
|
||||
* `transfer` will set the `FreeBalance` of the sender and receiver.
|
||||
* It will decrease the total issuance of the system by the `TransferFee`.
|
||||
* If the sender's account is below the existential deposit as a result
|
||||
* of the transfer, the account will be reaped.
|
||||
*
|
||||
@@ -2075,7 +2074,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* - be less than the number of possible candidates. Note that all current members and
|
||||
* runners-up are also automatically candidates for the next round.
|
||||
*
|
||||
* If `value` is more than `who`'s total balance, then the maximum of the two is used.
|
||||
* If `value` is more than `who`'s free balance, then the maximum of the two is used.
|
||||
*
|
||||
* The dispatch origin of this call must be signed.
|
||||
*
|
||||
|
||||
@@ -255,6 +255,12 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
* No code could be found at the supplied code hash.
|
||||
**/
|
||||
CodeNotFound: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The contract's code was found to be invalid during validation or instrumentation.
|
||||
* A more detailed error can be found on the node console if debug messages are enabled
|
||||
* or in the debug buffer which is returned to RPC clients.
|
||||
**/
|
||||
CodeRejected: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The code supplied to `instantiate_with_code` exceeds the limit specified in the
|
||||
* current schedule.
|
||||
|
||||
@@ -1624,7 +1624,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* - be less than the number of possible candidates. Note that all current members and
|
||||
* runners-up are also automatically candidates for the next round.
|
||||
*
|
||||
* If `value` is more than `who`'s total balance, then the maximum of the two is used.
|
||||
* If `value` is more than `who`'s free balance, then the maximum of the two is used.
|
||||
*
|
||||
* The dispatch origin of this call must be signed.
|
||||
*
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/rpc-core": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/rpc-core": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"rxjs": "^7.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/api": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/types-create": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/util-crypto": "^8.3.2",
|
||||
"@polkadot/api": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/types-create": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"@polkadot/util-crypto": "^8.3.3",
|
||||
"rxjs": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/keyring": "^8.3.2"
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/keyring": "^8.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ interface JSONAbi {
|
||||
},
|
||||
V2: {
|
||||
spec: SpecDef;
|
||||
},
|
||||
V3: {
|
||||
spec: SpecDef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +59,10 @@ describe('Abi', (): void => {
|
||||
|
||||
it(`initializes from a contract ABI (${abiName})`, (): void => {
|
||||
try {
|
||||
const messageIds = (abi.V2 || abi.V1 || abi).spec.messages.map(({ label, name }) =>
|
||||
const messageIds = (abi.V3 || abi.V2 || abi.V1 || abi).spec.messages.map(({ label, name }) =>
|
||||
label || (
|
||||
Array.isArray(name)
|
||||
? name[0]
|
||||
? name.join('::')
|
||||
: name
|
||||
)
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { TypeRegistry } from '@polkadot/types';
|
||||
import { TypeDefInfo } from '@polkadot/types-create';
|
||||
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { v0ToLatest, v1ToLatest } from './toLatest';
|
||||
import { convertVersions, enumVersions } from './toLatest';
|
||||
|
||||
const l = logger('Abi');
|
||||
|
||||
@@ -26,23 +26,18 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
|
||||
return assertReturn(message, () => `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||
}
|
||||
|
||||
// FIXME: This is still workable with V0, V1 & V2, but certainly is not a scalable
|
||||
// approach (right at this point don't quite have better ideas that is not as complex
|
||||
// as the conversion tactics in the runtime Metadata)
|
||||
function getLatestMeta (registry: Registry, json: Record<string, unknown>): ContractMetadataLatest {
|
||||
const vx = enumVersions.find((v) => isObject(json[v]));
|
||||
const metadata = registry.createType('ContractMetadata',
|
||||
isObject(json.V2)
|
||||
? { V2: json.V2 }
|
||||
: isObject(json.V1)
|
||||
? { V1: json.V1 }
|
||||
: { V0: json }
|
||||
vx
|
||||
? { [vx]: json[vx] }
|
||||
: { V0: json }
|
||||
) as unknown as ContractMetadata;
|
||||
const converter = convertVersions.find(([v]) => metadata[`is${v}`]);
|
||||
|
||||
return metadata.isV2
|
||||
? metadata.asV2
|
||||
: metadata.isV1
|
||||
? v1ToLatest(registry, metadata.asV1)
|
||||
: v0ToLatest(registry, metadata.asV0);
|
||||
assert(converter, () => `Unable to convert ABI with version ${metadata.type} to latest`);
|
||||
|
||||
return converter[1](registry, metadata[`as${converter[0]}`]);
|
||||
}
|
||||
|
||||
function parseJson (json: Record<string, unknown>, chainProperties?: ChainProperties): [Record<string, unknown>, Registry, ContractMetadataLatest, ContractProjectInfo] {
|
||||
@@ -90,7 +85,8 @@ export class Abi {
|
||||
);
|
||||
this.constructors = this.metadata.spec.constructors.map((spec: ContractConstructorSpecLatest, index) =>
|
||||
this.#createMessage(spec, index, {
|
||||
isConstructor: true
|
||||
isConstructor: true,
|
||||
isPayable: spec.payable.isTrue
|
||||
})
|
||||
);
|
||||
this.events = this.metadata.spec.events.map((spec: ContractEventSpecLatest, index) =>
|
||||
@@ -209,6 +205,7 @@ export class Abi {
|
||||
identifier,
|
||||
index,
|
||||
method: stringCamelCase(identifier),
|
||||
path: identifier.split('::').map((s) => stringCamelCase(s)),
|
||||
selector: spec.selector,
|
||||
toU8a: (params: unknown[]) =>
|
||||
this.#encodeArgs(spec, args, params)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { v0ToLatest, v1ToLatest } from '@polkadot/api-contract/Abi/toLatest';
|
||||
import { v0ToLatest, v1ToLatest, v2ToLatest, v3ToLatest } from '@polkadot/api-contract/Abi/toLatest';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import abis from '../test/contracts';
|
||||
@@ -65,9 +65,58 @@ describe('v1ToLatest', (): void => {
|
||||
).toEqual(['flip', 'get']);
|
||||
});
|
||||
|
||||
it('has the correct messages with namespaced method name', (): void => {
|
||||
const contract = registry.createType('ContractMetadata', { V1: abis.ink_v1_psp22.V1 });
|
||||
const latest = v1ToLatest(registry, contract.asV1);
|
||||
|
||||
expect(
|
||||
latest.spec.messages.map(({ label }) => label.toString())
|
||||
).toEqual([
|
||||
'PSP22Metadata::token_name', 'PSP22Metadata::token_symbol', 'PSP22Metadata::token_decimals', 'PSP22Mintable::mint', 'PSP22::decrease_allowance', 'PSP22::transfer', 'PSP22::approve', 'PSP22::allowance', 'PSP22::transfer_from', 'PSP22::balance_of', 'PSP22::increase_allowance', 'PSP22::total_supply', 'pause', 'unpause'
|
||||
]);
|
||||
});
|
||||
|
||||
it('has the correct constructor arguments', (): void => {
|
||||
expect(
|
||||
latest.spec.constructors[0].args.map(({ label }) => label.toString())
|
||||
).toEqual(['init_value']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('v2ToLatest', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const contract = registry.createType('ContractMetadata', { V2: abis.ink_v2_flipper.V2 });
|
||||
const latest = v2ToLatest(registry, contract.asV2);
|
||||
|
||||
it('has the correct constructor flag', (): void => {
|
||||
expect(
|
||||
latest.spec.constructors[0].payable.isTrue
|
||||
).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('v3ToLatest', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const contract = registry.createType('ContractMetadata', { V3: abis.ink_v3_flipper.V3 });
|
||||
const latest = v3ToLatest(registry, contract.asV3);
|
||||
|
||||
it('has the correct constructor flags', (): void => {
|
||||
expect(
|
||||
latest.spec.constructors[0].payable.isTrue
|
||||
).toEqual(false);
|
||||
expect(
|
||||
latest.spec.constructors[1].payable.isTrue
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
it('has the correct messages', (): void => {
|
||||
const contract = registry.createType('ContractMetadata', { V3: abis.ink_v3_traitErc20.V3 });
|
||||
const latest = v3ToLatest(registry, contract.asV3);
|
||||
|
||||
expect(
|
||||
latest.spec.messages.map(({ label }) => label.toString())
|
||||
).toEqual([
|
||||
'BaseErc20::total_supply', 'BaseErc20::balance_of', 'BaseErc20::allowance', 'BaseErc20::transfer', 'BaseErc20::approve', 'BaseErc20::transfer_from'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,38 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1 } from '@polkadot/types/interfaces';
|
||||
import type { ContractMetadataLatest, ContractMetadataV3 } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { v0ToV1 } from './toV1';
|
||||
import { v1ToV2 } from './toV2';
|
||||
import { v2ToV3 } from './toV3';
|
||||
|
||||
export function v1ToLatest (registry: Registry, v1: ContractMetadataV1): ContractMetadataLatest {
|
||||
return v1ToV2(registry, v1);
|
||||
type Versions = 'V3' | 'V2' | 'V1' | 'V0';
|
||||
|
||||
type Converter = (registry: Registry, vx: any) => ContractMetadataLatest;
|
||||
|
||||
// Helper to convert metadata from one step to the next
|
||||
function createConverter <I, O> (next: (registry: Registry, input: O) => ContractMetadataLatest, step: (registry: Registry, input: I) => O): (registry: Registry, input: I) => ContractMetadataLatest {
|
||||
return (registry: Registry, input: I): ContractMetadataLatest =>
|
||||
next(registry, step(registry, input));
|
||||
}
|
||||
|
||||
export function v0ToLatest (registry: Registry, v0: ContractMetadataV0): ContractMetadataLatest {
|
||||
return v1ToLatest(registry, v0ToV1(registry, v0));
|
||||
export function v3ToLatest (registry: Registry, v3: ContractMetadataV3): ContractMetadataLatest {
|
||||
return v3;
|
||||
}
|
||||
|
||||
export const v2ToLatest = createConverter(v3ToLatest, v2ToV3);
|
||||
export const v1ToLatest = createConverter(v2ToLatest, v1ToV2);
|
||||
export const v0ToLatest = createConverter(v1ToLatest, v0ToV1);
|
||||
|
||||
// The versions where an enum is used, aka V0 is missing
|
||||
// (Order from newest, i.e. we expect more on newest vs oldest)
|
||||
export const enumVersions = ['V3', 'V2', 'V1'];
|
||||
|
||||
export const convertVersions: [Versions, Converter][] = [
|
||||
['V3', v3ToLatest],
|
||||
['V2', v2ToLatest],
|
||||
['V1', v1ToLatest],
|
||||
['V0', v0ToLatest]
|
||||
];
|
||||
|
||||
@@ -7,8 +7,25 @@ import type { Registry } from '@polkadot/types/types';
|
||||
import { convertSiV0toV1 } from '@polkadot/types';
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
interface Named {
|
||||
name: unknown;
|
||||
}
|
||||
|
||||
function v0ToV1Names (all: Named[]): unknown[] {
|
||||
return all.map((e) =>
|
||||
objectSpread({}, e, {
|
||||
name: Array.isArray(e.name)
|
||||
? e.name
|
||||
: [e.name]
|
||||
}));
|
||||
}
|
||||
|
||||
export function v0ToV1 (registry: Registry, v0: ContractMetadataV0): ContractMetadataV1 {
|
||||
return registry.createType('ContractMetadataV1', objectSpread({}, v0, {
|
||||
spec: objectSpread({}, v0.spec, {
|
||||
constructors: v0ToV1Names(v0.spec.constructors),
|
||||
messages: v0ToV1Names(v0.spec.messages)
|
||||
}),
|
||||
types: convertSiV0toV1(registry, v0.types)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ const ARG_TYPES = {
|
||||
function v1ToV2Label (entry: NamedEntry): { label: Text } {
|
||||
return objectSpread({}, entry, {
|
||||
label: Array.isArray(entry.name)
|
||||
? entry.name[0]
|
||||
? entry.name.join('::')
|
||||
: entry.name
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ContractMetadataV2, ContractMetadataV3 } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
export function v2ToV3 (registry: Registry, v2: ContractMetadataV2): ContractMetadataV3 {
|
||||
return registry.createType('ContractMetadataV3', objectSpread({}, v2, {
|
||||
spec: objectSpread({}, v2.spec, {
|
||||
constructors: v2.spec.constructors.map((c) =>
|
||||
// V3 introduces the payable flag on constructors, for <V3, it is always true
|
||||
registry.createType('ContractConstructorSpecV3', objectSpread({}, c, { payable: true }))
|
||||
)
|
||||
})
|
||||
}));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
|
||||
this.abi.constructors.forEach((c): void => {
|
||||
if (isUndefined(this.#tx[c.method])) {
|
||||
this.#tx[c.method] = createBluePrintTx((o, p) => this.#deploy(c, o, p));
|
||||
this.#tx[c.method] = createBluePrintTx(c, (o, p) => this.#deploy(c, o, p));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
|
||||
this.abi.constructors.forEach((c): void => {
|
||||
if (isUndefined(this.#tx[c.method])) {
|
||||
this.#tx[c.method] = createBluePrintTx((o, p) => this.#instantiate(c, o, p));
|
||||
this.#tx[c.method] = createBluePrintTx(c, (o, p) => this.#instantiate(c, o, p));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { assert, BN, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefine
|
||||
import { Abi } from '../Abi';
|
||||
import { applyOnEvent, extractOptions, isOptions } from '../util';
|
||||
import { Base } from './Base';
|
||||
import { withMeta } from './util';
|
||||
|
||||
export interface ContractConstructor<ApiType extends ApiTypes> {
|
||||
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, address: string | AccountId): Contract<ApiType>;
|
||||
@@ -29,18 +30,20 @@ const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is
|
||||
|
||||
const l = logger('Contract');
|
||||
|
||||
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: unknown[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
|
||||
return (origin: string | AccountId | Uint8Array, options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome> =>
|
||||
function createQuery <ApiType extends ApiTypes> (meta: AbiMessage, fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: unknown[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
|
||||
return withMeta(meta, (origin: string | AccountId | Uint8Array, options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome> =>
|
||||
isOptions(options)
|
||||
? fn(origin, options, params)
|
||||
: fn(origin, ...extractOptions<ContractOptions>(options, params));
|
||||
: fn(origin, ...extractOptions<ContractOptions>(options, params))
|
||||
);
|
||||
}
|
||||
|
||||
function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, params: unknown[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
|
||||
return (options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType> =>
|
||||
function createTx <ApiType extends ApiTypes> (meta: AbiMessage, fn: (options: ContractOptions, params: unknown[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
|
||||
return withMeta(meta, (options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType> =>
|
||||
isOptions(options)
|
||||
? fn(options, params)
|
||||
: fn(...extractOptions<ContractOptions>(options, params));
|
||||
: fn(...extractOptions<ContractOptions>(options, params))
|
||||
);
|
||||
}
|
||||
|
||||
export class ContractSubmittableResult extends SubmittableResult {
|
||||
@@ -70,11 +73,11 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
|
||||
this.abi.messages.forEach((m): void => {
|
||||
if (isUndefined(this.#tx[m.method])) {
|
||||
this.#tx[m.method] = createTx((o, p) => this.#exec(m, o, p));
|
||||
this.#tx[m.method] = createTx(m, (o, p) => this.#exec(m, o, p));
|
||||
}
|
||||
|
||||
if (isUndefined(this.#query[m.method])) {
|
||||
this.#query[m.method] = createQuery((f, o, p) => this.#read(m, o, p).send(f));
|
||||
this.#query[m.method] = createQuery(m, (f, o, p) => this.#read(m, o, p).send(f));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,19 +8,23 @@ import type { AccountId } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
|
||||
|
||||
export interface BlueprintDeploy<ApiType extends ApiTypes> {
|
||||
export interface MessageMeta {
|
||||
readonly meta: AbiMessage;
|
||||
}
|
||||
|
||||
export interface BlueprintDeploy<ApiType extends ApiTypes> extends MessageMeta {
|
||||
(options: BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
|
||||
// @deprecated Use options form (to be dropped in a major update)
|
||||
(value: bigint | string | number | BN, gasLimit: bigint | string | number | BN, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
|
||||
}
|
||||
|
||||
export interface ContractQuery<ApiType extends ApiTypes> {
|
||||
export interface ContractQuery<ApiType extends ApiTypes> extends MessageMeta {
|
||||
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
|
||||
// @deprecated Use options form (to be dropped in a major update)
|
||||
(origin: AccountId | string | Uint8Array, value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
|
||||
}
|
||||
|
||||
export interface ContractTx<ApiType extends ApiTypes> {
|
||||
export interface ContractTx<ApiType extends ApiTypes> extends MessageMeta {
|
||||
(options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
|
||||
// @deprecated Use options form (to be dropped in a major update)
|
||||
(value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { SubmittableResult } from '@polkadot/api';
|
||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||
import type { AbiConstructor, AbiMessage, BlueprintOptions } from '../types';
|
||||
import type { BlueprintDeploy, ContractGeneric } from './types';
|
||||
|
||||
import { Bytes } from '@polkadot/types';
|
||||
@@ -16,11 +16,18 @@ import { extractOptions, isOptions } from '../util';
|
||||
|
||||
export const EMPTY_SALT = new Uint8Array();
|
||||
|
||||
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: unknown[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
|
||||
return (options: bigint | string | number | BN | BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType, R> =>
|
||||
export function withMeta <T extends { meta: AbiMessage }> (meta: AbiMessage, creator: Omit<T, 'meta'>): T {
|
||||
(creator as T).meta = meta;
|
||||
|
||||
return creator as T;
|
||||
}
|
||||
|
||||
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (meta: AbiMessage, fn: (options: BlueprintOptions, params: unknown[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
|
||||
return withMeta(meta, (options: bigint | string | number | BN | BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType, R> =>
|
||||
isOptions(options)
|
||||
? fn(options, params)
|
||||
: fn(...extractOptions<BlueprintOptions>(options, params));
|
||||
: fn(...extractOptions<BlueprintOptions>(options, params))
|
||||
);
|
||||
}
|
||||
|
||||
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: unknown[]) => T): ContractGeneric<BlueprintOptions, T> {
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -0,0 +1,529 @@
|
||||
[
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 0,
|
||||
"type": "u128",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 1,
|
||||
"lookupName": "InkStorageCollectionsStashHeader",
|
||||
"type": "{\"lastVacant\":\"u32\",\"len\":\"u32\",\"lenEntries\":\"u32\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::Header",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "lastVacant",
|
||||
"typeName": "Index"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "len",
|
||||
"typeName": "u32"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "lenEntries",
|
||||
"typeName": "u32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 3,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"InkStorageCollectionsStashVacantEntry\",\"Occupied\":\"AccountId\"}}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::Entry",
|
||||
"sub": [
|
||||
{
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 7,
|
||||
"lookupName": "InkStorageCollectionsStashVacantEntry",
|
||||
"type": "Lookup7",
|
||||
"typeName": "VacantEntry",
|
||||
"index": 0,
|
||||
"name": "Vacant"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId",
|
||||
"typeName": "T",
|
||||
"index": 1,
|
||||
"name": "Occupied"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
},
|
||||
{
|
||||
"info": "VecFixed",
|
||||
"lookupIndex": 5,
|
||||
"type": "[u8;32]",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 6,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 6,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 7,
|
||||
"lookupName": "InkStorageCollectionsStashVacantEntry",
|
||||
"type": "{\"next\":\"u32\",\"prev\":\"u32\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::VacantEntry",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "next",
|
||||
"typeName": "Index"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "prev",
|
||||
"typeName": "Index"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 8,
|
||||
"type": "{\"value\":\"u128\",\"keyIndex\":\"u32\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::hashmap::ValueEntry",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 0,
|
||||
"type": "u128",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "value",
|
||||
"typeName": "V"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "keyIndex",
|
||||
"typeName": "KeyIndex"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 9,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"InkStorageCollectionsStashVacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::Entry",
|
||||
"sub": [
|
||||
{
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 7,
|
||||
"lookupName": "InkStorageCollectionsStashVacantEntry",
|
||||
"type": "Lookup7",
|
||||
"typeName": "VacantEntry",
|
||||
"index": 0,
|
||||
"name": "Vacant"
|
||||
},
|
||||
{
|
||||
"info": "Tuple",
|
||||
"lookupIndex": 10,
|
||||
"type": "(AccountId,AccountId)",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
],
|
||||
"typeName": "T",
|
||||
"index": 1,
|
||||
"name": "Occupied"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Tuple",
|
||||
"lookupIndex": 10,
|
||||
"type": "(AccountId,AccountId)",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 11,
|
||||
"type": "Text",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 12,
|
||||
"type": "bool",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 13,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"InkStorageCollectionsStashVacantEntry\",\"Occupied\":\"u32\"}}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::Entry",
|
||||
"sub": [
|
||||
{
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 7,
|
||||
"lookupName": "InkStorageCollectionsStashVacantEntry",
|
||||
"type": "Lookup7",
|
||||
"typeName": "VacantEntry",
|
||||
"index": 0,
|
||||
"name": "Vacant"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"typeName": "T",
|
||||
"index": 1,
|
||||
"name": "Occupied"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 14,
|
||||
"type": "{\"value\":\"u32\",\"keyIndex\":\"u32\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::hashmap::ValueEntry",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "value",
|
||||
"typeName": "V"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "keyIndex",
|
||||
"typeName": "KeyIndex"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 15,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"InkStorageCollectionsStashVacantEntry\",\"Occupied\":\"(u32,AccountId)\"}}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::stash::Entry",
|
||||
"sub": [
|
||||
{
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 7,
|
||||
"lookupName": "InkStorageCollectionsStashVacantEntry",
|
||||
"type": "Lookup7",
|
||||
"typeName": "VacantEntry",
|
||||
"index": 0,
|
||||
"name": "Vacant"
|
||||
},
|
||||
{
|
||||
"info": "Tuple",
|
||||
"lookupIndex": 16,
|
||||
"type": "(u32,AccountId)",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
],
|
||||
"typeName": "T",
|
||||
"index": 1,
|
||||
"name": "Occupied"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Tuple",
|
||||
"lookupIndex": 16,
|
||||
"type": "(u32,AccountId)",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 17,
|
||||
"type": "{\"value\":\"Null\",\"keyIndex\":\"u32\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::collections::hashmap::ValueEntry",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Null",
|
||||
"lookupIndex": 18,
|
||||
"type": "Null",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "value",
|
||||
"typeName": "V"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "u32",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"name": "keyIndex",
|
||||
"typeName": "KeyIndex"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"lookupIndex": 18,
|
||||
"type": "Null",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Option",
|
||||
"lookupIndex": 19,
|
||||
"type": "Option<Text>",
|
||||
"docs": [],
|
||||
"namespace": "Option",
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 11,
|
||||
"type": "Text",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": "Result",
|
||||
"lookupIndex": 20,
|
||||
"type": "Result<Null, ContractsErrorsPsp22Psp22Error>",
|
||||
"docs": [],
|
||||
"namespace": "Result",
|
||||
"sub": [
|
||||
{
|
||||
"name": "Ok",
|
||||
"info": "Null",
|
||||
"lookupIndex": 18,
|
||||
"type": "Null",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"name": "Error",
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 21,
|
||||
"lookupName": "ContractsErrorsPsp22Psp22Error",
|
||||
"type": "Lookup21"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 21,
|
||||
"lookupName": "ContractsErrorsPsp22Psp22Error",
|
||||
"type": "{\"_enum\":{\"Custom\":\"Text\",\"InsufficientBalance\":\"Null\",\"InsufficientAllowance\":\"Null\",\"ZeroRecipientAddress\":\"Null\",\"ZeroSenderAddress\":\"Null\",\"SafeTransferCheckFailed\":\"Text\"}}",
|
||||
"docs": [],
|
||||
"namespace": "contracts::traits::errors::psp22::PSP22Error",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 11,
|
||||
"type": "Text",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"typeName": "Text",
|
||||
"index": 0,
|
||||
"name": "Custom"
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 1,
|
||||
"name": "InsufficientBalance"
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 2,
|
||||
"name": "InsufficientAllowance"
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 3,
|
||||
"name": "ZeroRecipientAddress"
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 4,
|
||||
"name": "ZeroSenderAddress"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 11,
|
||||
"type": "Text",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"typeName": "Text",
|
||||
"index": 5,
|
||||
"name": "SafeTransferCheckFailed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 22,
|
||||
"type": "Bytes",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Option",
|
||||
"lookupIndex": 23,
|
||||
"type": "Option<AccountId>",
|
||||
"docs": [],
|
||||
"namespace": "Option",
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 0,
|
||||
"type": "bool",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,204 @@
|
||||
[
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 0,
|
||||
"type": "u128",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 1,
|
||||
"type": "{\"offsetKey\":\"InkPrimitivesKey\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::lazy::mapping::Mapping",
|
||||
"sub": [
|
||||
{
|
||||
"info": "VecFixed",
|
||||
"lookupIndex": 5,
|
||||
"lookupName": "InkPrimitivesKey",
|
||||
"type": "[u8;32]",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
"typeName": "Key",
|
||||
"name": "offsetKey"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
},
|
||||
{
|
||||
"info": "VecFixed",
|
||||
"lookupIndex": 3,
|
||||
"type": "[u8;32]",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "VecFixed",
|
||||
"lookupIndex": 5,
|
||||
"lookupName": "InkPrimitivesKey",
|
||||
"type": "[u8;32]",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
"typeName": "[u8;32]"
|
||||
},
|
||||
{
|
||||
"info": "Struct",
|
||||
"lookupIndex": 6,
|
||||
"type": "{\"offsetKey\":\"InkPrimitivesKey\"}",
|
||||
"docs": [],
|
||||
"namespace": "ink_storage::lazy::mapping::Mapping",
|
||||
"sub": [
|
||||
{
|
||||
"info": "VecFixed",
|
||||
"lookupIndex": 5,
|
||||
"lookupName": "InkPrimitivesKey",
|
||||
"type": "[u8;32]",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 4,
|
||||
"type": "u8",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
"typeName": "Key",
|
||||
"name": "offsetKey"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Tuple",
|
||||
"lookupIndex": 7,
|
||||
"type": "(AccountId,AccountId)",
|
||||
"docs": [],
|
||||
"namespace": "",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
},
|
||||
{
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Result",
|
||||
"lookupIndex": 8,
|
||||
"type": "Result<Null, TraitErc20Erc20Error>",
|
||||
"docs": [],
|
||||
"namespace": "Result",
|
||||
"sub": [
|
||||
{
|
||||
"name": "Ok",
|
||||
"info": "Null",
|
||||
"lookupIndex": 9,
|
||||
"type": "Null",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"name": "Error",
|
||||
"docs": [],
|
||||
"info": "Si",
|
||||
"lookupIndex": 10,
|
||||
"lookupName": "TraitErc20Erc20Error",
|
||||
"type": "Lookup10"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"lookupIndex": 9,
|
||||
"type": "Null",
|
||||
"docs": [],
|
||||
"namespace": ""
|
||||
},
|
||||
{
|
||||
"info": "Enum",
|
||||
"lookupIndex": 10,
|
||||
"lookupName": "TraitErc20Erc20Error",
|
||||
"type": "{\"_enum\":[\"InsufficientBalance\",\"InsufficientAllowance\"]}",
|
||||
"docs": [],
|
||||
"namespace": "trait_erc20::erc20::Error",
|
||||
"sub": [
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 0,
|
||||
"name": "InsufficientBalance"
|
||||
},
|
||||
{
|
||||
"info": "Null",
|
||||
"type": "Null",
|
||||
"index": 1,
|
||||
"name": "InsufficientAllowance"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Option",
|
||||
"lookupIndex": 11,
|
||||
"type": "Option<AccountId>",
|
||||
"docs": [],
|
||||
"namespace": "Option",
|
||||
"sub": {
|
||||
"info": "Plain",
|
||||
"lookupIndex": 2,
|
||||
"type": "AccountId",
|
||||
"docs": [],
|
||||
"namespace": "ink_env::types::AccountId",
|
||||
"lookupNameRoot": "InkEnvAccountId"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -5,5 +5,6 @@ import { createVersionedExport } from '../util';
|
||||
import * as v0 from './v0';
|
||||
import * as v1 from './v1';
|
||||
import * as v2 from './v2';
|
||||
import * as v3 from './v3';
|
||||
|
||||
export default createVersionedExport({ v0, v1, v2 });
|
||||
export default createVersionedExport({ v0, v1, v2, v3 });
|
||||
|
||||
@@ -2,3 +2,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as flipper } from './flipper.contract.json';
|
||||
// A complex contract example with traits.
|
||||
export { default as psp22 } from './psp22_minter_pauser.contract.json';
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"source": {
|
||||
"hash": "0xbb381c2fc980121b17c7b2bf2756d5964a12151cb846e0a9eff9cc337806456d",
|
||||
"language": "ink! 3.0.0-rc7",
|
||||
"compiler": "rustc 1.60.0-nightly",
|
||||
"wasm": "0x0061736d0100000001280860027f7f0060000060037f7f7f0060017f006000017f60017f017f60037f7f7f017f60017f017e02880106057365616c30107365616c5f7365745f73746f726167650002057365616c30107365616c5f6765745f73746f726167650006057365616c300a7365616c5f696e7075740000057365616c300b7365616c5f72657475726e0002057365616c30167365616c5f76616c75655f7472616e73666572726564000003656e76066d656d6f727902010210030a090400050103070001000608017f01418080040b071102066465706c6f7900080463616c6c000c0ac40b096102027f027e230041206b22002400200041106a22014200370300200042003703082000411036021c200041086a2000411c6a1004200028021c41114f0440000b2001290300210220002903082103200041206a2400410541042002200384501b0bc20101027f230041306b220224004101210302402000027f20014101714504404104100541ff01714105470d011a0b200241106a4200370300200241186a4200370300200241206a42003703002002420037030820024201370300200241808001360228200241086a41808004200241286a100120022802282201418180014f720d012002200136022c200241808004360228200241286a100741ff017122014102460d014100210320014100470b3a0001200020033a0000200241306a24000f0b000b4201027f230041106b22012400200141086a2000100d20012d0009210020012d00082102200141106a240041024101410220004101461b410020001b20024101711b0bd30202057f027e230041306b2200240020004180800136020c200041808004360208200041086a1009200020002903083703100240200041106a100a22054201832206a70d00200542807e8342002006501b22064280feffffff1f832205422088a721012005421888a721022005421088a7210302402006a741087641ff0171220441ed014704402004419b0147200341ff017141ae014772200241ff0171419d0147200141de004772720d02200041106a100741ff017122014102460d02100541ff01714105470d02200041286a4200370300200041206a4200370300200041186a4200370300200042003703102001410171200041106a100b0c010b200341ff017141cb0047200241ff0171419d0147722001411b47720d01200041286a4200370300200041206a4200370300200041186a4200370300200042003703104100200041106a100b0b200041306a24000f0b000b4101027f230041106b2201240020012000280204220236020c20002802002001410c6a10022002200128020c2202490440000b20002002360204200141106a24000b850102027f017e230041106b220124002001420437030841042102027f02400240034020012000100d20012d00004101710d01200141086a20026a20012d00013a0000200241016a22024108470d000b20012903082203a741044f0d01000b4101210241000c010b410021022003422088a70b2100200141106a24002002ad2000ad420886840b6b01017f230041306b220224004180800420003a0000200241286a200141186a290000370300200241206a200141106a290000370300200241186a200141086a2900003703002002420137030820022001290000370310200241106a4180800441011000200241306a24000b910302057f027e230041406a22002400024002400240100541ff01714105470d0020004180800136021c200041808004360218200041186a100920002000290318370320027f0240200041206a100a22054201832206a70d00200542807e8342002006501b22064280feffffff1f832205422088a721022005421888a721012005421088a721032006a741087641ff01712204412f470440200441e30047200341ff0171413a4772200141ff017141a50147200241d1004772720d014101210141000c020b200341ff017141860147200141ff017141db0047720d00410021014100200241d901460d011a0b4101210141010b0d00024020010440200041086a418002100620002d0009210120002d00084101710d01200041386a4200370300200041306a4200370300200041286a4200370300200042003703202001417f73410171200041206a100b0c040b200041106a4100100620002d0011210120002d0010410171450d020b20014105460d020b000b4180800420014101713a000041004180800441011003000b200041406b24000b3c01017f200020012802042202047f2001200241016b36020420012001280200220141016a36020020012d00000520010b3a000120002002453a00000b"
|
||||
},
|
||||
"contract": {
|
||||
"name": "flipper",
|
||||
"version": "3.0.0-rc7",
|
||||
"authors": [
|
||||
"Parity Technologies <admin@parity.io>"
|
||||
]
|
||||
},
|
||||
"V3": {
|
||||
"spec": {
|
||||
"constructors": [
|
||||
{
|
||||
"args": [
|
||||
{
|
||||
"label": "init_value",
|
||||
"type": {
|
||||
"displayName": [
|
||||
"bool"
|
||||
],
|
||||
"type": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
"Creates a new flipper smart contract initialized with the given value."
|
||||
],
|
||||
"label": "new",
|
||||
"payable": false,
|
||||
"selector": "0x9bae9d5e"
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"docs": [
|
||||
"Creates a new flipper smart contract initialized to `false`."
|
||||
],
|
||||
"label": "default",
|
||||
"payable": true,
|
||||
"selector": "0xed4b9d1b"
|
||||
}
|
||||
],
|
||||
"docs": [],
|
||||
"events": [],
|
||||
"messages": [
|
||||
{
|
||||
"args": [],
|
||||
"docs": [
|
||||
" Flips the current value of the Flipper's boolean."
|
||||
],
|
||||
"label": "flip",
|
||||
"mutates": true,
|
||||
"payable": false,
|
||||
"returnType": null,
|
||||
"selector": "0x633aa551"
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"docs": [
|
||||
" Returns the current value of the Flipper's boolean."
|
||||
],
|
||||
"label": "get",
|
||||
"mutates": false,
|
||||
"payable": false,
|
||||
"returnType": {
|
||||
"displayName": [
|
||||
"bool"
|
||||
],
|
||||
"type": 0
|
||||
},
|
||||
"selector": "0x2f865bd9"
|
||||
}
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"struct": {
|
||||
"fields": [
|
||||
{
|
||||
"layout": {
|
||||
"cell": {
|
||||
"key": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"ty": 0
|
||||
}
|
||||
},
|
||||
"name": "value"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"types": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"def": {
|
||||
"primitive": "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as flipper } from './flipper.contract.json';
|
||||
// A complex contract example with traits.
|
||||
export { default as traitErc20 } from './trait_erc20.contract.json';
|
||||
File diff suppressed because one or more lines are too long
@@ -40,6 +40,7 @@ export interface AbiMessage {
|
||||
isMutating?: boolean;
|
||||
isPayable?: boolean;
|
||||
method: string;
|
||||
path: string[];
|
||||
returnType?: TypeDef | null;
|
||||
selector: ContractSelector;
|
||||
toU8a: (params: unknown[]) => Uint8Array;
|
||||
|
||||
@@ -20,25 +20,25 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/api": "7.4.1",
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/api-base": "7.4.1",
|
||||
"@polkadot/rpc-core": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/util-crypto": "^8.3.2",
|
||||
"@polkadot/api": "7.5.1",
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/api-base": "7.5.1",
|
||||
"@polkadot/rpc-core": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"@polkadot/util-crypto": "^8.3.3",
|
||||
"rxjs": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api": "7.4.1",
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/rpc-augment": "7.4.1",
|
||||
"@polkadot/rpc-provider": "7.4.1",
|
||||
"@polkadot/types-support": "7.4.1"
|
||||
"@polkadot/api": "7.5.1",
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/rpc-augment": "7.5.1",
|
||||
"@polkadot/rpc-provider": "7.5.1",
|
||||
"@polkadot/types-support": "7.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { AccountId } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { HeaderExtended } from '../type/types';
|
||||
import type { DeriveApi } from '../types';
|
||||
|
||||
@@ -39,7 +38,7 @@ export function getHeader (instanceId: string, api: DeriveApi): (blockHash: Uint
|
||||
)
|
||||
]).pipe(
|
||||
map(([header, validators]) =>
|
||||
createHeaderExtended(header.registry as Registry, header, validators)
|
||||
createHeaderExtended(header.registry, header, validators)
|
||||
),
|
||||
catchError((): Observable<undefined> =>
|
||||
// where rpc.chain.getHeader throws, we will land here - it can happen that
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { SignedBlockExtended } from '../type/types';
|
||||
import type { DeriveApi } from '../types';
|
||||
|
||||
@@ -33,7 +32,7 @@ export function subscribeNewBlocks (instanceId: string, api: DeriveApi): () => O
|
||||
]);
|
||||
}),
|
||||
map(([header, block, events]) =>
|
||||
createSignedBlockExtended(block.registry as Registry, block, events, header.validators)
|
||||
createSignedBlockExtended(block.registry, block, events, header.validators)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { HeaderExtended } from '../type/types';
|
||||
import type { DeriveApi } from '../types';
|
||||
|
||||
@@ -35,7 +34,7 @@ export function subscribeNewHeads (instanceId: string, api: DeriveApi): () => Ob
|
||||
map(([header, validators]): HeaderExtended => {
|
||||
header.createdAtHash = header.hash;
|
||||
|
||||
return createHeaderExtended(header.registry as Registry, header, validators);
|
||||
return createHeaderExtended(header.registry, header, validators);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
+17
-17
@@ -20,29 +20,29 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/api-base": "7.4.1",
|
||||
"@polkadot/api-derive": "7.4.1",
|
||||
"@polkadot/keyring": "^8.3.2",
|
||||
"@polkadot/rpc-augment": "7.4.1",
|
||||
"@polkadot/rpc-core": "7.4.1",
|
||||
"@polkadot/rpc-provider": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-augment": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/types-create": "7.4.1",
|
||||
"@polkadot/types-known": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/util-crypto": "^8.3.2",
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/api-base": "7.5.1",
|
||||
"@polkadot/api-derive": "7.5.1",
|
||||
"@polkadot/keyring": "^8.3.3",
|
||||
"@polkadot/rpc-augment": "7.5.1",
|
||||
"@polkadot/rpc-core": "7.5.1",
|
||||
"@polkadot/rpc-provider": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-augment": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/types-create": "7.5.1",
|
||||
"@polkadot/types-known": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"@polkadot/util-crypto": "^8.3.3",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"rxjs": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/types-support": "7.4.1"
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/types-support": "7.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
const lazySection = (section: string) =>
|
||||
lazyMethods({}, Object.keys(query[section]), (method: string) =>
|
||||
blockHash
|
||||
? this._decorateStorageEntryAt(registry as Registry, query[section][method], decorateMethod, blockHash)
|
||||
? this._decorateStorageEntryAt(registry, query[section][method], decorateMethod, blockHash)
|
||||
: this._decorateStorageEntry(query[section][method], decorateMethod)
|
||||
);
|
||||
|
||||
@@ -526,7 +526,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
decorated.sizeAt = decorateMethod((blockHash: Hash | Uint8Array | string, ...args: unknown[]): Observable<u64> =>
|
||||
getQueryAt(blockHash).pipe(
|
||||
switchMap((q) =>
|
||||
this._rpcCore.state.getStorageSize(getArgs(args, q.creator.meta.registry as Registry), blockHash))));
|
||||
this._rpcCore.state.getStorageSize(getArgs(args, q.creator.meta.registry), blockHash))));
|
||||
|
||||
// .keys() & .entries() only available on map types
|
||||
if (creator.iterKey && creator.meta.type.isMap) {
|
||||
@@ -613,6 +613,15 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
this._retrieveMapKeys(creator, blockHash, args)));
|
||||
}
|
||||
|
||||
if (this.supportMulti && creator.meta.type.isMap) {
|
||||
// When using double map storage function, user need to pass double map key as an array
|
||||
decorated.multi = decorateMethod((args: unknown[]): Observable<Codec[]> =>
|
||||
creator.meta.type.asMap.hashers.length === 1
|
||||
? this._retrieveMulti(args.map((a) => [creator, [a]]), blockHash)
|
||||
: this._retrieveMulti(args.map((a) => [creator, a as unknown[]]), blockHash)
|
||||
);
|
||||
}
|
||||
|
||||
/* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
return this._decorateFunctionMeta(creator as unknown as MetaDecoration, decorated) as unknown as QueryableStorageEntry<ApiType>;
|
||||
@@ -647,17 +656,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
}
|
||||
|
||||
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE sizes
|
||||
private _retrieveMulti (keys: [StorageEntry, unknown[]][]): Observable<Codec[]> {
|
||||
private _retrieveMulti (keys: [StorageEntry, unknown[]][], blockHash?: Uint8Array): Observable<Codec[]> {
|
||||
if (!keys.length) {
|
||||
return of([]);
|
||||
}
|
||||
|
||||
const queryCall = this.hasSubscriptions
|
||||
const queryCall = this.hasSubscriptions && !blockHash
|
||||
? this._rpcCore.state.subscribeStorage
|
||||
: this._rpcCore.state.queryStorageAt;
|
||||
|
||||
return combineLatest(
|
||||
arrayChunk(keys, PAGE_SIZE_V).map((keys) => queryCall(keys))
|
||||
arrayChunk(keys, PAGE_SIZE_V).map((k) =>
|
||||
blockHash
|
||||
? queryCall(k, blockHash)
|
||||
: queryCall(k)
|
||||
)
|
||||
).pipe(
|
||||
map(arrayFlatten)
|
||||
);
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import type { Observable, OperatorFunction } from 'rxjs';
|
||||
import type { Address, ApplyExtrinsicResult, Call, Extrinsic, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo, SignerPayload } from '@polkadot/types/interfaces';
|
||||
import type { Callback, Codec, Constructor, IKeyringPair, ISubmittableResult, SignatureOptions } from '@polkadot/types/types';
|
||||
import type { CodecRegistry } from '@polkadot/types-codec/types';
|
||||
import type { Registry } from '@polkadot/types-codec/types';
|
||||
import type { ApiInterfaceRx, ApiTypes, PromiseOrObs, SignerResult } from '../types';
|
||||
import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultResult, SubmittableResultSubscription } from './types';
|
||||
|
||||
@@ -26,7 +26,7 @@ interface SubmittableOptions<ApiType extends ApiTypes> {
|
||||
|
||||
const identity = <T> (input: T): T => input;
|
||||
|
||||
function makeEraOptions (api: ApiInterfaceRx, registry: CodecRegistry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
|
||||
function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
|
||||
if (!header) {
|
||||
if (isNumber(partialOptions.era)) {
|
||||
// since we have no header, it is immortal, remove any option overrides
|
||||
@@ -84,7 +84,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
|
||||
#transformResult: (input: ISubmittableResult) => ISubmittableResult = identity;
|
||||
|
||||
constructor (registry: CodecRegistry, extrinsic: Call | Extrinsic | Uint8Array | string) {
|
||||
constructor (registry: Registry, extrinsic: Call | Extrinsic | Uint8Array | string) {
|
||||
super(registry, extrinsic, { version: api.extrinsicType });
|
||||
|
||||
this.#ignoreStatusCb = apiType === 'rxjs';
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/rpc-core": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2"
|
||||
"@polkadot/rpc-core": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -20,18 +20,18 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/rpc-augment": "7.4.1",
|
||||
"@polkadot/rpc-provider": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/rpc-augment": "7.5.1",
|
||||
"@polkadot/rpc-provider": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"rxjs": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^8.3.2",
|
||||
"@polkadot/rpc-augment": "7.4.1"
|
||||
"@polkadot/keyring": "^8.3.3",
|
||||
"@polkadot/rpc-augment": "7.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/keyring": "^8.3.2",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-support": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/util-crypto": "^8.3.2",
|
||||
"@polkadot/x-fetch": "^8.3.2",
|
||||
"@polkadot/x-global": "^8.3.2",
|
||||
"@polkadot/x-ws": "^8.3.2",
|
||||
"@polkadot/keyring": "^8.3.3",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-support": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"@polkadot/util-crypto": "^8.3.3",
|
||||
"@polkadot/x-fetch": "^8.3.3",
|
||||
"@polkadot/x-global": "^8.3.3",
|
||||
"@polkadot/x-ws": "^8.3.3",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"mock-socket": "^9.0.8",
|
||||
"mock-socket": "^9.1.0",
|
||||
"nock": "^13.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
|
||||
@@ -30,20 +30,20 @@
|
||||
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.16.7",
|
||||
"@babel/core": "^7.16.12",
|
||||
"@babel/register": "^7.16.9",
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/api": "7.4.1",
|
||||
"@polkadot/api-augment": "7.4.1",
|
||||
"@polkadot/rpc-augment": "7.4.1",
|
||||
"@polkadot/rpc-provider": "7.4.1",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-augment": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/types-create": "7.4.1",
|
||||
"@polkadot/types-support": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2",
|
||||
"@polkadot/x-ws": "^8.3.2",
|
||||
"@polkadot/api": "7.5.1",
|
||||
"@polkadot/api-augment": "7.5.1",
|
||||
"@polkadot/rpc-augment": "7.5.1",
|
||||
"@polkadot/rpc-provider": "7.5.1",
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-augment": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/types-create": "7.5.1",
|
||||
"@polkadot/types-support": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3",
|
||||
"@polkadot/x-ws": "^8.3.3",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.3.1"
|
||||
|
||||
@@ -16,7 +16,7 @@ import staticPolkadot from '@polkadot/types-support/metadata/static-polkadot';
|
||||
import staticSubstrate from '@polkadot/types-support/metadata/static-substrate';
|
||||
import { isString, stringify } from '@polkadot/util';
|
||||
|
||||
import { createImports, exportType, initMeta, readTemplate, writeFile } from '../util';
|
||||
import { createImports, exportInterface, initMeta, readTemplate, writeFile } from '../util';
|
||||
import { typeEncoders } from './tsDef';
|
||||
|
||||
const WITH_TYPEDEF = false;
|
||||
@@ -191,7 +191,7 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
|
||||
typeDef.name = typeDef.lookupName;
|
||||
|
||||
return typeDef.lookupNameRoot && typeDef.lookupName
|
||||
? exportType(typeDef.lookupIndex, typeDef.lookupName, typeDef.lookupNameRoot)
|
||||
? exportInterface(typeDef.lookupIndex, typeDef.lookupName, typeDef.lookupNameRoot)
|
||||
: typeEncoders[typeDef.info](registry, imports.definitions, typeDef, imports);
|
||||
}).filter((t): t is string => !!t);
|
||||
|
||||
@@ -219,8 +219,8 @@ function generateLookup (destDir: string, entries: [string | undefined, HexStrin
|
||||
const { lookup, registry } = initMeta(staticMeta).metadata.asLatest;
|
||||
const filtered = getFilteredTypes(lookup, exclude);
|
||||
|
||||
generateLookupDefs(registry as Registry, filtered, destDir, subPath);
|
||||
generateLookupTypes(registry as Registry, filtered, destDir, subPath);
|
||||
generateLookupDefs(registry, filtered, destDir, subPath);
|
||||
generateLookupTypes(registry, filtered, destDir, subPath);
|
||||
|
||||
return exclude.concat(
|
||||
...filtered
|
||||
|
||||
@@ -13,7 +13,7 @@ import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
|
||||
import { getTypeDef, TypeDefInfo } from '@polkadot/types-create';
|
||||
import { assert, isString, stringify, stringPascalCase } from '@polkadot/util';
|
||||
|
||||
import { createImports, exportInterface, exportType, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util';
|
||||
import { createImports, exportInterface, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util';
|
||||
|
||||
interface Imports extends TypeImports {
|
||||
interfaces: [string, string][];
|
||||
@@ -204,11 +204,11 @@ function tsVec (registry: Registry, definitions: Record<string, ModuleTypes>, de
|
||||
if (def.info === TypeDefInfo.VecFixed) {
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return exportType(def.lookupIndex, def.name, 'U8aFixed');
|
||||
return exportInterface(def.lookupIndex, def.name, 'U8aFixed');
|
||||
} else {
|
||||
setImports(definitions, imports, ['Bytes']);
|
||||
|
||||
return exportType(def.lookupIndex, def.name, 'Bytes');
|
||||
return exportInterface(def.lookupIndex, def.name, 'Bytes');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { CodecRegistry } from '@polkadot/types-codec/types';
|
||||
import type { TypeDef } from '@polkadot/types-create/types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
@@ -109,15 +108,7 @@ export function exportInterface (lookupIndex = -1, name = '', base: string, body
|
||||
return `${doc}export interface ${name} extends ${base} {${body.length ? '\n' : ''}${body}}`;
|
||||
}
|
||||
|
||||
// helper to create an `export type <Name> = <Base>`
|
||||
// but since we don't want type alias (TS doesn't preserve names) we use
|
||||
// interface here.
|
||||
/** @internal */
|
||||
export function exportType (lookupIndex = -1, name = '', base: string): string {
|
||||
return exportInterface(lookupIndex, name, base);
|
||||
}
|
||||
|
||||
function singleParamNotation (registry: CodecRegistry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
|
||||
function singleParamNotation (registry: Registry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
setImports(definitions, imports, [wrapper, sub.lookupName]);
|
||||
@@ -125,7 +116,7 @@ function singleParamNotation (registry: CodecRegistry, wrapper: string, typeDef:
|
||||
return paramsNotation(wrapper, sub.lookupName || formatType(registry, definitions, sub.type, imports, withShortcut));
|
||||
}
|
||||
|
||||
function dualParamsNotation (registry: CodecRegistry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
|
||||
function dualParamsNotation (registry: Registry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
|
||||
const [a, b] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
setImports(definitions, imports, [wrapper, a.lookupName, b.lookupName]);
|
||||
@@ -136,18 +127,18 @@ function dualParamsNotation (registry: CodecRegistry, wrapper: string, typeDef:
|
||||
]);
|
||||
}
|
||||
|
||||
const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => string> = {
|
||||
[TypeDefInfo.Compact]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => string> = {
|
||||
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'Compact', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: CodecRegistry, { lookupName }: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: Registry, { lookupName }: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['DoNotConstruct']);
|
||||
|
||||
return 'DoNotConstruct';
|
||||
},
|
||||
|
||||
[TypeDefInfo.Enum]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
if (typeDef.lookupName) {
|
||||
return typeDef.lookupName;
|
||||
}
|
||||
@@ -155,43 +146,43 @@ const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef
|
||||
throw new Error(`TypeDefInfo.Enum: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Int]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Int: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.UInt]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.UInt: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Null]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Null']);
|
||||
|
||||
return 'Null';
|
||||
},
|
||||
|
||||
[TypeDefInfo.Option]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'Option', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Plain]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, [typeDef.type]);
|
||||
|
||||
return typeDef.type;
|
||||
},
|
||||
|
||||
[TypeDefInfo.Range]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Range]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Range: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Set]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Set: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Si]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return formatType(registry, definitions, (registry as Registry).lookup.getTypeDef(typeDef.type), imports, withShortcut);
|
||||
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return formatType(registry, definitions, (registry).lookup.getTypeDef(typeDef.type), imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Struct]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
if (typeDef.lookupName) {
|
||||
return typeDef.lookupName;
|
||||
}
|
||||
@@ -208,7 +199,7 @@ const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef
|
||||
}${withShortcut ? ' ' : '\n '}} & Struct`;
|
||||
},
|
||||
|
||||
[TypeDefInfo.Tuple]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
const sub = typeDef.sub as TypeDef[];
|
||||
|
||||
setImports(definitions, imports, ['ITuple', ...sub.map(({ lookupName }) => lookupName)]);
|
||||
@@ -221,11 +212,11 @@ const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef
|
||||
}]`);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Vec]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'Vec', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.VecFixed]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
if (sub.type === 'u8') {
|
||||
@@ -237,31 +228,31 @@ const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef
|
||||
return singleParamNotation(registry, 'Vec', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.BTreeMap]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return dualParamsNotation(registry, 'BTreeMap', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.BTreeSet]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'BTreeSet', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.HashMap]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return dualParamsNotation(registry, 'HashMap', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Linkage]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'Linkage', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.Result]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return dualParamsNotation(registry, 'Result', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.WrapperKeepOpaque]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.WrapperKeepOpaque]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'WrapperKeepOpaque', typeDef, definitions, imports, withShortcut);
|
||||
},
|
||||
|
||||
[TypeDefInfo.WrapperOpaque]: (registry: CodecRegistry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
[TypeDefInfo.WrapperOpaque]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return singleParamNotation(registry, 'WrapperOpaque', typeDef, definitions, imports, withShortcut);
|
||||
}
|
||||
};
|
||||
@@ -271,7 +262,7 @@ const formatters: Record<TypeDefInfo, (registry: CodecRegistry, typeDef: TypeDef
|
||||
*/
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function formatType (registry: CodecRegistry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports, withShortcut = false): string {
|
||||
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports, withShortcut = false): string {
|
||||
let typeDef: TypeDef;
|
||||
|
||||
if (isString(type)) {
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-codec": "7.4.1",
|
||||
"@polkadot/util": "^8.3.2"
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-codec": "7.5.1",
|
||||
"@polkadot/util": "^8.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ export default {
|
||||
CurrentHeadUpdated: 'u32',
|
||||
CodeUpgradeScheduled: 'u32',
|
||||
NewHeadNoted: 'u32',
|
||||
ActionQueued: '(u32,u32)'
|
||||
ActionQueued: '(u32,u32)',
|
||||
PvfCheckStarted: '(H256,u32)',
|
||||
PvfCheckAccepted: '(H256,u32)',
|
||||
PvfCheckRejected: '(H256,u32)'
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -2003,7 +2006,7 @@ export default {
|
||||
* Lookup621: polkadot_runtime_parachains::paras::pallet::Error<T>
|
||||
**/
|
||||
PolkadotRuntimeParachainsParasPalletError: {
|
||||
_enum: ['NotRegistered', 'CannotOnboard', 'CannotOffboard', 'CannotUpgrade', 'CannotDowngrade', 'PvfCheckStatementStale', 'PvfCheckStatementFuture', 'PvfCheckValidatorIndexOutOfBounds', 'PvfCheckInvalidSignature', 'PvfCheckDoubleVote', 'PvfCheckSubjectInvalid']
|
||||
_enum: ['NotRegistered', 'CannotOnboard', 'CannotOffboard', 'CannotUpgrade', 'CannotDowngrade', 'PvfCheckStatementStale', 'PvfCheckStatementFuture', 'PvfCheckValidatorIndexOutOfBounds', 'PvfCheckInvalidSignature', 'PvfCheckDoubleVote', 'PvfCheckSubjectInvalid', 'PvfCheckDisabled']
|
||||
},
|
||||
/**
|
||||
* Lookup623: polkadot_runtime_parachains::initializer::BufferedSessionChange
|
||||
|
||||
@@ -3561,8 +3561,11 @@ export default {
|
||||
setStorage: 'u64',
|
||||
setStoragePerByte: 'u64',
|
||||
clearStorage: 'u64',
|
||||
containsStorage: 'u64',
|
||||
getStorage: 'u64',
|
||||
getStoragePerByte: 'u64',
|
||||
takeStorage: 'u64',
|
||||
takeStoragePerByte: 'u64',
|
||||
transfer: 'u64',
|
||||
call: 'u64',
|
||||
callTransferSurcharge: 'u64',
|
||||
@@ -3586,7 +3589,7 @@ export default {
|
||||
* Lookup424: pallet_contracts::pallet::Error<T>
|
||||
**/
|
||||
PalletContractsError: {
|
||||
_enum: ['InvalidScheduleVersion', 'OutOfGas', 'OutputBufferTooSmall', 'TransferFailed', 'MaxCallDepthReached', 'ContractNotFound', 'CodeTooLarge', 'CodeNotFound', 'OutOfBounds', 'DecodingFailed', 'ContractTrapped', 'ValueTooLarge', 'TerminatedWhileReentrant', 'InputForwarded', 'RandomSubjectTooLong', 'TooManyTopics', 'DuplicateTopics', 'NoChainExtension', 'DeletionQueueFull', 'DuplicateContract', 'TerminatedInConstructor', 'DebugMessageInvalidUTF8', 'ReentranceDenied', 'StorageDepositNotEnoughFunds', 'StorageDepositLimitExhausted', 'CodeInUse', 'ContractReverted']
|
||||
_enum: ['InvalidScheduleVersion', 'OutOfGas', 'OutputBufferTooSmall', 'TransferFailed', 'MaxCallDepthReached', 'ContractNotFound', 'CodeTooLarge', 'CodeNotFound', 'OutOfBounds', 'DecodingFailed', 'ContractTrapped', 'ValueTooLarge', 'TerminatedWhileReentrant', 'InputForwarded', 'RandomSubjectTooLong', 'TooManyTopics', 'DuplicateTopics', 'NoChainExtension', 'DeletionQueueFull', 'DuplicateContract', 'TerminatedInConstructor', 'DebugMessageInvalidUTF8', 'ReentranceDenied', 'StorageDepositNotEnoughFunds', 'StorageDepositLimitExhausted', 'CodeInUse', 'ContractReverted', 'CodeRejected']
|
||||
},
|
||||
/**
|
||||
* Lookup425: pallet_sudo::pallet::Error<T>
|
||||
@@ -3908,20 +3911,20 @@ export default {
|
||||
repeat: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup503: pallet_lottery::pallet::Error<T>
|
||||
* Lookup504: pallet_lottery::pallet::Error<T>
|
||||
**/
|
||||
PalletLotteryError: {
|
||||
_enum: ['NotConfigured', 'InProgress', 'AlreadyEnded', 'InvalidCall', 'AlreadyParticipating', 'TooManyCalls', 'EncodingFailed']
|
||||
},
|
||||
/**
|
||||
* Lookup505: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup506: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletGiltGiltBid: {
|
||||
amount: 'u128',
|
||||
who: 'AccountId32'
|
||||
},
|
||||
/**
|
||||
* Lookup506: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
|
||||
* Lookup507: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
|
||||
**/
|
||||
PalletGiltActiveGiltsTotal: {
|
||||
frozen: 'u128',
|
||||
@@ -3930,7 +3933,7 @@ export default {
|
||||
target: 'Perquintill'
|
||||
},
|
||||
/**
|
||||
* Lookup507: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup508: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletGiltActiveGilt: {
|
||||
proportion: 'Perquintill',
|
||||
@@ -3939,13 +3942,13 @@ export default {
|
||||
expiry: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup508: pallet_gilt::pallet::Error<T>
|
||||
* Lookup509: pallet_gilt::pallet::Error<T>
|
||||
**/
|
||||
PalletGiltError: {
|
||||
_enum: ['DurationTooSmall', 'DurationTooBig', 'AmountTooSmall', 'BidTooLow', 'Unknown', 'NotOwner', 'NotExpired', 'NotFound']
|
||||
},
|
||||
/**
|
||||
* Lookup509: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
* Lookup510: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
**/
|
||||
PalletUniquesClassDetails: {
|
||||
owner: 'AccountId32',
|
||||
@@ -3960,7 +3963,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup511: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
* Lookup512: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
**/
|
||||
PalletUniquesInstanceDetails: {
|
||||
owner: 'AccountId32',
|
||||
@@ -3969,7 +3972,7 @@ export default {
|
||||
deposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup512: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
|
||||
* Lookup513: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
|
||||
**/
|
||||
PalletUniquesClassMetadata: {
|
||||
deposit: 'u128',
|
||||
@@ -3977,7 +3980,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup513: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
|
||||
* Lookup514: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
|
||||
**/
|
||||
PalletUniquesInstanceMetadata: {
|
||||
deposit: 'u128',
|
||||
@@ -3985,13 +3988,13 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup516: pallet_uniques::pallet::Error<T, I>
|
||||
* Lookup517: pallet_uniques::pallet::Error<T, I>
|
||||
**/
|
||||
PalletUniquesError: {
|
||||
_enum: ['NoPermission', 'Unknown', 'AlreadyExists', 'WrongOwner', 'BadWitness', 'InUse', 'Frozen', 'WrongDelegate', 'NoDelegate', 'Unapproved']
|
||||
},
|
||||
/**
|
||||
* Lookup518: pallet_transaction_storage::TransactionInfo
|
||||
* Lookup519: pallet_transaction_storage::TransactionInfo
|
||||
**/
|
||||
PalletTransactionStorageTransactionInfo: {
|
||||
_alias: {
|
||||
@@ -4003,13 +4006,13 @@ export default {
|
||||
blockChunks: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup519: pallet_transaction_storage::pallet::Error<T>
|
||||
* Lookup520: pallet_transaction_storage::pallet::Error<T>
|
||||
**/
|
||||
PalletTransactionStorageError: {
|
||||
_enum: ['InsufficientFunds', 'NotConfigured', 'RenewedNotFound', 'EmptyTransaction', 'UnexpectedProof', 'InvalidProof', 'MissingProof', 'MissingStateData', 'DoubleCheck', 'ProofNotChecked', 'TransactionTooLarge', 'TooManyTransactions', 'BadContext']
|
||||
},
|
||||
/**
|
||||
* Lookup520: pallet_bags_list::list::Node<T>
|
||||
* Lookup521: pallet_bags_list::list::Node<T>
|
||||
**/
|
||||
PalletBagsListListNode: {
|
||||
id: 'AccountId32',
|
||||
@@ -4018,20 +4021,20 @@ export default {
|
||||
bagUpper: 'u64'
|
||||
},
|
||||
/**
|
||||
* Lookup521: pallet_bags_list::list::Bag<T>
|
||||
* Lookup522: pallet_bags_list::list::Bag<T>
|
||||
**/
|
||||
PalletBagsListListBag: {
|
||||
head: 'Option<AccountId32>',
|
||||
tail: 'Option<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup523: pallet_bags_list::pallet::Error<T>
|
||||
* Lookup524: pallet_bags_list::pallet::Error<T>
|
||||
**/
|
||||
PalletBagsListError: {
|
||||
_enum: ['NotInSameBag', 'IdNotFound', 'NotHeavier']
|
||||
},
|
||||
/**
|
||||
* Lookup524: pallet_child_bounties::ChildBounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
* Lookup525: pallet_child_bounties::ChildBounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
**/
|
||||
PalletChildBountiesChildBounty: {
|
||||
parentBounty: 'u32',
|
||||
@@ -4041,7 +4044,7 @@ export default {
|
||||
status: 'PalletChildBountiesChildBountyStatus'
|
||||
},
|
||||
/**
|
||||
* Lookup525: pallet_child_bounties::ChildBountyStatus<sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup526: pallet_child_bounties::ChildBountyStatus<sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletChildBountiesChildBountyStatus: {
|
||||
_enum: {
|
||||
@@ -4060,13 +4063,13 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup527: pallet_child_bounties::pallet::Error<T>
|
||||
* Lookup528: pallet_child_bounties::pallet::Error<T>
|
||||
**/
|
||||
PalletChildBountiesError: {
|
||||
_enum: ['ParentBountyNotActive', 'InsufficientBountyBalance', 'TooManyChildBounties']
|
||||
},
|
||||
/**
|
||||
* Lookup529: sp_runtime::MultiSignature
|
||||
* Lookup530: sp_runtime::MultiSignature
|
||||
**/
|
||||
SpRuntimeMultiSignature: {
|
||||
_enum: {
|
||||
@@ -4076,42 +4079,42 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup530: sp_core::ecdsa::Signature
|
||||
* Lookup531: sp_core::ecdsa::Signature
|
||||
**/
|
||||
SpCoreEcdsaSignature: '[u8;65]',
|
||||
/**
|
||||
* Lookup533: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<T>
|
||||
* Lookup534: frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckNonZeroSender: 'Null',
|
||||
/**
|
||||
* Lookup534: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
|
||||
* Lookup535: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckSpecVersion: 'Null',
|
||||
/**
|
||||
* Lookup535: frame_system::extensions::check_tx_version::CheckTxVersion<T>
|
||||
* Lookup536: frame_system::extensions::check_tx_version::CheckTxVersion<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckTxVersion: 'Null',
|
||||
/**
|
||||
* Lookup536: frame_system::extensions::check_genesis::CheckGenesis<T>
|
||||
* Lookup537: frame_system::extensions::check_genesis::CheckGenesis<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckGenesis: 'Null',
|
||||
/**
|
||||
* Lookup539: frame_system::extensions::check_nonce::CheckNonce<T>
|
||||
* Lookup540: frame_system::extensions::check_nonce::CheckNonce<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckNonce: 'Compact<u32>',
|
||||
/**
|
||||
* Lookup540: frame_system::extensions::check_weight::CheckWeight<T>
|
||||
* Lookup541: frame_system::extensions::check_weight::CheckWeight<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckWeight: 'Null',
|
||||
/**
|
||||
* Lookup541: pallet_asset_tx_payment::ChargeAssetTxPayment<T>
|
||||
* Lookup542: pallet_asset_tx_payment::ChargeAssetTxPayment<T>
|
||||
**/
|
||||
PalletAssetTxPaymentChargeAssetTxPayment: {
|
||||
tip: 'Compact<u128>',
|
||||
assetId: 'Option<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup542: node_runtime::Runtime
|
||||
* Lookup543: node_runtime::Runtime
|
||||
**/
|
||||
NodeRuntimeRuntime: 'Null'
|
||||
};
|
||||
|
||||
@@ -74,7 +74,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asNewHeadNoted: u32;
|
||||
readonly isActionQueued: boolean;
|
||||
readonly asActionQueued: ITuple<[u32, u32]>;
|
||||
readonly type: 'CurrentCodeUpdated' | 'CurrentHeadUpdated' | 'CodeUpgradeScheduled' | 'NewHeadNoted' | 'ActionQueued';
|
||||
readonly isPvfCheckStarted: boolean;
|
||||
readonly asPvfCheckStarted: ITuple<[H256, u32]>;
|
||||
readonly isPvfCheckAccepted: boolean;
|
||||
readonly asPvfCheckAccepted: ITuple<[H256, u32]>;
|
||||
readonly isPvfCheckRejected: boolean;
|
||||
readonly asPvfCheckRejected: ITuple<[H256, u32]>;
|
||||
readonly type: 'CurrentCodeUpdated' | 'CurrentHeadUpdated' | 'CodeUpgradeScheduled' | 'NewHeadNoted' | 'ActionQueued' | 'PvfCheckStarted' | 'PvfCheckAccepted' | 'PvfCheckRejected';
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsUmpPalletEvent (96) */
|
||||
@@ -1981,7 +1987,8 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isPvfCheckInvalidSignature: boolean;
|
||||
readonly isPvfCheckDoubleVote: boolean;
|
||||
readonly isPvfCheckSubjectInvalid: boolean;
|
||||
readonly type: 'NotRegistered' | 'CannotOnboard' | 'CannotOffboard' | 'CannotUpgrade' | 'CannotDowngrade' | 'PvfCheckStatementStale' | 'PvfCheckStatementFuture' | 'PvfCheckValidatorIndexOutOfBounds' | 'PvfCheckInvalidSignature' | 'PvfCheckDoubleVote' | 'PvfCheckSubjectInvalid';
|
||||
readonly isPvfCheckDisabled: boolean;
|
||||
readonly type: 'NotRegistered' | 'CannotOnboard' | 'CannotOffboard' | 'CannotUpgrade' | 'CannotDowngrade' | 'PvfCheckStatementStale' | 'PvfCheckStatementFuture' | 'PvfCheckValidatorIndexOutOfBounds' | 'PvfCheckInvalidSignature' | 'PvfCheckDoubleVote' | 'PvfCheckSubjectInvalid' | 'PvfCheckDisabled';
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (623) */
|
||||
|
||||
@@ -3889,8 +3889,11 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly setStorage: u64;
|
||||
readonly setStoragePerByte: u64;
|
||||
readonly clearStorage: u64;
|
||||
readonly containsStorage: u64;
|
||||
readonly getStorage: u64;
|
||||
readonly getStoragePerByte: u64;
|
||||
readonly takeStorage: u64;
|
||||
readonly takeStoragePerByte: u64;
|
||||
readonly transfer: u64;
|
||||
readonly call: u64;
|
||||
readonly callTransferSurcharge: u64;
|
||||
@@ -3940,7 +3943,8 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isStorageDepositLimitExhausted: boolean;
|
||||
readonly isCodeInUse: boolean;
|
||||
readonly isContractReverted: boolean;
|
||||
readonly type: 'InvalidScheduleVersion' | 'OutOfGas' | 'OutputBufferTooSmall' | 'TransferFailed' | 'MaxCallDepthReached' | 'ContractNotFound' | 'CodeTooLarge' | 'CodeNotFound' | 'OutOfBounds' | 'DecodingFailed' | 'ContractTrapped' | 'ValueTooLarge' | 'TerminatedWhileReentrant' | 'InputForwarded' | 'RandomSubjectTooLong' | 'TooManyTopics' | 'DuplicateTopics' | 'NoChainExtension' | 'DeletionQueueFull' | 'DuplicateContract' | 'TerminatedInConstructor' | 'DebugMessageInvalidUTF8' | 'ReentranceDenied' | 'StorageDepositNotEnoughFunds' | 'StorageDepositLimitExhausted' | 'CodeInUse' | 'ContractReverted';
|
||||
readonly isCodeRejected: boolean;
|
||||
readonly type: 'InvalidScheduleVersion' | 'OutOfGas' | 'OutputBufferTooSmall' | 'TransferFailed' | 'MaxCallDepthReached' | 'ContractNotFound' | 'CodeTooLarge' | 'CodeNotFound' | 'OutOfBounds' | 'DecodingFailed' | 'ContractTrapped' | 'ValueTooLarge' | 'TerminatedWhileReentrant' | 'InputForwarded' | 'RandomSubjectTooLong' | 'TooManyTopics' | 'DuplicateTopics' | 'NoChainExtension' | 'DeletionQueueFull' | 'DuplicateContract' | 'TerminatedInConstructor' | 'DebugMessageInvalidUTF8' | 'ReentranceDenied' | 'StorageDepositNotEnoughFunds' | 'StorageDepositLimitExhausted' | 'CodeInUse' | 'ContractReverted' | 'CodeRejected';
|
||||
}
|
||||
|
||||
/** @name PalletSudoError (425) */
|
||||
@@ -4358,7 +4362,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly repeat: bool;
|
||||
}
|
||||
|
||||
/** @name PalletLotteryError (503) */
|
||||
/** @name PalletLotteryError (504) */
|
||||
export interface PalletLotteryError extends Enum {
|
||||
readonly isNotConfigured: boolean;
|
||||
readonly isInProgress: boolean;
|
||||
@@ -4370,13 +4374,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'NotConfigured' | 'InProgress' | 'AlreadyEnded' | 'InvalidCall' | 'AlreadyParticipating' | 'TooManyCalls' | 'EncodingFailed';
|
||||
}
|
||||
|
||||
/** @name PalletGiltGiltBid (505) */
|
||||
/** @name PalletGiltGiltBid (506) */
|
||||
export interface PalletGiltGiltBid extends Struct {
|
||||
readonly amount: u128;
|
||||
readonly who: AccountId32;
|
||||
}
|
||||
|
||||
/** @name PalletGiltActiveGiltsTotal (506) */
|
||||
/** @name PalletGiltActiveGiltsTotal (507) */
|
||||
export interface PalletGiltActiveGiltsTotal extends Struct {
|
||||
readonly frozen: u128;
|
||||
readonly proportion: Perquintill;
|
||||
@@ -4384,7 +4388,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly target: Perquintill;
|
||||
}
|
||||
|
||||
/** @name PalletGiltActiveGilt (507) */
|
||||
/** @name PalletGiltActiveGilt (508) */
|
||||
export interface PalletGiltActiveGilt extends Struct {
|
||||
readonly proportion: Perquintill;
|
||||
readonly amount: u128;
|
||||
@@ -4392,7 +4396,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly expiry: u32;
|
||||
}
|
||||
|
||||
/** @name PalletGiltError (508) */
|
||||
/** @name PalletGiltError (509) */
|
||||
export interface PalletGiltError extends Enum {
|
||||
readonly isDurationTooSmall: boolean;
|
||||
readonly isDurationTooBig: boolean;
|
||||
@@ -4405,7 +4409,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'DurationTooSmall' | 'DurationTooBig' | 'AmountTooSmall' | 'BidTooLow' | 'Unknown' | 'NotOwner' | 'NotExpired' | 'NotFound';
|
||||
}
|
||||
|
||||
/** @name PalletUniquesClassDetails (509) */
|
||||
/** @name PalletUniquesClassDetails (510) */
|
||||
export interface PalletUniquesClassDetails extends Struct {
|
||||
readonly owner: AccountId32;
|
||||
readonly issuer: AccountId32;
|
||||
@@ -4419,7 +4423,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesInstanceDetails (511) */
|
||||
/** @name PalletUniquesInstanceDetails (512) */
|
||||
export interface PalletUniquesInstanceDetails extends Struct {
|
||||
readonly owner: AccountId32;
|
||||
readonly approved: Option<AccountId32>;
|
||||
@@ -4427,21 +4431,21 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly deposit: u128;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesClassMetadata (512) */
|
||||
/** @name PalletUniquesClassMetadata (513) */
|
||||
export interface PalletUniquesClassMetadata extends Struct {
|
||||
readonly deposit: u128;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesInstanceMetadata (513) */
|
||||
/** @name PalletUniquesInstanceMetadata (514) */
|
||||
export interface PalletUniquesInstanceMetadata extends Struct {
|
||||
readonly deposit: u128;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesError (516) */
|
||||
/** @name PalletUniquesError (517) */
|
||||
export interface PalletUniquesError extends Enum {
|
||||
readonly isNoPermission: boolean;
|
||||
readonly isUnknown: boolean;
|
||||
@@ -4456,7 +4460,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'NoPermission' | 'Unknown' | 'AlreadyExists' | 'WrongOwner' | 'BadWitness' | 'InUse' | 'Frozen' | 'WrongDelegate' | 'NoDelegate' | 'Unapproved';
|
||||
}
|
||||
|
||||
/** @name PalletTransactionStorageTransactionInfo (518) */
|
||||
/** @name PalletTransactionStorageTransactionInfo (519) */
|
||||
export interface PalletTransactionStorageTransactionInfo extends Struct {
|
||||
readonly chunkRoot: H256;
|
||||
readonly contentHash: H256;
|
||||
@@ -4464,7 +4468,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly blockChunks: u32;
|
||||
}
|
||||
|
||||
/** @name PalletTransactionStorageError (519) */
|
||||
/** @name PalletTransactionStorageError (520) */
|
||||
export interface PalletTransactionStorageError extends Enum {
|
||||
readonly isInsufficientFunds: boolean;
|
||||
readonly isNotConfigured: boolean;
|
||||
@@ -4482,7 +4486,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'InsufficientFunds' | 'NotConfigured' | 'RenewedNotFound' | 'EmptyTransaction' | 'UnexpectedProof' | 'InvalidProof' | 'MissingProof' | 'MissingStateData' | 'DoubleCheck' | 'ProofNotChecked' | 'TransactionTooLarge' | 'TooManyTransactions' | 'BadContext';
|
||||
}
|
||||
|
||||
/** @name PalletBagsListListNode (520) */
|
||||
/** @name PalletBagsListListNode (521) */
|
||||
export interface PalletBagsListListNode extends Struct {
|
||||
readonly id: AccountId32;
|
||||
readonly prev: Option<AccountId32>;
|
||||
@@ -4490,13 +4494,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly bagUpper: u64;
|
||||
}
|
||||
|
||||
/** @name PalletBagsListListBag (521) */
|
||||
/** @name PalletBagsListListBag (522) */
|
||||
export interface PalletBagsListListBag extends Struct {
|
||||
readonly head: Option<AccountId32>;
|
||||
readonly tail: Option<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name PalletBagsListError (523) */
|
||||
/** @name PalletBagsListError (524) */
|
||||
export interface PalletBagsListError extends Enum {
|
||||
readonly isNotInSameBag: boolean;
|
||||
readonly isIdNotFound: boolean;
|
||||
@@ -4504,7 +4508,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'NotInSameBag' | 'IdNotFound' | 'NotHeavier';
|
||||
}
|
||||
|
||||
/** @name PalletChildBountiesChildBounty (524) */
|
||||
/** @name PalletChildBountiesChildBounty (525) */
|
||||
export interface PalletChildBountiesChildBounty extends Struct {
|
||||
readonly parentBounty: u32;
|
||||
readonly value: u128;
|
||||
@@ -4513,7 +4517,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly status: PalletChildBountiesChildBountyStatus;
|
||||
}
|
||||
|
||||
/** @name PalletChildBountiesChildBountyStatus (525) */
|
||||
/** @name PalletChildBountiesChildBountyStatus (526) */
|
||||
export interface PalletChildBountiesChildBountyStatus extends Enum {
|
||||
readonly isAdded: boolean;
|
||||
readonly isCuratorProposed: boolean;
|
||||
@@ -4533,7 +4537,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'Added' | 'CuratorProposed' | 'Active' | 'PendingPayout';
|
||||
}
|
||||
|
||||
/** @name PalletChildBountiesError (527) */
|
||||
/** @name PalletChildBountiesError (528) */
|
||||
export interface PalletChildBountiesError extends Enum {
|
||||
readonly isParentBountyNotActive: boolean;
|
||||
readonly isInsufficientBountyBalance: boolean;
|
||||
@@ -4541,7 +4545,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'ParentBountyNotActive' | 'InsufficientBountyBalance' | 'TooManyChildBounties';
|
||||
}
|
||||
|
||||
/** @name SpRuntimeMultiSignature (529) */
|
||||
/** @name SpRuntimeMultiSignature (530) */
|
||||
export interface SpRuntimeMultiSignature extends Enum {
|
||||
readonly isEd25519: boolean;
|
||||
readonly asEd25519: SpCoreEd25519Signature;
|
||||
@@ -4552,34 +4556,34 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly type: 'Ed25519' | 'Sr25519' | 'Ecdsa';
|
||||
}
|
||||
|
||||
/** @name SpCoreEcdsaSignature (530) */
|
||||
/** @name SpCoreEcdsaSignature (531) */
|
||||
export interface SpCoreEcdsaSignature extends U8aFixed {}
|
||||
|
||||
/** @name FrameSystemExtensionsCheckNonZeroSender (533) */
|
||||
/** @name FrameSystemExtensionsCheckNonZeroSender (534) */
|
||||
export type FrameSystemExtensionsCheckNonZeroSender = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckSpecVersion (534) */
|
||||
/** @name FrameSystemExtensionsCheckSpecVersion (535) */
|
||||
export type FrameSystemExtensionsCheckSpecVersion = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckTxVersion (535) */
|
||||
/** @name FrameSystemExtensionsCheckTxVersion (536) */
|
||||
export type FrameSystemExtensionsCheckTxVersion = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckGenesis (536) */
|
||||
/** @name FrameSystemExtensionsCheckGenesis (537) */
|
||||
export type FrameSystemExtensionsCheckGenesis = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckNonce (539) */
|
||||
/** @name FrameSystemExtensionsCheckNonce (540) */
|
||||
export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
|
||||
|
||||
/** @name FrameSystemExtensionsCheckWeight (540) */
|
||||
/** @name FrameSystemExtensionsCheckWeight (541) */
|
||||
export type FrameSystemExtensionsCheckWeight = Null;
|
||||
|
||||
/** @name PalletAssetTxPaymentChargeAssetTxPayment (541) */
|
||||
/** @name PalletAssetTxPaymentChargeAssetTxPayment (542) */
|
||||
export interface PalletAssetTxPaymentChargeAssetTxPayment extends Struct {
|
||||
readonly tip: Compact<u128>;
|
||||
readonly assetId: Option<u32>;
|
||||
}
|
||||
|
||||
/** @name NodeRuntimeRuntime (542) */
|
||||
/** @name NodeRuntimeRuntime (543) */
|
||||
export type NodeRuntimeRuntime = Null;
|
||||
|
||||
} // declare module
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '7.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '7.5.1' };
|
||||
|
||||
@@ -18,7 +18,7 @@ import type { StatementKind } from '@polkadot/types/interfaces/claims';
|
||||
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
||||
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||
import type { AliveContractInfo, CodeHash, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
||||
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV2, ContractContractSpecV0, ContractContractSpecV2, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
|
||||
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
|
||||
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
|
||||
import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
|
||||
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
|
||||
@@ -216,9 +216,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
ContractCallRequest: ContractCallRequest;
|
||||
ContractConstructorSpecLatest: ContractConstructorSpecLatest;
|
||||
ContractConstructorSpecV0: ContractConstructorSpecV0;
|
||||
ContractConstructorSpecV1: ContractConstructorSpecV1;
|
||||
ContractConstructorSpecV2: ContractConstructorSpecV2;
|
||||
ContractConstructorSpecV3: ContractConstructorSpecV3;
|
||||
ContractContractSpecV0: ContractContractSpecV0;
|
||||
ContractContractSpecV1: ContractContractSpecV1;
|
||||
ContractContractSpecV2: ContractContractSpecV2;
|
||||
ContractContractSpecV3: ContractContractSpecV3;
|
||||
ContractCryptoHasher: ContractCryptoHasher;
|
||||
ContractDiscriminant: ContractDiscriminant;
|
||||
ContractDisplayName: ContractDisplayName;
|
||||
@@ -227,6 +231,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ContractEventParamSpecV2: ContractEventParamSpecV2;
|
||||
ContractEventSpecLatest: ContractEventSpecLatest;
|
||||
ContractEventSpecV0: ContractEventSpecV0;
|
||||
ContractEventSpecV1: ContractEventSpecV1;
|
||||
ContractEventSpecV2: ContractEventSpecV2;
|
||||
ContractExecResult: ContractExecResult;
|
||||
ContractExecResultErr: ContractExecResultErr;
|
||||
@@ -254,12 +259,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
ContractMessageParamSpecV2: ContractMessageParamSpecV2;
|
||||
ContractMessageSpecLatest: ContractMessageSpecLatest;
|
||||
ContractMessageSpecV0: ContractMessageSpecV0;
|
||||
ContractMessageSpecV1: ContractMessageSpecV1;
|
||||
ContractMessageSpecV2: ContractMessageSpecV2;
|
||||
ContractMetadata: ContractMetadata;
|
||||
ContractMetadataLatest: ContractMetadataLatest;
|
||||
ContractMetadataV0: ContractMetadataV0;
|
||||
ContractMetadataV1: ContractMetadataV1;
|
||||
ContractMetadataV2: ContractMetadataV2;
|
||||
ContractMetadataV3: ContractMetadataV3;
|
||||
ContractProject: ContractProject;
|
||||
ContractProjectContract: ContractProjectContract;
|
||||
ContractProjectInfo: ContractProjectInfo;
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.4.1",
|
||||
"version": "7.5.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@polkadot/util": "^8.3.2"
|
||||
"@polkadot/util": "^8.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types": "7.4.1",
|
||||
"@polkadot/types-augment": "7.4.1",
|
||||
"@polkadot/types-support": "7.4.1",
|
||||
"@polkadot/util-crypto": "^8.3.2"
|
||||
"@polkadot/types": "7.5.1",
|
||||
"@polkadot/types-augment": "7.5.1",
|
||||
"@polkadot/types-support": "7.5.1",
|
||||
"@polkadot/util-crypto": "^8.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecRegistry, IU8a, IVec } from '../types';
|
||||
import type { AnyJson, Codec, IU8a, IVec, Registry } from '../types';
|
||||
|
||||
import { compactToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
@@ -16,13 +16,13 @@ import { compareArray } from '../utils/compareArray';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export abstract class AbstractArray<T extends Codec> extends Array<T> implements IVec<T> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
readonly initialU8aLength?: number;
|
||||
|
||||
protected constructor (registry: CodecRegistry, values: T[], initialU8aLength?: number) {
|
||||
protected constructor (registry: Registry, values: T[], initialU8aLength?: number) {
|
||||
super(values.length);
|
||||
|
||||
// explicitly set the values here - this removes the need for any extra allocations
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyNumber, CodecRegistry, INumber, IU8a, UIntBitLength } from '../types';
|
||||
import type { AnyNumber, INumber, IU8a, Registry, UIntBitLength } from '../types';
|
||||
|
||||
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isNumber, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
@@ -47,7 +47,7 @@ function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegati
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export abstract class AbstractInt extends BN implements INumber {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -57,7 +57,7 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
|
||||
readonly #isSigned: boolean;
|
||||
|
||||
constructor (registry: CodecRegistry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
|
||||
constructor (registry: Registry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
|
||||
// Construct via a string, which will be passed in the BN constructor.
|
||||
// It would be ideal to actually return a BN, but there is an issue:
|
||||
// https://github.com/indutny/bn.js/issues/206
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, BareOpts, Codec, CodecRegistry, IU8a } from '../types';
|
||||
import type { AnyJson, BareOpts, Codec, IU8a, Registry } from '../types';
|
||||
|
||||
/**
|
||||
* @name Base
|
||||
* @description A type extends the Base class, when it holds a value
|
||||
*/
|
||||
export abstract class Base<T extends Codec> implements Codec {
|
||||
readonly #registry: CodecRegistry;
|
||||
readonly #registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -17,7 +17,7 @@ export abstract class Base<T extends Codec> implements Codec {
|
||||
|
||||
readonly #raw: T;
|
||||
|
||||
protected constructor (registry: CodecRegistry, value: T, initialU8aLength?: number) {
|
||||
protected constructor (registry: Registry, value: T, initialU8aLength?: number) {
|
||||
this.#registry = registry;
|
||||
this.#raw = value;
|
||||
this.initialU8aLength = initialU8aLength;
|
||||
@@ -48,7 +48,7 @@ export abstract class Base<T extends Codec> implements Codec {
|
||||
return this.#raw.isEmpty;
|
||||
}
|
||||
|
||||
public get registry (): CodecRegistry {
|
||||
public get registry (): Registry {
|
||||
return this.#registry;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, AnyNumber, CodecClass, CodecRegistry, ICompact, INumber, IU8a } from '../types';
|
||||
import type { AnyJson, AnyNumber, CodecClass, ICompact, INumber, IU8a, Registry } from '../types';
|
||||
|
||||
import { compactFromU8a, compactToU8a, isBigInt, isBn, isNumber, isString } from '@polkadot/util';
|
||||
|
||||
@@ -18,7 +18,7 @@ import { typeToConstructor } from '../utils';
|
||||
* a number and making the compact representation thereof
|
||||
*/
|
||||
export class Compact<T extends INumber> implements ICompact<T> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -28,7 +28,7 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
|
||||
readonly #raw: T;
|
||||
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value: Compact<T> | AnyNumber = 0) {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, value: Compact<T> | AnyNumber = 0) {
|
||||
this.registry = registry;
|
||||
this.#Type = typeToConstructor(registry, Type);
|
||||
|
||||
@@ -40,14 +40,14 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
|
||||
public static with<T extends INumber> (Type: CodecClass<T> | string): CodecClass<Compact<T>> {
|
||||
return class extends Compact<T> {
|
||||
constructor (registry: CodecRegistry, value?: Compact<T> | AnyNumber) {
|
||||
constructor (registry: Registry, value?: Compact<T> | AnyNumber) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static decodeCompact<T extends INumber> (registry: CodecRegistry, Type: CodecClass<T>, value: Compact<T> | AnyNumber): [T, number] {
|
||||
public static decodeCompact<T extends INumber> (registry: Registry, Type: CodecClass<T>, value: Compact<T> | AnyNumber): [T, number] {
|
||||
if (value instanceof Compact) {
|
||||
return [new Type(registry, value.#raw), 0];
|
||||
} else if (value instanceof Type) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecClass, CodecRegistry, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, CodecClass, IU8a, Registry } from '../types';
|
||||
|
||||
/**
|
||||
* @name DoNotConstruct
|
||||
@@ -10,13 +10,13 @@ import type { AnyJson, Codec, CodecClass, CodecRegistry, IU8a } from '../types';
|
||||
* An unknown type that fails on construction with the type info
|
||||
*/
|
||||
export class DoNotConstruct implements Codec {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
#neverError: Error;
|
||||
|
||||
constructor (registry: CodecRegistry, typeName = 'DoNotConstruct') {
|
||||
constructor (registry: Registry, typeName = 'DoNotConstruct') {
|
||||
this.registry = registry;
|
||||
this.#neverError = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
|
||||
|
||||
@@ -25,7 +25,7 @@ export class DoNotConstruct implements Codec {
|
||||
|
||||
public static with (typeName?: string): CodecClass {
|
||||
return class extends DoNotConstruct {
|
||||
constructor (registry: CodecRegistry) {
|
||||
constructor (registry: Registry) {
|
||||
super(registry, typeName);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { CodecRegistry } from '@polkadot/types-codec/types';
|
||||
import type { Registry } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Enum, Null, Text, U32 } from '@polkadot/types-codec';
|
||||
@@ -129,7 +129,7 @@ describe('Enum', (): void => {
|
||||
class B extends Null { }
|
||||
class C extends Null { }
|
||||
class Test extends Enum {
|
||||
constructor (registry: CodecRegistry, value?: string, index?: number) {
|
||||
constructor (registry: Registry, value?: string, index?: number) {
|
||||
super(registry, {
|
||||
a: A,
|
||||
b: B,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecClass, CodecRegistry, IEnum, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, CodecClass, IEnum, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, isHex, isNumber, isObject, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringPascalCase, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Null } from './Null';
|
||||
|
||||
// export interface, this is used in Enum.with, so required as public by TS
|
||||
export interface EnumCodecClass<T = Codec> {
|
||||
new(registry: CodecRegistry, value?: any, index?: number): T;
|
||||
new(registry: Registry, value?: any, index?: number): T;
|
||||
}
|
||||
|
||||
interface EntryDef {
|
||||
@@ -38,7 +38,7 @@ function isRustEnum (def: Record<string, string | CodecClass> | Record<string, n
|
||||
return true;
|
||||
}
|
||||
|
||||
function extractDef (registry: CodecRegistry, _def: Record<string, string | CodecClass> | Record<string, number> | string[]): { def: TypesDef; isBasic: boolean; isIndexed: boolean } {
|
||||
function extractDef (registry: Registry, _def: Record<string, string | CodecClass> | Record<string, number> | string[]): { def: TypesDef; isBasic: boolean; isIndexed: boolean } {
|
||||
const def: TypesDef = {};
|
||||
let isBasic: boolean;
|
||||
let isIndexed: boolean;
|
||||
@@ -81,7 +81,7 @@ function extractDef (registry: CodecRegistry, _def: Record<string, string | Code
|
||||
};
|
||||
}
|
||||
|
||||
function createFromValue (registry: CodecRegistry, def: TypesDef, index = 0, value?: unknown): Decoded {
|
||||
function createFromValue (registry: Registry, def: TypesDef, index = 0, value?: unknown): Decoded {
|
||||
const entry = Object.values(def).find((e) => e.index === index);
|
||||
|
||||
assert(!isUndefined(entry), () => `Unable to create Enum via index ${index}, in ${Object.keys(def).join(', ')}`);
|
||||
@@ -94,7 +94,7 @@ function createFromValue (registry: CodecRegistry, def: TypesDef, index = 0, val
|
||||
};
|
||||
}
|
||||
|
||||
function decodeFromJSON (registry: CodecRegistry, def: TypesDef, key: string, value?: unknown): Decoded {
|
||||
function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?: unknown): Decoded {
|
||||
// JSON comes in the form of { "<type (camelCase)>": "<value for type>" }, here we
|
||||
// additionally force to lower to ensure forward compat
|
||||
const keys = Object.keys(def).map((k) => k.toLowerCase());
|
||||
@@ -110,7 +110,7 @@ function decodeFromJSON (registry: CodecRegistry, def: TypesDef, key: string, va
|
||||
}
|
||||
}
|
||||
|
||||
function decodeEnum (registry: CodecRegistry, def: TypesDef, value?: unknown, index?: number): Decoded {
|
||||
function decodeEnum (registry: Registry, def: TypesDef, value?: unknown, index?: number): Decoded {
|
||||
// NOTE We check the index path first, before looking at values - this allows treating
|
||||
// the optional indexes before anything else, more-specific > less-specific
|
||||
if (isNumber(index)) {
|
||||
@@ -145,7 +145,7 @@ function decodeEnum (registry: CodecRegistry, def: TypesDef, value?: unknown, in
|
||||
* an extension to enum where the value type is determined by the actual index.
|
||||
*/
|
||||
export class Enum implements IEnum {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -163,7 +163,7 @@ export class Enum implements IEnum {
|
||||
|
||||
readonly #raw: Codec;
|
||||
|
||||
constructor (registry: CodecRegistry, Types: Record<string, string | CodecClass> | Record<string, number> | string[], value?: unknown, index?: number) {
|
||||
constructor (registry: Registry, Types: Record<string, string | CodecClass> | Record<string, number> | string[], value?: unknown, index?: number) {
|
||||
const { def, isBasic, isIndexed } = extractDef(registry, Types);
|
||||
|
||||
// shortcut isU8a as used in SCALE decoding
|
||||
@@ -199,7 +199,7 @@ export class Enum implements IEnum {
|
||||
}
|
||||
|
||||
return class extends Enum {
|
||||
constructor (registry: CodecRegistry, value?: unknown, index?: number) {
|
||||
constructor (registry: Registry, value?: unknown, index?: number) {
|
||||
super(registry, Types, value, index);
|
||||
|
||||
objectProperties(this, isKeys, (_, i) => this.type === keys[i]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyNumber, CodecClass, CodecRegistry, UIntBitLength } from '../types';
|
||||
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types';
|
||||
|
||||
import { AbstractInt } from '../abstract/AbstractInt';
|
||||
|
||||
@@ -16,13 +16,13 @@ import { AbstractInt } from '../abstract/AbstractInt';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export class Int extends AbstractInt {
|
||||
constructor (registry: CodecRegistry, value: AnyNumber = 0, bitLength?: UIntBitLength) {
|
||||
constructor (registry: Registry, value: AnyNumber = 0, bitLength?: UIntBitLength) {
|
||||
super(registry, value, bitLength, true);
|
||||
}
|
||||
|
||||
public static with (bitLength: UIntBitLength, typeName?: string): CodecClass<Int> {
|
||||
return class extends Int {
|
||||
constructor (registry: CodecRegistry, value?: AnyNumber) {
|
||||
constructor (registry: Registry, value?: AnyNumber) {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, CodecRegistry, IU8a } from '../types';
|
||||
import type { Codec, IU8a, Registry } from '../types';
|
||||
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
@@ -12,14 +12,14 @@ import { isNull } from '@polkadot/util';
|
||||
* Implements a type that does not contain anything (apart from `null`)
|
||||
*/
|
||||
export class Null implements Codec {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
// Added for compatibility reasons, e.g. see Option
|
||||
public readonly initialU8aLength = 0;
|
||||
|
||||
constructor (registry: CodecRegistry) {
|
||||
constructor (registry: Registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecClass, CodecRegistry, IOption, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, CodecClass, IOption, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, isCodec, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { typeToConstructor } from '../utils';
|
||||
import { Null } from './Null';
|
||||
|
||||
/** @internal */
|
||||
function decodeOption (registry: CodecRegistry, Type: CodecClass, value?: unknown): Codec {
|
||||
function decodeOption (registry: Registry, Type: CodecClass, value?: unknown): Codec {
|
||||
// In the case of an option, unwrap the inner
|
||||
if (value instanceof Option) {
|
||||
value = value.value;
|
||||
@@ -41,7 +41,7 @@ function decodeOption (registry: CodecRegistry, Type: CodecClass, value?: unknow
|
||||
* with a value if/as required/found.
|
||||
*/
|
||||
export class Option<T extends Codec> implements IOption<T> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -51,7 +51,7 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
|
||||
readonly #raw: T;
|
||||
|
||||
constructor (registry: CodecRegistry, typeName: CodecClass<T> | string, value?: unknown) {
|
||||
constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown) {
|
||||
const Type = typeToConstructor(registry, typeName);
|
||||
const decoded = isU8a(value) && value.length && !isCodec(value)
|
||||
? value[0] === 0
|
||||
@@ -70,7 +70,7 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: CodecClass<O> | string): CodecClass<Option<O>> {
|
||||
return class extends Option<O> {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec, CodecClass, CodecRegistry, IResult } from '../types';
|
||||
import type { Codec, CodecClass, IResult, Registry } from '../types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Enum } from './Enum';
|
||||
* A Result maps to the Rust Result type, that can either wrap a success or error value
|
||||
*/
|
||||
export class Result<O extends Codec, E extends Codec> extends Enum implements IResult<O, E> {
|
||||
constructor (registry: CodecRegistry, Ok: CodecClass<O> | string, Err: CodecClass<E> | string, value?: unknown) {
|
||||
constructor (registry: Registry, Ok: CodecClass<O> | string, Err: CodecClass<E> | string, value?: unknown) {
|
||||
// NOTE This is order-dependent, Ok (with index 0) needs to be first
|
||||
// eslint-disable-next-line sort-keys
|
||||
super(registry, { Ok, Err }, value);
|
||||
@@ -21,7 +21,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum implements IR
|
||||
|
||||
public static override with<O extends Codec, E extends Codec> (Types: { Ok: CodecClass<O> | string; Err: CodecClass<E> | string }): CodecClass<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types.Ok, Types.Err, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyTupleValue, Codec, CodecClass, CodecRegistry, ITuple } from '../types';
|
||||
import type { AnyTupleValue, Codec, CodecClass, ITuple, Registry } from '../types';
|
||||
|
||||
import { isFunction, isHex, isString, isU8a, stringify, u8aConcat, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -19,7 +19,7 @@ type TupleTypes = TupleType[] | {
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function decodeTuple (registry: CodecRegistry, Classes: TupleCodecClasss, value?: AnyTupleValue): [Codec[], number] {
|
||||
function decodeTuple (registry: Registry, Classes: TupleCodecClasss, value?: AnyTupleValue): [Codec[], number] {
|
||||
if (isU8a(value) || isHex(value)) {
|
||||
return decodeU8a(registry, u8aToU8a(value), Classes);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ function decodeTuple (registry: CodecRegistry, Classes: TupleCodecClasss, value?
|
||||
export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
#Types: TupleCodecClasss;
|
||||
|
||||
constructor (registry: CodecRegistry, Types: TupleTypes | TupleType, value?: AnyTupleValue) {
|
||||
constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue) {
|
||||
const Classes = Array.isArray(Types)
|
||||
? Types.map((t) => typeToConstructor(registry, t))
|
||||
: isFunction(Types) || isString(Types)
|
||||
@@ -72,7 +72,7 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
|
||||
public static with (Types: TupleTypes | TupleType): CodecClass<Tuple> {
|
||||
return class extends Tuple {
|
||||
constructor (registry: CodecRegistry, value?: AnyTupleValue) {
|
||||
constructor (registry: Registry, value?: AnyTupleValue) {
|
||||
super(registry, Types, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyNumber, CodecClass, CodecRegistry, UIntBitLength } from '../types';
|
||||
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types';
|
||||
|
||||
import { AbstractInt } from '../abstract/AbstractInt';
|
||||
|
||||
@@ -18,7 +18,7 @@ import { AbstractInt } from '../abstract/AbstractInt';
|
||||
export class UInt extends AbstractInt {
|
||||
public static with (bitLength: UIntBitLength, typeName?: string): CodecClass<UInt> {
|
||||
return class extends UInt {
|
||||
constructor (registry: CodecRegistry, value?: AnyNumber) {
|
||||
constructor (registry: Registry, value?: AnyNumber) {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { assert, compactFromU8a, logger, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -13,7 +13,7 @@ const MAX_LENGTH = 64 * 1024;
|
||||
|
||||
const l = logger('Vec');
|
||||
|
||||
export function decodeVec<T extends Codec> (registry: CodecRegistry, Type: CodecClass<T>, value: Uint8Array | HexString | unknown[], length = -1): [T[], number, number] {
|
||||
export function decodeVec<T extends Codec> (registry: Registry, Type: CodecClass<T>, value: Uint8Array | HexString | unknown[], length = -1): [T[], number, number] {
|
||||
if (Array.isArray(value)) {
|
||||
const result = new Array<T>(value.length);
|
||||
|
||||
@@ -59,7 +59,7 @@ export function decodeVec<T extends Codec> (registry: CodecRegistry, Type: Codec
|
||||
export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
#Type: CodecClass<T>;
|
||||
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value: Uint8Array | HexString | unknown[] = []) {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, value: Uint8Array | HexString | unknown[] = []) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
const [values, decodedLength] = decodeVec(registry, Clazz, value);
|
||||
|
||||
@@ -70,7 +70,7 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: CodecClass<O> | string): CodecClass<Vec<O>> {
|
||||
return class extends Vec<O> {
|
||||
constructor (registry: CodecRegistry, value?: any[]) {
|
||||
constructor (registry: Registry, value?: any[]) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { assert, isU8a, u8aConcat } from '@polkadot/util';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { decodeU8aVec, typeToConstructor } from '../utils';
|
||||
import { decodeVec } from './Vec';
|
||||
|
||||
/** @internal */
|
||||
function decodeVecFixed<T extends Codec> (registry: CodecRegistry, value: Uint8Array | HexString | unknown[], Type: CodecClass<T>, length: number): [T[], number, number] {
|
||||
function decodeVecFixed<T extends Codec> (registry: Registry, value: Uint8Array | HexString | unknown[], Type: CodecClass<T>, length: number): [T[], number, number] {
|
||||
const [values, decodedLength, decodedLengthNoOffset] = decodeVec(registry, Type, value, length);
|
||||
|
||||
while (values.length < length) {
|
||||
@@ -31,7 +31,7 @@ function decodeVecFixed<T extends Codec> (registry: CodecRegistry, value: Uint8A
|
||||
export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
#Type: CodecClass<T>;
|
||||
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, length: number, value: Uint8Array | HexString | unknown[] = [] as unknown[]) {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, length: number, value: Uint8Array | HexString | unknown[] = [] as unknown[]) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
const [values,, decodedLengthNoOffset] = isU8a(value)
|
||||
? decodeU8aVec(registry, value, 0, Clazz, length)
|
||||
@@ -44,7 +44,7 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: CodecClass<O> | string, length: number): CodecClass<VecFixed<O>> {
|
||||
return class extends VecFixed<O> {
|
||||
constructor (registry: CodecRegistry, value?: any[]) {
|
||||
constructor (registry: Registry, value?: any[]) {
|
||||
super(registry, Type, length, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { CodecMap } from './Map';
|
||||
|
||||
export class BTreeMap<K extends Codec = Codec, V extends Codec = Codec> extends CodecMap<K, V> {
|
||||
public static with<K extends Codec, V extends Codec> (keyType: CodecClass<K> | string, valType: CodecClass<V> | string): CodecClass<CodecMap<K, V>> {
|
||||
return class extends BTreeMap<K, V> {
|
||||
constructor (registry: CodecRegistry, value?: Uint8Array | string | Map<any, any>) {
|
||||
constructor (registry: Registry, value?: Uint8Array | string | Map<any, any>) {
|
||||
super(registry, keyType, valType, value, 'BTreeMap');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecClass, CodecRegistry, ISet, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, CodecClass, ISet, IU8a, Registry } from '../types';
|
||||
|
||||
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from '../utils';
|
||||
const l = logger('BTreeSet');
|
||||
|
||||
/** @internal */
|
||||
function decodeSetFromU8a<V extends Codec> (registry: CodecRegistry, ValClass: CodecClass<V>, u8a: Uint8Array): [Set<V>, number] {
|
||||
function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: CodecClass<V>, u8a: Uint8Array): [Set<V>, number] {
|
||||
const output = new Set<V>();
|
||||
const [offset, length] = compactFromU8a(u8a);
|
||||
const [values, decodedLength] = decodeU8aVec(registry, u8a, offset, ValClass, length.toNumber());
|
||||
@@ -24,7 +24,7 @@ function decodeSetFromU8a<V extends Codec> (registry: CodecRegistry, ValClass: C
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeSetFromSet<V extends Codec> (registry: CodecRegistry, ValClass: CodecClass<V>, value: Set<any> | string[]): [Set<V>, number] {
|
||||
function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: CodecClass<V>, value: Set<any> | string[]): [Set<V>, number] {
|
||||
const output = new Set<V>();
|
||||
|
||||
value.forEach((val: any) => {
|
||||
@@ -54,7 +54,7 @@ function decodeSetFromSet<V extends Codec> (registry: CodecRegistry, ValClass: C
|
||||
* @param jsonSet
|
||||
* @internal
|
||||
*/
|
||||
function decodeSet<V extends Codec> (registry: CodecRegistry, valType: CodecClass<V> | string, value?: Uint8Array | string | string[] | Set<any>): [Set<V>, number] {
|
||||
function decodeSet<V extends Codec> (registry: Registry, valType: CodecClass<V> | string, value?: Uint8Array | string | string[] | Set<any>): [Set<V>, number] {
|
||||
if (!value) {
|
||||
return [new Set<V>(), 0];
|
||||
}
|
||||
@@ -71,7 +71,7 @@ function decodeSet<V extends Codec> (registry: CodecRegistry, valType: CodecClas
|
||||
}
|
||||
|
||||
export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -79,7 +79,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
|
||||
readonly #ValClass: CodecClass<V>;
|
||||
|
||||
constructor (registry: CodecRegistry, valType: CodecClass<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
||||
constructor (registry: Registry, valType: CodecClass<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
||||
const [values, decodedLength] = decodeSet(registry, valType, rawValue);
|
||||
|
||||
super(sortSet(values));
|
||||
@@ -91,7 +91,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
|
||||
public static with<V extends Codec> (valType: CodecClass<V> | string): CodecClass<BTreeSet<V>> {
|
||||
return class extends BTreeSet<V> {
|
||||
constructor (registry: CodecRegistry, value?: Uint8Array | string | Set<any>) {
|
||||
constructor (registry: Registry, value?: Uint8Array | string | Set<any>) {
|
||||
super(registry, valType, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyU8a, CodecRegistry } from '../types';
|
||||
import type { AnyU8a, Registry } from '../types';
|
||||
|
||||
import { assert, compactFromU8a, compactToU8a, isString, u8aConcat, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -42,7 +42,7 @@ function decodeBitVec (value?: AnyU8a): [number, Uint8Array] {
|
||||
export class BitVec extends Raw {
|
||||
readonly #decodedLength: number;
|
||||
|
||||
constructor (registry: CodecRegistry, value?: AnyU8a) {
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
const [decodedLength, u8a] = decodeBitVec(value);
|
||||
|
||||
super(registry, u8a);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyU8a, CodecRegistry } from '../types';
|
||||
import type { AnyU8a, Registry } from '../types';
|
||||
|
||||
import { assert, compactAddLength, compactFromU8a, compactToU8a, isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -47,7 +47,7 @@ function decodeBytes (value?: AnyU8a): [Uint8Array | undefined, number] {
|
||||
* as what is found in [[Text]] and [[Vec]])
|
||||
*/
|
||||
export class Bytes extends Raw {
|
||||
constructor (registry: CodecRegistry, value?: AnyU8a) {
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
const [u8a, decodedLength] = decodeBytes(value);
|
||||
|
||||
super(registry, u8a, decodedLength);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { CodecMap } from './Map';
|
||||
|
||||
export class HashMap<K extends Codec = Codec, V extends Codec = Codec> extends CodecMap<K, V> {
|
||||
public static with<K extends Codec, V extends Codec> (keyType: CodecClass<K> | string, valType: CodecClass<V> | string): CodecClass<CodecMap<K, V>> {
|
||||
return class extends HashMap<K, V> {
|
||||
constructor (registry: CodecRegistry, value?: Uint8Array | string | Map<any, any>) {
|
||||
constructor (registry: Registry, value?: Uint8Array | string | Map<any, any>) {
|
||||
super(registry, keyType, valType, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { Option } from '../base/Option';
|
||||
import { Tuple } from '../base/Tuple';
|
||||
@@ -18,7 +18,7 @@ const EMPTY = new Uint8Array();
|
||||
* @description The wrapper for the result from a LinkedMap
|
||||
*/
|
||||
export class Linkage<T extends Codec> extends Struct {
|
||||
constructor (registry: CodecRegistry, Type: CodecClass | string, value?: unknown) {
|
||||
constructor (registry: Registry, Type: CodecClass | string, value?: unknown) {
|
||||
super(registry, {
|
||||
previous: Option.with(Type),
|
||||
// eslint-disable-next-line sort-keys
|
||||
@@ -28,7 +28,7 @@ export class Linkage<T extends Codec> extends Struct {
|
||||
|
||||
public static withKey<O extends Codec> (Type: CodecClass | string): CodecClass<Linkage<O>> {
|
||||
return class extends Linkage<O> {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
@@ -66,7 +66,7 @@ export class Linkage<T extends Codec> extends Struct {
|
||||
* @description A Linkage keys/Values tuple
|
||||
*/
|
||||
export class LinkageResult extends Tuple {
|
||||
constructor (registry: CodecRegistry, [TypeKey, keys]: TypeWithValues, [TypeValue, values]: TypeWithValues) {
|
||||
constructor (registry: Registry, [TypeKey, keys]: TypeWithValues, [TypeValue, values]: TypeWithValues) {
|
||||
super(registry, {
|
||||
Keys: Vec.with(TypeKey),
|
||||
Values: Vec.with(TypeValue)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecClass, CodecRegistry, IMap, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, CodecClass, IMap, IU8a, Registry } from '../types';
|
||||
|
||||
import { compactFromU8a, compactToU8a, isHex, isObject, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -14,7 +14,7 @@ import { compareMap, decodeU8a, sortMap, typeToConstructor } from '../utils';
|
||||
const l = logger('Map');
|
||||
|
||||
/** @internal */
|
||||
function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: CodecRegistry, KeyClass: CodecClass<K>, ValClass: CodecClass<V>, u8a: Uint8Array): [Map<K, V>, number] {
|
||||
function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry, KeyClass: CodecClass<K>, ValClass: CodecClass<V>, u8a: Uint8Array): [Map<K, V>, number] {
|
||||
const output = new Map<K, V>();
|
||||
const [offset, length] = compactFromU8a(u8a);
|
||||
const count = length.toNumber();
|
||||
@@ -34,7 +34,7 @@ function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: CodecRegi
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: CodecRegistry, KeyClass: CodecClass<K>, ValClass: CodecClass<V>, value: Map<any, any>): [Map<K, V>, number] {
|
||||
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: CodecClass<K>, ValClass: CodecClass<V>, value: Map<any, any>): [Map<K, V>, number] {
|
||||
const output = new Map<K, V>();
|
||||
|
||||
for (const [key, val] of value.entries()) {
|
||||
@@ -76,7 +76,7 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: CodecRegi
|
||||
* @param jsonMap
|
||||
* @internal
|
||||
*/
|
||||
function decodeMap<K extends Codec, V extends Codec> (registry: CodecRegistry, keyType: CodecClass<K> | string, valType: CodecClass<V> | string, value?: Uint8Array | string | Map<any, any>): [Map<K, V>, number] {
|
||||
function decodeMap<K extends Codec, V extends Codec> (registry: Registry, keyType: CodecClass<K> | string, valType: CodecClass<V> | string, value?: Uint8Array | string | Map<any, any>): [Map<K, V>, number] {
|
||||
const KeyClass = typeToConstructor(registry, keyType);
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
@@ -94,7 +94,7 @@ function decodeMap<K extends Codec, V extends Codec> (registry: CodecRegistry, k
|
||||
}
|
||||
|
||||
export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V> implements IMap<K, V> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -106,7 +106,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
|
||||
readonly #type: string;
|
||||
|
||||
constructor (registry: CodecRegistry, keyType: CodecClass<K> | string, valType: CodecClass<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') {
|
||||
constructor (registry: Registry, keyType: CodecClass<K> | string, valType: CodecClass<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') {
|
||||
const [decoded, decodedLength] = decodeMap(registry, keyType, valType, rawValue);
|
||||
|
||||
super(type === 'BTreeMap' ? sortMap(decoded) : decoded);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyTuple, CodecClass, CodecRegistry, INumber } from '../types';
|
||||
import type { AnyTuple, CodecClass, INumber, Registry } from '../types';
|
||||
|
||||
import { Tuple } from '../base/Tuple';
|
||||
|
||||
@@ -15,7 +15,7 @@ type RangeType = 'Range' | 'RangeInclusive';
|
||||
export class Range<T extends INumber> extends Tuple {
|
||||
#rangeName: RangeType;
|
||||
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value?: AnyTuple, rangeName: RangeType = 'Range') {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple, rangeName: RangeType = 'Range') {
|
||||
super(registry, {
|
||||
end: Type,
|
||||
start: Type
|
||||
@@ -26,7 +26,7 @@ export class Range<T extends INumber> extends Tuple {
|
||||
|
||||
public static override with <T extends INumber> (Types: CodecClass<T> | string): CodecClass<Range<T>> {
|
||||
return class extends Range<T> {
|
||||
constructor (registry: CodecRegistry, value?: AnyTuple) {
|
||||
constructor (registry: Registry, value?: AnyTuple) {
|
||||
super(registry, Types, value);
|
||||
}
|
||||
};
|
||||
@@ -55,13 +55,13 @@ export class Range<T extends INumber> extends Tuple {
|
||||
}
|
||||
|
||||
export class RangeInclusive<T extends INumber = INumber> extends Range<T> {
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value?: AnyTuple) {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple) {
|
||||
super(registry, Type, value, 'RangeInclusive');
|
||||
}
|
||||
|
||||
public static override with <T extends INumber> (Type: CodecClass<T> | string): CodecClass<RangeInclusive<T>> {
|
||||
return class extends RangeInclusive<T> {
|
||||
constructor (registry: CodecRegistry, value?: AnyTuple) {
|
||||
constructor (registry: Registry, value?: AnyTuple) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { CodecRegistry } from '../types';
|
||||
import type { Registry } from '../types';
|
||||
|
||||
import { Text } from '../native/Text';
|
||||
import { sanitize } from '../utils';
|
||||
@@ -14,7 +14,7 @@ import { sanitize } from '../utils';
|
||||
* i.e. we remove the `T::` prefixes found in some types for consistency across implementation.
|
||||
*/
|
||||
export class Type extends Text {
|
||||
constructor (registry: CodecRegistry, value: Text | Uint8Array | string = '') {
|
||||
constructor (registry: Registry, value: Text | Uint8Array | string = '') {
|
||||
super(registry, value);
|
||||
|
||||
this.setOverride(sanitize(this.toString()));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyU8a, CodecClass, CodecRegistry, U8aBitLength } from '../types';
|
||||
import type { AnyU8a, CodecClass, Registry, U8aBitLength } from '../types';
|
||||
|
||||
import { assert, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -28,7 +28,7 @@ function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, numbe
|
||||
* to be used directly, rather is should be subclassed with the specific lengths.
|
||||
*/
|
||||
export class U8aFixed extends Raw {
|
||||
constructor (registry: CodecRegistry, value: AnyU8a = new Uint8Array(), bitLength: U8aBitLength = 256) {
|
||||
constructor (registry: Registry, value: AnyU8a = new Uint8Array(), bitLength: U8aBitLength = 256) {
|
||||
const [u8a, decodedLength] = decodeU8aFixed(value, bitLength);
|
||||
|
||||
super(registry, u8a, decodedLength);
|
||||
@@ -36,7 +36,7 @@ export class U8aFixed extends Raw {
|
||||
|
||||
public static with (bitLength: U8aBitLength, typeName?: string): CodecClass<U8aFixed> {
|
||||
return class extends U8aFixed {
|
||||
constructor (registry: CodecRegistry, value?: AnyU8a) {
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyJson, AnyU8a, Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { AnyJson, AnyU8a, Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { assertReturn, compactStripLength, isHex, isU8a } from '@polkadot/util';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Raw } from '../native/Raw';
|
||||
import { typeToConstructor } from '../utils';
|
||||
import { Bytes } from './Bytes';
|
||||
|
||||
function decodeRaw<T extends Codec> (registry: CodecRegistry, typeName: CodecClass<T> | string, value?: AnyU8a | Codec): [CodecClass<T>, T | null, AnyU8a] {
|
||||
function decodeRaw<T extends Codec> (registry: Registry, typeName: CodecClass<T> | string, value?: AnyU8a | Codec): [CodecClass<T>, T | null, AnyU8a] {
|
||||
const Type = typeToConstructor(registry, typeName);
|
||||
|
||||
if (isU8a(value) || isHex(value)) {
|
||||
@@ -34,7 +34,7 @@ export class WrapperKeepOpaque<T extends Codec> extends Bytes {
|
||||
|
||||
readonly #decoded: T | null;
|
||||
|
||||
constructor (registry: CodecRegistry, typeName: CodecClass<T> | string, value?: AnyU8a | Codec) {
|
||||
constructor (registry: Registry, typeName: CodecClass<T> | string, value?: AnyU8a | Codec) {
|
||||
const [Type, decoded, u8a] = decodeRaw(registry, typeName, value);
|
||||
|
||||
super(registry, u8a);
|
||||
@@ -45,7 +45,7 @@ export class WrapperKeepOpaque<T extends Codec> extends Bytes {
|
||||
|
||||
public static with<T extends Codec> (Type: CodecClass<T> | string): CodecClass<WrapperKeepOpaque<T>> {
|
||||
return class extends WrapperKeepOpaque<T> {
|
||||
constructor (registry: CodecRegistry, value?: AnyU8a | T) {
|
||||
constructor (registry: Registry, value?: AnyU8a | T) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
||||
import type { Codec, CodecClass, Registry } from '../types';
|
||||
|
||||
import { compactAddLength, compactStripLength, isU8a } from '@polkadot/util';
|
||||
|
||||
import { Base } from '../base/Base';
|
||||
import { typeToConstructor } from '../utils';
|
||||
|
||||
function decodeRaw<T extends Codec> (registry: CodecRegistry, Type: CodecClass<T> | string, value?: unknown): T {
|
||||
function decodeRaw<T extends Codec> (registry: Registry, Type: CodecClass<T> | string, value?: unknown): T {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
|
||||
if (isU8a(value)) {
|
||||
@@ -21,13 +21,13 @@ function decodeRaw<T extends Codec> (registry: CodecRegistry, Type: CodecClass<T
|
||||
}
|
||||
|
||||
export class WrapperOpaque<T extends Codec> extends Base<T> {
|
||||
constructor (registry: CodecRegistry, Type: CodecClass<T> | string, value?: unknown) {
|
||||
constructor (registry: Registry, Type: CodecClass<T> | string, value?: unknown) {
|
||||
super(registry, decodeRaw(registry, Type, value));
|
||||
}
|
||||
|
||||
public static with<T extends Codec> (Type: CodecClass<T> | string): CodecClass<WrapperOpaque<T>> {
|
||||
return class extends WrapperOpaque<T> {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, CodecRegistry, IU8a } from '../types';
|
||||
import type { Codec, IU8a, Registry } from '../types';
|
||||
|
||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||
|
||||
@@ -24,12 +24,12 @@ function decodeBool (value: any): boolean {
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export class bool extends Boolean implements Codec {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
constructor (registry: CodecRegistry, value: bool | Boolean | Uint8Array | boolean | number = false) {
|
||||
constructor (registry: Registry, value: bool | Boolean | Uint8Array | boolean | number = false) {
|
||||
super(decodeBool(value));
|
||||
|
||||
this.registry = registry;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyNumber, CodecRegistry, INumber, IU8a, UIntBitLength } from '../types';
|
||||
import type { AnyNumber, INumber, IU8a, Registry, UIntBitLength } from '../types';
|
||||
|
||||
import { BN, bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
@@ -33,11 +33,11 @@ function decodeDate (value: CodecDate | Date | AnyNumber): Date {
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export class CodecDate extends Date implements INumber {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
constructor (registry: CodecRegistry, value: CodecDate | Date | AnyNumber = 0) {
|
||||
constructor (registry: Registry, value: CodecDate | Date | AnyNumber = 0) {
|
||||
super(decodeDate(value));
|
||||
|
||||
this.registry = registry;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, Codec, CodecRegistry, IU8a } from '../types';
|
||||
import type { AnyJson, Codec, IU8a, Registry } from '../types';
|
||||
|
||||
import { isFunction, objectProperties, stringify } from '@polkadot/util';
|
||||
|
||||
@@ -22,11 +22,11 @@ function decodeJson (value?: Record<string, unknown> | null): [string, any][] {
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export class Json extends Map<string, any> implements Codec {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
constructor (registry: CodecRegistry, value?: Record<string, unknown> | null) {
|
||||
constructor (registry: Registry, value?: Record<string, unknown> | null) {
|
||||
const decoded = decodeJson(value);
|
||||
|
||||
super(decoded);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, AnyU8a, CodecRegistry, IU8a } from '../types';
|
||||
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -16,13 +16,13 @@ import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a }
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export class Raw extends Uint8Array implements IU8a {
|
||||
readonly registry: CodecRegistry;
|
||||
readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
readonly initialU8aLength?: number;
|
||||
|
||||
constructor (registry: CodecRegistry, value?: AnyU8a, initialU8aLength?: number) {
|
||||
constructor (registry: Registry, value?: AnyU8a, initialU8aLength?: number) {
|
||||
super(u8aToU8a(value));
|
||||
|
||||
this.registry = registry;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecClass, CodecRegistry, ISet, IU8a } from '../types';
|
||||
import type { CodecClass, ISet, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, objectProperties, stringify, stringPascalCase, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -86,7 +86,7 @@ function decodeSet (setValues: SetValues, value: string[] | Set<string> | Uint8A
|
||||
* a bitwise representation of the values.
|
||||
*/
|
||||
export class CodecSet extends Set<string> implements ISet<string> {
|
||||
public readonly registry: CodecRegistry;
|
||||
public readonly registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -94,7 +94,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
|
||||
|
||||
readonly #byteLength: number;
|
||||
|
||||
constructor (registry: CodecRegistry, setValues: SetValues, value?: string[] | Set<string> | Uint8Array | BN | number | string, bitLength = 8) {
|
||||
constructor (registry: Registry, setValues: SetValues, value?: string[] | Set<string> | Uint8Array | BN | number | string, bitLength = 8) {
|
||||
super(decodeSet(setValues, value, bitLength));
|
||||
|
||||
this.registry = registry;
|
||||
@@ -111,7 +111,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
|
||||
}
|
||||
|
||||
return class extends CodecSet {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, values, value as undefined, bitLength);
|
||||
|
||||
objectProperties(this, isKeys, (_, i) => this.strings.includes(keys[i]));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { AnyJson, BareOpts, Codec, CodecClass, CodecClassDef, CodecRegistry, IStruct, IU8a } from '../types';
|
||||
import type { AnyJson, BareOpts, Codec, CodecClass, CodecClassDef, IStruct, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { compareMap, decodeU8a, mapToTypeMap, typesToMap } from '../utils';
|
||||
type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
|
||||
|
||||
/** @internal */
|
||||
function decodeStructFromObject (registry: CodecRegistry, Types: CodecClassDef, value: any, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
|
||||
function decodeStructFromObject (registry: Registry, Types: CodecClassDef, value: any, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
|
||||
let jsonObj: Record<string, unknown> | undefined;
|
||||
const inputKeys = Object.keys(Types);
|
||||
const typeofArray = Array.isArray(value);
|
||||
@@ -90,7 +90,7 @@ export class Struct<
|
||||
V extends { [K in keyof S]: any } = { [K in keyof S]: any },
|
||||
// type names, mapped by key, name of Class in S
|
||||
E extends { [K in keyof S]: string } = { [K in keyof S]: string }> extends Map<keyof S, Codec> implements IStruct<keyof S> {
|
||||
#registry: CodecRegistry;
|
||||
#registry: Registry;
|
||||
|
||||
public createdAtHash?: IU8a;
|
||||
|
||||
@@ -100,7 +100,7 @@ export class Struct<
|
||||
|
||||
readonly #Types: CodecClassDef;
|
||||
|
||||
constructor (registry: CodecRegistry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) {
|
||||
constructor (registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) {
|
||||
const typeMap = mapToTypeMap(registry, Types);
|
||||
const [decoded, decodedLength] = isU8a(value)
|
||||
? decodeU8a<Codec, [string, Codec]>(registry, value, typeMap, true)
|
||||
@@ -122,7 +122,7 @@ export class Struct<
|
||||
const keys = Object.keys(Types);
|
||||
|
||||
return class extends Struct<S> {
|
||||
constructor (registry: CodecRegistry, value?: unknown) {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types, value as HexString, jsonMap);
|
||||
|
||||
objectProperties(this, keys, (k) => this.get(k));
|
||||
@@ -190,7 +190,7 @@ export class Struct<
|
||||
return this.registry.hash(this.toU8a());
|
||||
}
|
||||
|
||||
public get registry (): CodecRegistry {
|
||||
public get registry (): Registry {
|
||||
return this.#registry;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user