Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f07c0628bc | ||
|
|
023c7588e5 | ||
|
|
7dfc8625cc | ||
|
|
8643b5da87 | ||
|
|
afa0e63ae8 | ||
|
|
534303ff45 | ||
|
|
f1ebcddec6 | ||
|
|
657a2006dd | ||
|
|
219e928c01 | ||
|
|
43183118d5 | ||
|
|
76e15d465d | ||
|
|
4c0387e1a3 | ||
|
|
bbbd82eb4a | ||
|
|
a34a7450aa | ||
|
|
bf472fdcf4 |
@@ -1,5 +1,14 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.22.1 Jun 29, 2020
|
||||
|
||||
- **Important** Substrate changed the tip structure, only older chains supply `OpenTip: 'OpenTipTo225'` if using tips
|
||||
- Allow for `[u8; 33]` in U8aFixed (Thanks to https://github.com/akru)
|
||||
- Improve derive accountId -> accountIndex lookups (optimize entries queries)
|
||||
- Vesting balance calculations via `derive.balances.all` has been updated for locks
|
||||
- Add derive for multi staking rewards with specified eras
|
||||
- `@polkadot/util` 2.16
|
||||
|
||||
## 1.21.1 Jun 23, 2020
|
||||
|
||||
- Fix subscriptions never unsubscribing after the id swap in 1.18.1 (Thanks to https://github.com/dillu24 for testing iterations)
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "1.21.1"
|
||||
"version": "1.22.1"
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,12 +27,12 @@
|
||||
"@babel/core": "^7.10.3",
|
||||
"@babel/register": "^7.10.3",
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/dev": "^0.55.12",
|
||||
"@polkadot/dev": "^0.55.14",
|
||||
"@polkadot/ts": "^0.3.26",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest": "^26.0.3",
|
||||
"@vuepress/plugin-search": "^1.5.2",
|
||||
"copyfiles": "^2.3.0"
|
||||
},
|
||||
"version": "1.21.1"
|
||||
"version": "1.22.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,10 +27,10 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/api": "1.21.1",
|
||||
"@polkadot/rpc-core": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/api": "1.22.1",
|
||||
"@polkadot/rpc-core": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"bn.js": "^5.1.2",
|
||||
"rxjs": "^6.5.5"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -28,17 +28,17 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/api": "1.21.1",
|
||||
"@polkadot/rpc-core": "1.21.1",
|
||||
"@polkadot/rpc-provider": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/util-crypto": "^2.15.1",
|
||||
"@polkadot/api": "1.22.1",
|
||||
"@polkadot/rpc-core": "1.22.1",
|
||||
"@polkadot/rpc-provider": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"@polkadot/util-crypto": "^2.16.1",
|
||||
"bn.js": "^5.1.2",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1"
|
||||
"@polkadot/keyring": "^2.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import { memo } from '../util';
|
||||
|
||||
const enumsetSize = ENUMSET_SIZE.toNumber();
|
||||
|
||||
let indicesCache: AccountIndexes | null = null;
|
||||
|
||||
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
|
||||
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
|
||||
// use the nextEnumSet (which is a counter of the number of sets) to construct
|
||||
@@ -72,11 +74,20 @@ function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
|
||||
*/
|
||||
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
|
||||
return memo((): Observable<AccountIndexes> =>
|
||||
(api.query.indices
|
||||
? isFunction(api.query.indices.accounts)
|
||||
? queryAccounts(api)
|
||||
: queryEnumSet(api)
|
||||
: of({} as AccountIndexes)
|
||||
).pipe(startWith({}))
|
||||
indicesCache
|
||||
? of(indicesCache)
|
||||
: (
|
||||
api.query.indices
|
||||
? isFunction(api.query.indices.accounts)
|
||||
? queryAccounts(api).pipe(startWith({}))
|
||||
: queryEnumSet(api).pipe(startWith({}))
|
||||
: of({} as AccountIndexes)
|
||||
).pipe(
|
||||
map((indices): AccountIndexes => {
|
||||
indicesCache = indices;
|
||||
|
||||
return indices;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,15 +20,17 @@ type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
|
||||
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DeriveBalancesAll {
|
||||
let lockedBalance = api.registry.createType('Balance');
|
||||
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
|
||||
let vestingLocked = api.registry.createType('Balance');
|
||||
let allLocked = false;
|
||||
|
||||
if (Array.isArray(locks)) {
|
||||
// only get the locks that are valid until passed the current block
|
||||
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
|
||||
|
||||
const notAll = lockedBreakdown.filter(({ amount }): boolean => !amount.isMax());
|
||||
const notAll = lockedBreakdown.filter(({ amount }) => !amount.isMax());
|
||||
|
||||
allLocked = lockedBreakdown.some(({ amount }): boolean => amount.isMax());
|
||||
allLocked = lockedBreakdown.some(({ amount }) => amount.isMax());
|
||||
vestingLocked = api.registry.createType('Balance', lockedBreakdown.filter(({ id }) => id.eq('0x76657374696e6720')).reduce((result: BN, { amount }) => result.iadd(amount), new BN(0)));
|
||||
|
||||
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
|
||||
if (notAll.length) {
|
||||
@@ -41,19 +43,11 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
|
||||
// - perBlock is the unlock amount
|
||||
const { locked: vestingTotal, perBlock, startingBlock } = vesting || api.registry.createType('VestingInfo');
|
||||
const isStarted = bestNumber.gt(startingBlock);
|
||||
const vestedBalance = api.registry.createType('Balance', isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : 0);
|
||||
const isVesting = isStarted && vestedBalance.lt(vestingTotal);
|
||||
|
||||
// The available balance & vested has an interplay here
|
||||
// "
|
||||
// vesting is a guarantee that the account's balance will never go below a certain amount. so it functions in the opposite way, a bit like a lock that is monotonically decreasing rather than a liquid amount that is monotonically increasing.
|
||||
// locks function as the same guarantee - that a balance will not be lower than a particular amount.
|
||||
// because of this you can see that if there is a "vesting lock" that guarantees the balance cannot go below 200, and a "staking lock" that guarantees the balance cannot drop below 300, then we just have two guarantees of which the first is irrelevant.
|
||||
// i.e. (balance >= 200 && balance >= 300) == (balance >= 300)
|
||||
// ""
|
||||
const floating = freeBalance.sub(lockedBalance);
|
||||
const extraReceived = isVesting ? freeBalance.sub(vestingTotal) : new BN(0);
|
||||
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), isVesting && floating.gt(vestedBalance) ? vestedBalance.add(extraReceived) : floating));
|
||||
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
||||
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
||||
const isVesting = isStarted && !vestingLocked.isZero();
|
||||
const vestedClaimable = api.registry.createType('Balance', isVesting ? vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
|
||||
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), freeBalance.sub(lockedBalance)));
|
||||
|
||||
return {
|
||||
accountId,
|
||||
@@ -67,6 +61,8 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
|
||||
lockedBreakdown,
|
||||
reservedBalance,
|
||||
vestedBalance,
|
||||
vestedClaimable,
|
||||
vestingLocked,
|
||||
vestingTotal,
|
||||
votingBalance
|
||||
};
|
||||
|
||||
@@ -12,8 +12,8 @@ import { Option, u32 } from '@polkadot/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export function erasHistoric (api: ApiInterfaceRx): (withActive?: boolean) => Observable<EraIndex[]> {
|
||||
return memo((withActive?: boolean): Observable<EraIndex[]> =>
|
||||
export function erasHistoric (api: ApiInterfaceRx): (withActive: boolean) => Observable<EraIndex[]> {
|
||||
return memo((withActive: boolean): Observable<EraIndex[]> =>
|
||||
api.query.staking?.activeEra
|
||||
? api.queryMulti<[Option<ActiveEraInfo>, u32]>([
|
||||
api.query.staking.activeEra,
|
||||
|
||||
@@ -199,14 +199,18 @@ export function stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | st
|
||||
);
|
||||
}
|
||||
|
||||
export function stakerRewardsMulti (api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerReward[][]> {
|
||||
return memo((accountIds: (Uint8Array | string)[], withActive = false): Observable<DeriveStakerReward[][]> =>
|
||||
accountIds.length
|
||||
? api.derive.staking.erasHistoric(withActive).pipe(
|
||||
switchMap((eras) =>
|
||||
combineLatest(accountIds.map((acc) => api.derive.staking._stakerRewards(acc, eras, withActive)))
|
||||
)
|
||||
)
|
||||
export function stakerRewardsMultiEras (api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[]) => Observable<DeriveStakerReward[][]> {
|
||||
return memo((accountIds: (Uint8Array | string)[], eras: EraIndex[]): Observable<DeriveStakerReward[][]> =>
|
||||
accountIds.length && eras.length
|
||||
? combineLatest(accountIds.map((acc) => api.derive.staking._stakerRewards(acc, eras, false)))
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
|
||||
export function stakerRewardsMulti (api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerReward[][]> {
|
||||
return memo((accountIds: (Uint8Array | string)[], withActive = false): Observable<DeriveStakerReward[][]> =>
|
||||
api.derive.staking.erasHistoric(withActive).pipe(
|
||||
switchMap((eras) => api.derive.staking.stakerRewardsMultiEras(accountIds, eras))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ export interface DeriveBalancesAll extends DeriveBalancesAccount {
|
||||
availableBalance: Balance;
|
||||
votingBalance: Balance;
|
||||
vestedBalance: Balance;
|
||||
vestedClaimable: Balance;
|
||||
vestingLocked: Balance;
|
||||
vestingTotal: Balance;
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,20 +27,20 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/api-derive": "1.21.1",
|
||||
"@polkadot/keyring": "^2.15.1",
|
||||
"@polkadot/metadata": "1.21.1",
|
||||
"@polkadot/rpc-core": "1.21.1",
|
||||
"@polkadot/rpc-provider": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/types-known": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/util-crypto": "^2.15.1",
|
||||
"@polkadot/api-derive": "1.22.1",
|
||||
"@polkadot/keyring": "^2.16.1",
|
||||
"@polkadot/metadata": "1.22.1",
|
||||
"@polkadot/rpc-core": "1.22.1",
|
||||
"@polkadot/rpc-provider": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/types-known": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"@polkadot/util-crypto": "^2.16.1",
|
||||
"bn.js": "^5.1.2",
|
||||
"eventemitter3": "^4.0.4",
|
||||
"rxjs": "^6.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1"
|
||||
"@polkadot/keyring": "^2.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/metadata",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Helpers to extract information from runtime metadata",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
@@ -27,13 +27,13 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/types-known": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/util-crypto": "^2.15.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/types-known": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"@polkadot/util-crypto": "^2.16.1",
|
||||
"bn.js": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1"
|
||||
"@polkadot/keyring": "^2.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,14 +27,14 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/metadata": "1.21.1",
|
||||
"@polkadot/rpc-provider": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/metadata": "1.22.1",
|
||||
"@polkadot/rpc-provider": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1"
|
||||
"@polkadot/keyring": "^2.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,17 +27,17 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/metadata": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/util-crypto": "^2.15.1",
|
||||
"@polkadot/metadata": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"@polkadot/util-crypto": "^2.16.1",
|
||||
"bn.js": "^5.1.2",
|
||||
"eventemitter3": "^4.0.4",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1",
|
||||
"@polkadot/keyring": "^2.16.1",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^12.0.3"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
@@ -36,11 +36,11 @@
|
||||
"@babel/core": "^7.10.3",
|
||||
"@babel/register": "^7.10.3",
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/api": "1.21.1",
|
||||
"@polkadot/metadata": "1.21.1",
|
||||
"@polkadot/rpc-provider": "1.21.1",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/api": "1.22.1",
|
||||
"@polkadot/metadata": "1.22.1",
|
||||
"@polkadot/rpc-provider": "1.22.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"handlebars": "^4.7.6",
|
||||
"websocket": "^1.0.31",
|
||||
"yargs": "^15.3.1"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,8 +27,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/types": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/types": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"bn.js": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
import { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
// 1020 is first CC3
|
||||
@@ -16,6 +22,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
SlashingSpans: 'SlashingSpansTo204',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
@@ -32,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
SlashingSpans: 'SlashingSpansTo204',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
@@ -49,6 +57,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
Votes: 'VotesTo230',
|
||||
@@ -59,11 +68,10 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1046, 1054],
|
||||
types: {
|
||||
// Indices optional, not in transaction
|
||||
Address: 'AccountId',
|
||||
...sharedTypes,
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
StakingLedger: 'StakingLedgerTo240',
|
||||
Weight: 'u32'
|
||||
@@ -72,11 +80,10 @@ const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1055, 1056],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
...sharedTypes,
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
StakingLedger: 'StakingLedgerTo240',
|
||||
Weight: 'u32'
|
||||
}
|
||||
@@ -84,18 +91,22 @@ const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1057, 1061],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
...sharedTypes,
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
OpenTip: 'OpenTipTo225'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [1062, undefined],
|
||||
minmax: [1062, 2012],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
...sharedTypes,
|
||||
OpenTip: 'OpenTipTo225'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [2013, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -4,25 +4,28 @@
|
||||
|
||||
import { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
|
||||
}
|
||||
};
|
||||
|
||||
// these are override types for Polkadot
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 3],
|
||||
minmax: [0, 12],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
...sharedTypes,
|
||||
OpenTip: 'OpenTipTo225'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [4, undefined],
|
||||
minmax: [13, undefined],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
|
||||
}
|
||||
...sharedTypes
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -4,34 +4,36 @@
|
||||
|
||||
import { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
|
||||
}
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1, 2],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
...sharedTypes,
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
Weight: 'u32'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [3, 19],
|
||||
minmax: [3, 22],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
...sharedTypes,
|
||||
OpenTip: 'OpenTipTo225'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [20, undefined],
|
||||
minmax: [23, undefined],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
|
||||
}
|
||||
...sharedTypes
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "1.21.1",
|
||||
"version": "1.22.1",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,16 +27,16 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"@polkadot/metadata": "1.21.1",
|
||||
"@polkadot/util": "^2.15.1",
|
||||
"@polkadot/util-crypto": "^2.15.1",
|
||||
"@polkadot/metadata": "1.22.1",
|
||||
"@polkadot/util": "^2.16.1",
|
||||
"@polkadot/util-crypto": "^2.16.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^5.1.2",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.15.1",
|
||||
"@polkadot/keyring": "^2.16.1",
|
||||
"@types/memoizee": "^0.4.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, Elect
|
||||
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
|
||||
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import { AccountInfo, ApplyExtrinsicResult, ChainProperties, ChainType, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount, TransactionValidityError, UnknownTransaction } from '@polkadot/types/interfaces/system';
|
||||
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import { OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
import { CallHash, Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
|
||||
@@ -1112,9 +1112,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
OpenTip: OpenTip;
|
||||
'Option<OpenTip>': Option<OpenTip>;
|
||||
'Vec<OpenTip>': Vec<OpenTip>;
|
||||
OpenTipFinder: OpenTipFinder;
|
||||
'Option<OpenTipFinder>': Option<OpenTipFinder>;
|
||||
'Vec<OpenTipFinder>': Vec<OpenTipFinder>;
|
||||
OpenTipTo225: OpenTipTo225;
|
||||
'Option<OpenTipTo225>': Option<OpenTipTo225>;
|
||||
'Vec<OpenTipTo225>': Vec<OpenTipTo225>;
|
||||
OpenTipFinderTo225: OpenTipFinderTo225;
|
||||
'Option<OpenTipFinderTo225>': Option<OpenTipFinderTo225>;
|
||||
'Vec<OpenTipFinderTo225>': Vec<OpenTipFinderTo225>;
|
||||
OpenTipTip: OpenTipTip;
|
||||
'Option<OpenTipTip>': Option<OpenTipTip>;
|
||||
'Vec<OpenTipTip>': Vec<OpenTipTip>;
|
||||
|
||||
@@ -8,10 +8,11 @@ import { isString, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import Raw from './Raw';
|
||||
|
||||
// The 520 here is a weird one - it is explicitly for a [u8; 65] as found as a EcdsaSignature
|
||||
// The 520 here is a weird one - it is explicitly for a [u8; 65] as found as a EcdsaSignature,
|
||||
// and 264 here is explicity for a [u8; 33] as found as EcdsaPublic key.
|
||||
// Likewise 160 is for [u8; 20], which is also a H160, i.e. an Ethereum address. Both these are
|
||||
// as a result of the Polkadot claims module. (Technically we don't need the 520 in here)
|
||||
export type BitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 512 | 520 | 1024 | 2048;
|
||||
export type BitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 264 | 512 | 520 | 1024 | 2048;
|
||||
|
||||
/** @internal */
|
||||
function decodeU8aFixed (value: AnyU8a, bitLength: BitLength): AnyU8a {
|
||||
|
||||
@@ -13,11 +13,20 @@ export default {
|
||||
OpenTip: {
|
||||
reason: 'Hash',
|
||||
who: 'AccountId',
|
||||
finder: 'Option<OpenTipFinder>',
|
||||
finder: 'AccountId',
|
||||
deposit: 'Balance',
|
||||
closes: 'Option<BlockNumber>',
|
||||
tips: 'Vec<OpenTipTip>',
|
||||
findersFee: 'bool'
|
||||
},
|
||||
OpenTipTo225: {
|
||||
reason: 'Hash',
|
||||
who: 'AccountId',
|
||||
finder: 'Option<OpenTipFinderTo225>',
|
||||
closes: 'Option<BlockNumber>',
|
||||
tips: 'Vec<OpenTipTip>'
|
||||
},
|
||||
OpenTipFinder: '(AccountId, Balance)',
|
||||
OpenTipFinderTo225: '(AccountId, Balance)',
|
||||
OpenTipTip: '(AccountId, Balance)',
|
||||
TreasuryProposal: {
|
||||
proposer: 'AccountId',
|
||||
|
||||
@@ -3,23 +3,35 @@
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Option, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { bool } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name OpenTip */
|
||||
export interface OpenTip extends Struct {
|
||||
readonly reason: Hash;
|
||||
readonly who: AccountId;
|
||||
readonly finder: Option<OpenTipFinder>;
|
||||
readonly finder: AccountId;
|
||||
readonly deposit: Balance;
|
||||
readonly closes: Option<BlockNumber>;
|
||||
readonly tips: Vec<OpenTipTip>;
|
||||
readonly findersFee: bool;
|
||||
}
|
||||
|
||||
/** @name OpenTipFinder */
|
||||
export interface OpenTipFinder extends ITuple<[AccountId, Balance]> {}
|
||||
/** @name OpenTipFinderTo225 */
|
||||
export interface OpenTipFinderTo225 extends ITuple<[AccountId, Balance]> {}
|
||||
|
||||
/** @name OpenTipTip */
|
||||
export interface OpenTipTip extends ITuple<[AccountId, Balance]> {}
|
||||
|
||||
/** @name OpenTipTo225 */
|
||||
export interface OpenTipTo225 extends Struct {
|
||||
readonly reason: Hash;
|
||||
readonly who: AccountId;
|
||||
readonly finder: Option<OpenTipFinderTo225>;
|
||||
readonly closes: Option<BlockNumber>;
|
||||
readonly tips: Vec<OpenTipTip>;
|
||||
}
|
||||
|
||||
/** @name TreasuryProposal */
|
||||
export interface TreasuryProposal extends Struct {
|
||||
readonly proposer: AccountId;
|
||||
|
||||
Reference in New Issue
Block a user