@bitgo-beta/abstract-substrate 1.0.1-beta.9 → 1.0.1-beta.900

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.
Files changed (47) hide show
  1. package/dist/src/abstractSubstrateCoin.d.ts +61 -4
  2. package/dist/src/abstractSubstrateCoin.d.ts.map +1 -1
  3. package/dist/src/abstractSubstrateCoin.js +379 -16
  4. package/dist/src/index.d.ts +1 -0
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +16 -1
  7. package/dist/src/lib/constants.d.ts +2 -0
  8. package/dist/src/lib/constants.d.ts.map +1 -0
  9. package/dist/src/lib/constants.js +5 -0
  10. package/dist/src/lib/errors.d.ts +8 -0
  11. package/dist/src/lib/errors.d.ts.map +1 -0
  12. package/dist/src/lib/errors.js +19 -0
  13. package/dist/src/lib/iface.d.ts +250 -0
  14. package/dist/src/lib/iface.d.ts.map +1 -0
  15. package/dist/src/lib/iface.js +83 -0
  16. package/dist/src/lib/index.d.ts +12 -0
  17. package/dist/src/lib/index.d.ts.map +1 -0
  18. package/dist/src/lib/index.js +61 -0
  19. package/dist/src/lib/keyPair.d.ts +31 -0
  20. package/dist/src/lib/keyPair.d.ts.map +1 -0
  21. package/dist/src/lib/keyPair.js +110 -0
  22. package/dist/src/lib/nativeTransferBuilder.d.ts +61 -0
  23. package/dist/src/lib/nativeTransferBuilder.d.ts.map +1 -0
  24. package/dist/src/lib/nativeTransferBuilder.js +150 -0
  25. package/dist/src/lib/singletonRegistry.d.ts +8 -0
  26. package/dist/src/lib/singletonRegistry.d.ts.map +1 -0
  27. package/dist/src/lib/singletonRegistry.js +20 -0
  28. package/dist/src/lib/transaction.d.ts +74 -0
  29. package/dist/src/lib/transaction.d.ts.map +1 -0
  30. package/dist/src/lib/transaction.js +553 -0
  31. package/dist/src/lib/transactionBuilder.d.ts +121 -0
  32. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  33. package/dist/src/lib/transactionBuilder.js +334 -0
  34. package/dist/src/lib/transferBuilder.d.ts +6 -0
  35. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  36. package/dist/src/lib/transferBuilder.js +11 -0
  37. package/dist/src/lib/txnSchema.d.ts +12 -0
  38. package/dist/src/lib/txnSchema.d.ts.map +1 -0
  39. package/dist/src/lib/txnSchema.js +71 -0
  40. package/dist/src/lib/utils.d.ts +139 -0
  41. package/dist/src/lib/utils.d.ts.map +1 -0
  42. package/dist/src/lib/utils.js +281 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +24 -6
  45. package/.eslintignore +0 -5
  46. package/.mocharc.yml +0 -8
  47. package/CHANGELOG.md +0 -10
