@bitgo-beta/abstract-substrate 1.0.1-beta.14 → 1.0.1-beta.1400
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/src/abstractSubstrateCoin.d.ts +77 -4
- package/dist/src/abstractSubstrateCoin.d.ts.map +1 -1
- package/dist/src/abstractSubstrateCoin.js +436 -16
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +16 -1
- package/dist/src/lib/constants.d.ts +7 -0
- package/dist/src/lib/constants.d.ts.map +1 -0
- package/dist/src/lib/constants.js +10 -0
- package/dist/src/lib/errors.d.ts +8 -0
- package/dist/src/lib/errors.d.ts.map +1 -0
- package/dist/src/lib/errors.js +19 -0
- package/dist/src/lib/iface.d.ts +257 -0
- package/dist/src/lib/iface.d.ts.map +1 -0
- package/dist/src/lib/iface.js +87 -0
- package/dist/src/lib/index.d.ts +12 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +61 -0
- package/dist/src/lib/keyPair.d.ts +31 -0
- package/dist/src/lib/keyPair.d.ts.map +1 -0
- package/dist/src/lib/keyPair.js +110 -0
- package/dist/src/lib/nativeTransferBuilder.d.ts +61 -0
- package/dist/src/lib/nativeTransferBuilder.d.ts.map +1 -0
- package/dist/src/lib/nativeTransferBuilder.js +150 -0
- package/dist/src/lib/singletonRegistry.d.ts +8 -0
- package/dist/src/lib/singletonRegistry.d.ts.map +1 -0
- package/dist/src/lib/singletonRegistry.js +20 -0
- package/dist/src/lib/transaction.d.ts +92 -0
- package/dist/src/lib/transaction.d.ts.map +1 -0
- package/dist/src/lib/transaction.js +572 -0
- package/dist/src/lib/transactionBuilder.d.ts +121 -0
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
- package/dist/src/lib/transactionBuilder.js +334 -0
- package/dist/src/lib/transferBuilder.d.ts +6 -0
- package/dist/src/lib/transferBuilder.d.ts.map +1 -0
- package/dist/src/lib/transferBuilder.js +11 -0
- package/dist/src/lib/txnSchema.d.ts +13 -0
- package/dist/src/lib/txnSchema.d.ts.map +1 -0
- package/dist/src/lib/txnSchema.js +74 -0
- package/dist/src/lib/utils.d.ts +152 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +297 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -6
- package/.eslintignore +0 -5
- package/.mocharc.yml +0 -8
- package/CHANGELOG.md +0 -14
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { BaseCoin, BitGoBase, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction,
|
|
2
|
-
import { BaseCoin as StaticsBaseCoin
|
|
1
|
+
import { AuditDecryptedKeyParams, BaseCoin, BitGoBase, KeyPair, MPCAlgorithm, MPCConsolidationRecoveryOptions, MPCRecoveryOptions, MPCSweepRecoveryOptions, MPCSweepTxs, MPCTx, MPCTxs, MultisigType, ParsedTransaction, ParseTransactionOptions, SignedTransaction, TssVerifyAddressOptions, VerifyTransactionOptions, signEddsaMpcV2RecoveryTx, EddsaSigningMaterial } from '@bitgo-beta/sdk-core';
|
|
2
|
+
import { CoinFamily, BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
|
|
3
|
+
import { Transaction } from './lib';
|
|
4
|
+
import { NativeTransferBuilder } from './lib/nativeTransferBuilder';
|
|
5
|
+
import { SignTransactionOptions, VerifiedTransactionParameters, Material } from './lib/iface';
|
|
6
|
+
import { ApiPromise } from '@polkadot/api';
|
|
7
|
+
export declare const DEFAULT_SCAN_FACTOR = 20;
|
|
3
8
|
export declare class SubstrateCoin extends BaseCoin {
|
|
4
9
|
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
10
|
+
readonly MAX_VALIDITY_DURATION = 2400;
|
|
11
|
+
readonly SWEEP_TXN_DURATION = 64;
|
|
5
12
|
protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
6
|
-
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
7
13
|
/**
|
|
8
14
|
* Creates an instance of TransactionBuilderFactory for the coin specific sdk
|
|
9
15
|
*/
|
|
@@ -18,6 +24,8 @@ export declare class SubstrateCoin extends BaseCoin {
|
|
|
18
24
|
getFullName(): string;
|
|
19
25
|
/** @inheritDoc */
|
|
20
26
|
supportsTss(): boolean;
|
|
27
|
+
/** inherited doc */
|
|
28
|
+
getDefaultMultisigType(): MultisigType;
|
|
21
29
|
/** @inheritDoc **/
|
|
22
30
|
getMPCAlgorithm(): MPCAlgorithm;
|
|
23
31
|
/** @inheritDoc **/
|
|
@@ -25,14 +33,79 @@ export declare class SubstrateCoin extends BaseCoin {
|
|
|
25
33
|
/** @inheritDoc **/
|
|
26
34
|
isValidPub(pub: string): boolean;
|
|
27
35
|
/** @inheritDoc **/
|
|
28
|
-
isWalletAddress(params:
|
|
36
|
+
isWalletAddress(params: TssVerifyAddressOptions): Promise<boolean>;
|
|
29
37
|
/** @inheritDoc **/
|
|
30
38
|
parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
|
|
31
39
|
/** @inheritDoc **/
|
|
32
40
|
verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
|
|
33
41
|
/** @inheritDoc **/
|
|
34
42
|
isValidAddress(address: string): boolean;
|
|
43
|
+
verifySignTransactionParams(params: SignTransactionOptions): VerifiedTransactionParameters;
|
|
35
44
|
/** @inheritDoc **/
|
|
36
45
|
signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the address format for the substrate coin.
|
|
48
|
+
*
|
|
49
|
+
* @returns {number} The address format as a number.
|
|
50
|
+
*/
|
|
51
|
+
protected getAddressFormat(): number;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves the maximum validity duration in blocks.
|
|
54
|
+
*
|
|
55
|
+
* This method is intended to be overridden by subclasses to provide the specific
|
|
56
|
+
* maximum validity duration for different types of Substrate-based coins.
|
|
57
|
+
*
|
|
58
|
+
* @returns {number} The maximum validity duration in blocks.
|
|
59
|
+
* @throws {Error} If the method is not implemented by the subclass.
|
|
60
|
+
*/
|
|
61
|
+
protected getMaxValidityDurationBlocks(): number;
|
|
62
|
+
protected getAddressFromPublicKey(Pubkey: string): string;
|
|
63
|
+
protected getInitializedNodeAPI(): Promise<ApiPromise>;
|
|
64
|
+
protected getAccountInfo(walletAddr: string): Promise<{
|
|
65
|
+
nonce: number;
|
|
66
|
+
freeBalance: number;
|
|
67
|
+
}>;
|
|
68
|
+
protected getFee(destAddr: string, srcAddr: string, amount: number): Promise<number>;
|
|
69
|
+
protected getHeaderInfo(): Promise<{
|
|
70
|
+
headerNumber: number;
|
|
71
|
+
headerHash: string;
|
|
72
|
+
}>;
|
|
73
|
+
protected getMaterial(): Promise<Material>;
|
|
74
|
+
/**
|
|
75
|
+
* Builds a funds recovery transaction without BitGo
|
|
76
|
+
* @param {MPCRecoveryOptions} params parameters needed to construct and
|
|
77
|
+
* (maybe) sign the transaction
|
|
78
|
+
*
|
|
79
|
+
* @returns {MPCTx} the serialized transaction hex string and index
|
|
80
|
+
* of the address being swept
|
|
81
|
+
*/
|
|
82
|
+
recover(params: MPCRecoveryOptions): Promise<MPCTx | MPCSweepTxs>;
|
|
83
|
+
/**
|
|
84
|
+
* Builds native TAO recoveries of receive addresses in batch without BitGo.
|
|
85
|
+
* Funds will be recovered to base address first. You need to initiate another sweep txn after that.
|
|
86
|
+
*
|
|
87
|
+
* @param {MPCConsolidationRecoveryOptions} params - options for consolidation recovery.
|
|
88
|
+
* @param {string} [params.startingScanIndex] - receive address index to start scanning from. default to 1 (inclusive).
|
|
89
|
+
* @param {string} [params.endingScanIndex] - receive address index to end scanning at. default to startingScanIndex + 20 (exclusive).
|
|
90
|
+
*/
|
|
91
|
+
recoverConsolidations(params: MPCConsolidationRecoveryOptions): Promise<MPCTxs | MPCSweepTxs>;
|
|
92
|
+
protected getEddsaSigningMaterial(userKey: string, walletPassphrase: string): Promise<EddsaSigningMaterial>;
|
|
93
|
+
protected signSubstrateMpcV2Recovery(params: Parameters<typeof signEddsaMpcV2RecoveryTx>[0]): Promise<Buffer>;
|
|
94
|
+
/**
|
|
95
|
+
* Adds an MPCv1 or MPCv2 signature to a Substrate transaction builder.
|
|
96
|
+
*
|
|
97
|
+
* Both branches hand off the raw 64-byte Ed25519 signature untouched.
|
|
98
|
+
* Transaction#constructSignedPayload already prepends the 0x00 type-tag
|
|
99
|
+
* (the Substrate MultiSignature enum discriminant for Ed25519) to whatever
|
|
100
|
+
* signature buffer is passed to addSignature, so wrapping the signature
|
|
101
|
+
* here would produce a double discriminant, corrupting the on-wire sig
|
|
102
|
+
* bytes and causing the chain to reject the extrinsic with `1010: Bad
|
|
103
|
+
* signature`.
|
|
104
|
+
*/
|
|
105
|
+
protected addSubstrateRecoverySignature(txBuilder: NativeTransferBuilder, signingMaterial: EddsaSigningMaterial, backupKey: string, walletPassphrase: string, unsignedTransaction: Transaction, currPath: string, bitgoKey: string, accountId: string): Promise<void>;
|
|
106
|
+
/** inherited doc */
|
|
107
|
+
createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
|
|
108
|
+
/** inherited doc */
|
|
109
|
+
auditDecryptedKey({ publicKey, prv, multiSigType }: AuditDecryptedKeyParams): void;
|
|
37
110
|
}
|
|
38
111
|
//# sourceMappingURL=abstractSubstrateCoin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSubstrateCoin.d.ts","sourceRoot":"","sources":["../../src/abstractSubstrateCoin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"abstractSubstrateCoin.d.ts","sourceRoot":"","sources":["../../src/abstractSubstrateCoin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,SAA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