@autonomys/auto-consensus 0.1.6-devnet-support → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/balances.d.ts +2 -2
- package/dist/balances.d.ts.map +1 -1
- package/dist/domain.d.ts +4 -4
- package/dist/domain.d.ts.map +1 -1
- package/dist/info.d.ts.map +1 -1
- package/dist/staking.d.ts +5 -5
- package/dist/staking.d.ts.map +1 -1
- package/dist/types/staking.d.ts +36 -8
- package/dist/types/staking.d.ts.map +1 -1
- package/dist/utils/parse.d.ts.map +1 -1
- package/dist/utils/parse.js +24 -8
- package/dist/utils/sudo.d.ts +4 -1
- package/dist/utils/sudo.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/types/transaction.d.ts +0 -12
- package/dist/types/transaction.d.ts.map +0 -1
- package/dist/types/transaction.js +0 -3
- package/dist/utils/detectTxSuccess.d.ts +0 -3
- package/dist/utils/detectTxSuccess.d.ts.map +0 -1
- package/dist/utils/detectTxSuccess.js +0 -13
- package/dist/utils/signAndSendTx.d.ts +0 -5
- package/dist/utils/signAndSendTx.d.ts.map +0 -1
- package/dist/utils/signAndSendTx.js +0 -52
- package/dist/utils/validateEvents.d.ts +0 -5
- package/dist/utils/validateEvents.d.ts.map +0 -1
- package/dist/utils/validateEvents.js +0 -24
package/dist/balances.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Api } from '@autonomys/auto-utils';
|
|
2
2
|
type BalanceData = {
|
|
3
3
|
free: bigint;
|
|
4
4
|
reserved: bigint;
|
|
5
5
|
frozen: bigint;
|
|
6
6
|
};
|
|
7
7
|
export declare const totalIssuance: (networkId?: string) => Promise<import("@polkadot/types-codec/types").Codec>;
|
|
8
|
-
export declare const balance: (api:
|
|
8
|
+
export declare const balance: (api: Api, address: string) => Promise<BalanceData>;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=balances.d.ts.map
|
package/dist/balances.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../src/balances.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../src/balances.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAM,MAAM,uBAAuB,CAAA;AASpD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,aAAa,eAAsB,MAAM,yDAQrD,CAAA;AAED,eAAO,MAAM,OAAO,QAAe,GAAG,WAAW,MAAM,KAAG,QAAQ,WAAW,CAgB5E,CAAA"}
|
package/dist/domain.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Api } from '@autonomys/auto-utils';
|
|
2
2
|
import { ConfirmedDomainBlock, DomainRegistry, DomainStakingSummary } from './types';
|
|
3
|
-
export declare const domains: (api:
|
|
4
|
-
export declare const domainStakingSummary: (api:
|
|
5
|
-
export declare const latestConfirmedDomainBlock: (api:
|
|
3
|
+
export declare const domains: (api: Api) => Promise<DomainRegistry[]>;
|
|
4
|
+
export declare const domainStakingSummary: (api: Api) => Promise<DomainStakingSummary[]>;
|
|
5
|
+
export declare const latestConfirmedDomainBlock: (api: Api) => Promise<ConfirmedDomainBlock[]>;
|
|
6
6
|
//# sourceMappingURL=domain.d.ts.map
|
package/dist/domain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGpF,eAAO,MAAM,OAAO,QAAe,GAAG,KAAG,QAAQ,cAAc,EAAE,CAQhE,CAAA;AAED,eAAO,MAAM,oBAAoB,QAAe,GAAG,KAAG,QAAQ,oBAAoB,EAAE,CAQnF,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAe,GAAG,KAAG,QAAQ,oBAAoB,EAAE,CAWzF,CAAA"}
|
package/dist/info.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,eAAsB,MAAM,WAAU,GAAG,EAAE,cAAmB,MAAM,iBACrB,CAAA;AAE/D,eAAO,MAAM,KAAK,eAAsB,MAAM,WAAU,GAAG,EAAE,cAAmB,MAAM,iBACrB,CAAA;AAEjE,eAAO,MAAM,KAAK,eAAsB,MAAM,iBAA+C,CAAA;AAE7F,eAAO,MAAM,WAAW,eAAsB,MAAM,KAAG,QAAQ,MAAM,CAKpE,CAAA;AAED,eAAO,MAAM,SAAS,eAAsB,MAAM,iBAKjD,CAAA;AAED,eAAO,MAAM,gBAAgB,eAAsB,MAAM,iBACZ,CAAA"}
|
package/dist/staking.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Api } from '@autonomys/auto-utils';
|
|
2
2
|
import type { NominateOperatorParams, RegisterOperatorParams, StakingParams, StringNumberOrBigInt, WithdrawStakeParams } from './types/staking';
|
|
3
|
-
export declare const operators: (api:
|
|
4
|
-
export declare const operator: (api:
|
|
5
|
-
export declare const deposits: (api:
|
|
6
|
-
export declare const withdrawals: (api:
|
|
3
|
+
export declare const operators: (api: Api) => Promise<import("./types/staking").Operator[]>;
|
|
4
|
+
export declare const operator: (api: Api, operatorId: StringNumberOrBigInt) => Promise<import("./types/staking").OperatorDetails>;
|
|
5
|
+
export declare const deposits: (api: Api, operatorId: StringNumberOrBigInt, account?: string | undefined) => Promise<import("./types/staking").Deposit[]>;
|
|
6
|
+
export declare const withdrawals: (api: Api, operatorId: StringNumberOrBigInt, account?: string | undefined) => Promise<import("./types/staking").Withdrawal[]>;
|
|
7
7
|
export declare const registerOperator: (params: RegisterOperatorParams) => import("@autonomys/auto-utils").SubmittableExtrinsic<"promise", import("@autonomys/auto-utils").ISubmittableResult>;
|
|
8
8
|
export declare const nominateOperator: (params: NominateOperatorParams) => import("@autonomys/auto-utils").SubmittableExtrinsic<"promise", import("@autonomys/auto-utils").ISubmittableResult>;
|
|
9
9
|
export declare const withdrawStake: (params: WithdrawStakeParams) => import("@autonomys/auto-utils").SubmittableExtrinsic<"promise", import("@autonomys/auto-utils").ISubmittableResult>;
|
package/dist/staking.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AASxB,eAAO,MAAM,SAAS,QAAe,GAAG,kDAQvC,CAAA;AAED,eAAO,MAAM,QAAQ,QAAe,GAAG,cAAc,oBAAoB,uDAQxE,CAAA;AAED,eAAO,MAAM,QAAQ,QACd,GAAG,cACI,oBAAoB,YACvB,MAAM,GAAG,SAAS,iDAS5B,CAAA;AAED,eAAO,MAAM,WAAW,QACjB,GAAG,cACI,oBAAoB,YACvB,MAAM,GAAG,SAAS,oDAY5B,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAY,sBAAsB,wHA6B9D,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAY,sBAAsB,wHAS9D,CAAA;AAED,eAAO,MAAM,aAAa,WAAY,mBAAmB,wHASxD,CAAA;AAED,eAAO,MAAM,kBAAkB,WAAY,aAAa,wHASvD,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,aAAa,wHAShD,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,aAAa,wHASpD,CAAA"}
|
package/dist/types/staking.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ApiPromise, KeyringPair } from '@autonomys/auto-utils';
|
|
2
2
|
export type RawOperatorId = string[];
|
|
3
|
-
export type RawDepositHeader = [string, string];
|
|
4
3
|
export type RawOperatorDetails = {
|
|
5
4
|
signingKey: string;
|
|
6
5
|
currentDomainId: number;
|
|
@@ -41,37 +40,66 @@ export type Operator = {
|
|
|
41
40
|
operatorId: bigint;
|
|
42
41
|
operatorDetails: OperatorDetails;
|
|
43
42
|
};
|
|
43
|
+
export type RawDepositHeader = [string, string];
|
|
44
44
|
export type RawDeposit = {
|
|
45
45
|
known: {
|
|
46
46
|
shares: number;
|
|
47
47
|
storageFeeDeposit: number;
|
|
48
48
|
};
|
|
49
49
|
pending: {
|
|
50
|
-
effectiveDomainEpoch: number
|
|
50
|
+
effectiveDomainEpoch: [number, number];
|
|
51
51
|
amount: string;
|
|
52
52
|
storageFeeDeposit: string;
|
|
53
|
-
};
|
|
53
|
+
} | null;
|
|
54
54
|
};
|
|
55
55
|
export type Deposit = {
|
|
56
|
-
operatorId:
|
|
56
|
+
operatorId: number;
|
|
57
57
|
account: string;
|
|
58
58
|
shares: bigint;
|
|
59
59
|
storageFeeDeposit: bigint;
|
|
60
|
+
known: {
|
|
61
|
+
shares: bigint;
|
|
62
|
+
storageFeeDeposit: bigint;
|
|
63
|
+
};
|
|
60
64
|
pending: {
|
|
65
|
+
effectiveDomainId: number;
|
|
66
|
+
effectiveDomainEpoch: number;
|
|
61
67
|
amount: bigint;
|
|
62
68
|
storageFeeDeposit: bigint;
|
|
69
|
+
} | null;
|
|
70
|
+
};
|
|
71
|
+
export type RawWithdrawalHeader = [string, string];
|
|
72
|
+
export type RawWithdrawal = {
|
|
73
|
+
totalWithdrawalAmount: string;
|
|
74
|
+
withdrawals: {
|
|
75
|
+
domainId: number;
|
|
76
|
+
unlockAtConfirmedDomainBlockNumber: number;
|
|
77
|
+
amountToUnlock: string;
|
|
78
|
+
storageFeeRefund: string;
|
|
79
|
+
}[];
|
|
80
|
+
withdrawalInShares: {
|
|
81
|
+
domainEpoch: number[];
|
|
82
|
+
unlockAtConfirmedDomainBlockNumber: number;
|
|
83
|
+
shares: string;
|
|
84
|
+
storageFeeRefund: string;
|
|
63
85
|
};
|
|
64
86
|
};
|
|
87
|
+
export type WithdrawalUnlock = {
|
|
88
|
+
domainId: number;
|
|
89
|
+
unlockAtConfirmedDomainBlockNumber: number;
|
|
90
|
+
amountToUnlock: bigint;
|
|
91
|
+
storageFeeRefund: bigint;
|
|
92
|
+
};
|
|
65
93
|
export type Withdrawal = {
|
|
66
94
|
operatorId: number;
|
|
67
95
|
account: string;
|
|
68
|
-
totalWithdrawalAmount:
|
|
69
|
-
withdrawals:
|
|
96
|
+
totalWithdrawalAmount: bigint;
|
|
97
|
+
withdrawals: WithdrawalUnlock[];
|
|
70
98
|
withdrawalInShares: {
|
|
71
99
|
domainEpoch: number[];
|
|
72
100
|
unlockAtConfirmedDomainBlockNumber: number;
|
|
73
|
-
shares:
|
|
74
|
-
storageFeeRefund:
|
|
101
|
+
shares: bigint;
|
|
102
|
+
storageFeeRefund: bigint;
|
|
75
103
|
};
|
|
76
104
|
};
|
|
77
105
|
export type StringNumberOrBigInt = string | number | bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../src/types/staking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEpE,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAA;AAEpC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../src/types/staking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEpE,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,CAAA;AAEpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,sBAAsB,EAAE,MAAM,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB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,GAAG,EAAE,UAAU,CAAA;IACf,UAAU,EAAE,oBAAoB,CAAA;CACjC,CAAA;AAED,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,aAAa,EAAE,oBAAoB,CAAA;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EAOf,oBAAoB,EACpB,UAAU,EACX,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,WAAW,WAAY,CAAC,WAAW,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAG,cAMnE,CAAA;AAED,eAAO,MAAM,oBAAoB,oBAAqB,KAAK,KAAG,eAgB7D,CAAA;AAED,eAAO,MAAM,aAAa,aAAc,CAAC,WAAW,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAG,QAKvE,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,CAAC,WAAW,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAG,OAuBrE,CAAA;AAED,eAAO,MAAM,eAAe,eAAgB,CAAC,WAAW,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAG,UAwB3E,CAAA;AAED,eAAO,MAAM,WAAW,eAAgB,oBAAoB,KAAG,MACM,CAAA"}
|
package/dist/utils/parse.js
CHANGED
|
@@ -34,15 +34,24 @@ exports.parseOperator = parseOperator;
|
|
|
34
34
|
const parseDeposit = (deposit) => {
|
|
35
35
|
const header = deposit[0].toHuman();
|
|
36
36
|
const parsedDeposit = deposit[1].toJSON();
|
|
37
|
+
const pending = parsedDeposit.pending !== null
|
|
38
|
+
? {
|
|
39
|
+
effectiveDomainId: parsedDeposit.pending.effectiveDomainEpoch[0],
|
|
40
|
+
effectiveDomainEpoch: parsedDeposit.pending.effectiveDomainEpoch[1],
|
|
41
|
+
amount: BigInt(parsedDeposit.pending.amount),
|
|
42
|
+
storageFeeDeposit: BigInt(parsedDeposit.pending.storageFeeDeposit),
|
|
43
|
+
}
|
|
44
|
+
: null;
|
|
37
45
|
return {
|
|
38
|
-
operatorId:
|
|
46
|
+
operatorId: parseInt(header[0]),
|
|
39
47
|
account: header[1],
|
|
40
48
|
shares: BigInt(parsedDeposit.known.shares.toString()),
|
|
41
49
|
storageFeeDeposit: BigInt(parsedDeposit.known.storageFeeDeposit.toString()),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
storageFeeDeposit: BigInt(parsedDeposit.
|
|
50
|
+
known: {
|
|
51
|
+
shares: BigInt(parsedDeposit.known.shares.toString()),
|
|
52
|
+
storageFeeDeposit: BigInt(parsedDeposit.known.storageFeeDeposit.toString()),
|
|
45
53
|
},
|
|
54
|
+
pending,
|
|
46
55
|
};
|
|
47
56
|
};
|
|
48
57
|
exports.parseDeposit = parseDeposit;
|
|
@@ -52,14 +61,21 @@ const parseWithdrawal = (withdrawal) => {
|
|
|
52
61
|
return {
|
|
53
62
|
operatorId: parseInt(header[0]),
|
|
54
63
|
account: header[1],
|
|
55
|
-
totalWithdrawalAmount: parsedWithdrawal.totalWithdrawalAmount,
|
|
56
|
-
withdrawals: parsedWithdrawal.withdrawals,
|
|
64
|
+
totalWithdrawalAmount: BigInt(parsedWithdrawal.totalWithdrawalAmount),
|
|
57
65
|
withdrawalInShares: {
|
|
58
66
|
domainEpoch: parsedWithdrawal.withdrawalInShares.domainEpoch,
|
|
59
67
|
unlockAtConfirmedDomainBlockNumber: parsedWithdrawal.withdrawalInShares.unlockAtConfirmedDomainBlockNumber,
|
|
60
|
-
shares: BigInt(parsedWithdrawal.withdrawalInShares.shares)
|
|
61
|
-
storageFeeRefund: BigInt(parsedWithdrawal.withdrawalInShares.storageFeeRefund)
|
|
68
|
+
shares: BigInt(parsedWithdrawal.withdrawalInShares.shares),
|
|
69
|
+
storageFeeRefund: BigInt(parsedWithdrawal.withdrawalInShares.storageFeeRefund),
|
|
62
70
|
},
|
|
71
|
+
withdrawals: parsedWithdrawal.withdrawals &&
|
|
72
|
+
parsedWithdrawal.withdrawals.length > 0 &&
|
|
73
|
+
parsedWithdrawal.withdrawals.map((w) => ({
|
|
74
|
+
domainId: w.domainId,
|
|
75
|
+
unlockAtConfirmedDomainBlockNumber: w.unlockAtConfirmedDomainBlockNumber,
|
|
76
|
+
amountToUnlock: BigInt(w.amountToUnlock),
|
|
77
|
+
storageFeeRefund: BigInt(w.storageFeeRefund),
|
|
78
|
+
})),
|
|
63
79
|
};
|
|
64
80
|
};
|
|
65
81
|
exports.parseWithdrawal = parseWithdrawal;
|
package/dist/utils/sudo.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { AddressOrPair, ApiPromise, ISubmittableResult, SignerOptions, SubmittableExtrinsic } from '@autonomys/auto-utils';
|
|
2
2
|
import { Events } from '@autonomys/auto-utils';
|
|
3
|
-
export declare const sudo: (api: ApiPromise, sender: AddressOrPair, tx: SubmittableExtrinsic<'promise', ISubmittableResult>, options?: Partial<SignerOptions>, eventsExpected?: Events, log?: boolean) => Promise<import("@autonomys/auto-utils").TransactionSignedAndSend
|
|
3
|
+
export declare const sudo: (api: ApiPromise, sender: AddressOrPair, tx: SubmittableExtrinsic<'promise', ISubmittableResult>, options?: Partial<SignerOptions>, eventsExpected?: Events, log?: boolean) => Promise<import("@autonomys/auto-utils").TransactionSignedAndSend & {
|
|
4
|
+
receipt: import("@polkadot/api").SubmittableResult;
|
|
5
|
+
identifier?: string | null | undefined;
|
|
6
|
+
}>;
|
|
4
7
|
//# sourceMappingURL=sudo.d.ts.map
|
package/dist/utils/sudo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sudo.d.ts","sourceRoot":"","sources":["../../src/utils/sudo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAiB,MAAM,uBAAuB,CAAA;AAG7D,eAAO,MAAM,IAAI,QACV,UAAU,UACP,aAAa,MACjB,qBAAqB,SAAS,EAAE,kBAAkB,CAAC,YAC9C,QAAQ,aAAa,CAAC,mBACf,MAAM,QACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"sudo.d.ts","sourceRoot":"","sources":["../../src/utils/sudo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAiB,MAAM,uBAAuB,CAAA;AAG7D,eAAO,MAAM,IAAI,QACV,UAAU,UACP,aAAa,MACjB,qBAAqB,SAAS,EAAE,kBAAkB,CAAC,YAC9C,QAAQ,aAAa,CAAC,mBACf,MAAM,QACjB,OAAO;;;EACsE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/auto-consensus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
],
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/autonomys/auto-sdk"
|
|
18
18
|
},
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Autonomys",
|
|
21
21
|
"url": "https://www.autonomys.net"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@autonomys/auto-utils": "^0.1.
|
|
24
|
+
"@autonomys/auto-utils": "^0.1.7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@polkadot/types-codec": "^11.2.1",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"ts-jest": "^29.1.4",
|
|
33
33
|
"typescript": "^5.4.5"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c62ed7553ebb31c976f5be4932f3c7cde828a4ca"
|
|
36
36
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Events } from '../types/events';
|
|
2
|
-
export type EventsValidated = {
|
|
3
|
-
expected: Events;
|
|
4
|
-
found: Events;
|
|
5
|
-
};
|
|
6
|
-
export type TransactionSignedAndSend = {
|
|
7
|
-
success: boolean;
|
|
8
|
-
txHash: string | undefined;
|
|
9
|
-
blockHash: string | undefined;
|
|
10
|
-
events: EventsValidated;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detectTxSuccess.d.ts","sourceRoot":"","sources":["../../src/utils/detectTxSuccess.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGxD,eAAO,MAAM,eAAe,WAAY,WAAW,EAAE,KAAG,OAMvD,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// file: src/utils/detectTxSuccess.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.detectTxSuccess = void 0;
|
|
5
|
-
const events_1 = require("./events");
|
|
6
|
-
const detectTxSuccess = (events) => {
|
|
7
|
-
events.forEach(({ event: { method, section } }) => {
|
|
8
|
-
if (events_1.expectSuccessfulTxEvent.indexOf(`${section}.${method}`) > -1)
|
|
9
|
-
return true;
|
|
10
|
-
});
|
|
11
|
-
return false;
|
|
12
|
-
};
|
|
13
|
-
exports.detectTxSuccess = detectTxSuccess;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AddressOrPair, ISubmittableResult, SubmittableExtrinsic } from '@autonomys/auto-utils';
|
|
2
|
-
import type { Events } from '../types/events';
|
|
3
|
-
import type { TransactionSignedAndSend } from '../types/transaction';
|
|
4
|
-
export declare const signAndSendTx: (sender: AddressOrPair, tx: SubmittableExtrinsic<'promise', ISubmittableResult>, eventsExpected?: Events, log?: boolean) => Promise<TransactionSignedAndSend>;
|
|
5
|
-
//# sourceMappingURL=signAndSendTx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signAndSendTx.d.ts","sourceRoot":"","sources":["../../src/utils/signAndSendTx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAmB,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAKrF,eAAO,MAAM,aAAa,WAChB,aAAa,MACjB,qBAAqB,SAAS,EAAE,kBAAkB,CAAC,mBACvC,MAAM,QACjB,OAAO,KACX,QAAQ,wBAAwB,CAgClC,CAAA"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// file: src/utils/signAndSendTx.ts
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.signAndSendTx = void 0;
|
|
14
|
-
const detectTxSuccess_1 = require("./detectTxSuccess");
|
|
15
|
-
const events_1 = require("./events");
|
|
16
|
-
const validateEvents_1 = require("./validateEvents");
|
|
17
|
-
const signAndSendTx = (sender_1, tx_1, ...args_1) => __awaiter(void 0, [sender_1, tx_1, ...args_1], void 0, function* (sender, tx, eventsExpected = events_1.expectSuccessfulTxEvent, log = false) {
|
|
18
|
-
let success = false;
|
|
19
|
-
let txHashHex = undefined;
|
|
20
|
-
let blockHash = undefined;
|
|
21
|
-
let eventsValidated = { expected: [], found: [] };
|
|
22
|
-
yield new Promise((resolve, reject) => {
|
|
23
|
-
tx.signAndSend(sender, ({ events, status, txHash }) => {
|
|
24
|
-
if (status.isInBlock) {
|
|
25
|
-
txHashHex = txHash.toHex();
|
|
26
|
-
blockHash = status.asInBlock.toHex();
|
|
27
|
-
if (log)
|
|
28
|
-
console.log('Successful tx', txHashHex, 'in block', blockHash);
|
|
29
|
-
success = (0, detectTxSuccess_1.detectTxSuccess)(events);
|
|
30
|
-
if (eventsExpected.length > 0) {
|
|
31
|
-
const _events = (0, validateEvents_1.validateEvents)(events, eventsExpected, txHashHex, blockHash, log);
|
|
32
|
-
if (_events.expected.length === 0)
|
|
33
|
-
resolve();
|
|
34
|
-
else
|
|
35
|
-
reject(new Error('Events not found'));
|
|
36
|
-
}
|
|
37
|
-
else
|
|
38
|
-
resolve();
|
|
39
|
-
}
|
|
40
|
-
else if (status.isRetracted ||
|
|
41
|
-
status.isFinalityTimeout ||
|
|
42
|
-
status.isDropped ||
|
|
43
|
-
status.isInvalid) {
|
|
44
|
-
if (log)
|
|
45
|
-
console.error('Transaction failed');
|
|
46
|
-
reject(new Error('Transaction failed'));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
return { success, txHash: txHashHex, blockHash, events: eventsValidated };
|
|
51
|
-
});
|
|
52
|
-
exports.signAndSendTx = signAndSendTx;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { EventRecord } from '@autonomys/auto-utils';
|
|
2
|
-
import type { Events } from '../types/events';
|
|
3
|
-
import type { EventsValidated } from '../types/transaction';
|
|
4
|
-
export declare const validateEvents: (events: EventRecord[], eventsExpected: Events | undefined, tx: string, block: string, log?: boolean) => EventsValidated;
|
|
5
|
-
//# sourceMappingURL=validateEvents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateEvents.d.ts","sourceRoot":"","sources":["../../src/utils/validateEvents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,eAAO,MAAM,cAAc,WACjB,WAAW,EAAE,0CAEjB,MAAM,SACH,MAAM,QACR,OAAO,KACX,eAmBF,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// file: src/utils/validateEvents.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.validateEvents = void 0;
|
|
5
|
-
const events_1 = require("./events");
|
|
6
|
-
const validateEvents = (events, eventsExpected = events_1.expectSuccessfulTxEvent, tx, block, log = false) => {
|
|
7
|
-
const _eventsExpected = typeof eventsExpected === 'string'
|
|
8
|
-
? [eventsExpected]
|
|
9
|
-
: eventsExpected.map((e) => (typeof e === 'string' ? [e] : e)).flat();
|
|
10
|
-
const found = [];
|
|
11
|
-
events.forEach(({ event: { data, method, section } }) => {
|
|
12
|
-
const index = _eventsExpected.indexOf(`${section}.${method}`);
|
|
13
|
-
if (index > -1) {
|
|
14
|
-
_eventsExpected.splice(index, 1);
|
|
15
|
-
found.push(`${section}.${method}`);
|
|
16
|
-
}
|
|
17
|
-
else if (log)
|
|
18
|
-
console.log('Event not expected', `${section}.${method}`, 'tx', tx, 'block', block);
|
|
19
|
-
});
|
|
20
|
-
if (_eventsExpected.length > 0)
|
|
21
|
-
console.log('Events not found', _eventsExpected, 'tx', tx, 'block', block);
|
|
22
|
-
return { expected: _eventsExpected, found };
|
|
23
|
-
};
|
|
24
|
-
exports.validateEvents = validateEvents;
|