@@ -1,9 +1,13 @@
1
- import { BaseCoin, BitGoBase, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions, VerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
2
- import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo-beta/statics';
1
+ import { AuditDecryptedKeyParams, BaseCoin, BitGoBase, KeyPair, MPCAlgorithm, MPCConsolidationRecoveryOptions, MPCRecoveryOptions, MPCSweepRecoveryOptions, MPCSweepTxs, MPCTx, MPCTxs, MultisigType, ParsedTransaction, ParseTransactionOptions, SignedTransaction, TssVerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
2
+ import { CoinFamily, BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
3
+ import { SignTransactionOptions, VerifiedTransactionParameters, Material } from './lib/iface';
4
+ import { ApiPromise } from '@polkadot/api';
5
+ export declare const DEFAULT_SCAN_FACTOR = 20;
3
6
  export declare class SubstrateCoin extends BaseCoin {
4
7
  protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
8
+ readonly MAX_VALIDITY_DURATION = 2400;
9
+ readonly SWEEP_TXN_DURATION = 64;
5
10
  protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
6
- static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
7
11
  /**
8
12
  * Creates an instance of TransactionBuilderFactory for the coin specific sdk
9
13
  */
@@ -18,6 +22,8 @@ export declare class SubstrateCoin extends BaseCoin {
18
22
  getFullName(): string;
19
23
  /** @inheritDoc */
20
24
  supportsTss(): boolean;
25
+ /** inherited doc */
26
+ getDefaultMultisigType(): MultisigType;
21
27
  /** @inheritDoc **/
22
28
  getMPCAlgorithm(): MPCAlgorithm;
23
29
  /** @inheritDoc **/
@@ -25,14 +31,65 @@ export declare class SubstrateCoin extends BaseCoin {
25
31
  /** @inheritDoc **/
26
32
  isValidPub(pub: string): boolean;
27
33
  /** @inheritDoc **/
28
- isWalletAddress(params: VerifyAddressOptions): Promise<boolean>;
34
+ isWalletAddress(params: TssVerifyAddressOptions): Promise<boolean>;
29
35
  /** @inheritDoc **/
30
36
  parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
31
37
  /** @inheritDoc **/
32
38
  verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
33
39
  /** @inheritDoc **/
34
40
  isValidAddress(address: string): boolean;
41
+ verifySignTransactionParams(params: SignTransactionOptions): VerifiedTransactionParameters;
35
42
  /** @inheritDoc **/
36
43
  signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
44
+ /**
45
+ * Retrieves the address format for the substrate coin.
46
+ *
47
+ * @returns {number} The address format as a number.
48
+ */
49
+ protected getAddressFormat(): number;
50
+ /**
51
+ * Retrieves the maximum validity duration in blocks.
52
+ *
53
+ * This method is intended to be overridden by subclasses to provide the specific
54
+ * maximum validity duration for different types of Substrate-based coins.
55
+ *
56
+ * @returns {number} The maximum validity duration in blocks.
57
+ * @throws {Error} If the method is not implemented by the subclass.
58
+ */
59
+ protected getMaxValidityDurationBlocks(): number;
60
+ protected getAddressFromPublicKey(Pubkey: string): string;
61
+ protected getInitializedNodeAPI(): Promise<ApiPromise>;
62
+ protected getAccountInfo(walletAddr: string): Promise<{
63
+ nonce: number;
64
+ freeBalance: number;
65
+ }>;
66
+ protected getFee(destAddr: string, srcAddr: string, amount: number): Promise<number>;
67
+ protected getHeaderInfo(): Promise<{
68
+ headerNumber: number;
69
+ headerHash: string;
70
+ }>;
71
+ protected getMaterial(): Promise<Material>;
72
+ /**
73
+ * Builds a funds recovery transaction without BitGo
74
+ * @param {MPCRecoveryOptions} params parameters needed to construct and
75
+ * (maybe) sign the transaction
76
+ *
77
+ * @returns {MPCTx} the serialized transaction hex string and index
78
+ * of the address being swept
79
+ */
80
+ recover(params: MPCRecoveryOptions): Promise<MPCTx | MPCSweepTxs>;
81
+ /**
82
+ * Builds native TAO recoveries of receive addresses in batch without BitGo.
83
+ * Funds will be recovered to base address first. You need to initiate another sweep txn after that.
84
+ *
85
+ * @param {MPCConsolidationRecoveryOptions} params - options for consolidation recovery.
86
+ * @param {string} [params.startingScanIndex] - receive address index to start scanning from. default to 1 (inclusive).
87
+ * @param {string} [params.endingScanIndex] - receive address index to end scanning at. default to startingScanIndex + 20 (exclusive).
88
+ */
89
+ recoverConsolidations(params: MPCConsolidationRecoveryOptions): Promise<MPCTxs | MPCSweepTxs>;
90
+ /** inherited doc */
91
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
92
+ /** inherited doc */
93
+ auditDecryptedKey({ publicKey, prv, multiSigType }: AuditDecryptedKeyParams): void;
37
94
  }
38
95
  //# 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,EACT,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAA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