@bitgo-beta/sdk-coin-dot 2.2.8-beta.1221 → 2.2.8-beta.1223

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 (88) hide show
  1. package/dist/src/dot.d.ts +154 -0
  2. package/dist/src/dot.d.ts.map +1 -0
  3. package/dist/src/dot.js +576 -0
  4. package/dist/src/index.d.ts +5 -0
  5. package/dist/src/index.d.ts.map +1 -0
  6. package/dist/src/index.js +21 -0
  7. package/dist/src/lib/addressInitializationBuilder.d.ts +79 -0
  8. package/dist/src/lib/addressInitializationBuilder.d.ts.map +1 -0
  9. package/dist/src/lib/addressInitializationBuilder.js +182 -0
  10. package/dist/src/lib/batchTransactionBuilder.d.ts +62 -0
  11. package/dist/src/lib/batchTransactionBuilder.d.ts.map +1 -0
  12. package/dist/src/lib/batchTransactionBuilder.js +229 -0
  13. package/dist/src/lib/claimBuilder.d.ts +58 -0
  14. package/dist/src/lib/claimBuilder.d.ts.map +1 -0
  15. package/dist/src/lib/claimBuilder.js +117 -0
  16. package/dist/src/lib/errors.d.ts +8 -0
  17. package/dist/src/lib/errors.d.ts.map +1 -0
  18. package/dist/src/lib/errors.js +19 -0
  19. package/dist/src/lib/iface.d.ts +337 -0
  20. package/dist/src/lib/iface.d.ts.map +1 -0
  21. package/dist/src/lib/iface.js +128 -0
  22. package/dist/src/lib/iface_utils.d.ts +59 -0
  23. package/dist/src/lib/iface_utils.d.ts.map +1 -0
  24. package/dist/src/lib/iface_utils.js +92 -0
  25. package/dist/src/lib/index.d.ts +19 -0
  26. package/dist/src/lib/index.d.ts.map +1 -0
  27. package/dist/src/lib/index.js +71 -0
  28. package/dist/src/lib/keyPair.d.ts +38 -0
  29. package/dist/src/lib/keyPair.d.ts.map +1 -0
  30. package/dist/src/lib/keyPair.js +117 -0
  31. package/dist/src/lib/nativeTransferBuilder.d.ts +84 -0
  32. package/dist/src/lib/nativeTransferBuilder.d.ts.map +1 -0
  33. package/dist/src/lib/nativeTransferBuilder.js +219 -0
  34. package/dist/src/lib/proxyBuilder.d.ts +54 -0
  35. package/dist/src/lib/proxyBuilder.d.ts.map +1 -0
  36. package/dist/src/lib/proxyBuilder.js +116 -0
  37. package/dist/src/lib/singletonRegistry.d.ts +7 -0
  38. package/dist/src/lib/singletonRegistry.d.ts.map +1 -0
  39. package/dist/src/lib/singletonRegistry.js +20 -0
  40. package/dist/src/lib/stakingBuilder.d.ts +66 -0
  41. package/dist/src/lib/stakingBuilder.d.ts.map +1 -0
  42. package/dist/src/lib/stakingBuilder.js +167 -0
  43. package/dist/src/lib/transaction.d.ts +83 -0
  44. package/dist/src/lib/transaction.d.ts.map +1 -0
  45. package/dist/src/lib/transaction.js +610 -0
  46. package/dist/src/lib/transactionBuilder.d.ts +131 -0
  47. package/dist/src/lib/transactionBuilder.d.ts.map +1 -0
  48. package/dist/src/lib/transactionBuilder.js +351 -0
  49. package/dist/src/lib/transactionBuilderFactory.d.ts +28 -0
  50. package/dist/src/lib/transactionBuilderFactory.d.ts.map +1 -0
  51. package/dist/src/lib/transactionBuilderFactory.js +104 -0
  52. package/dist/src/lib/transferBuilder.d.ts +11 -0
  53. package/dist/src/lib/transferBuilder.d.ts.map +1 -0
  54. package/dist/src/lib/transferBuilder.js +11 -0
  55. package/dist/src/lib/txnSchema.d.ts +15 -0
  56. package/dist/src/lib/txnSchema.d.ts.map +1 -0
  57. package/dist/src/lib/txnSchema.js +117 -0
  58. package/dist/src/lib/unnominateBuilder.d.ts +24 -0
  59. package/dist/src/lib/unnominateBuilder.d.ts.map +1 -0
  60. package/dist/src/lib/unnominateBuilder.js +48 -0
  61. package/dist/src/lib/unstakeBuilder.d.ts +38 -0
  62. package/dist/src/lib/unstakeBuilder.d.ts.map +1 -0
  63. package/dist/src/lib/unstakeBuilder.js +87 -0
  64. package/dist/src/lib/utils.d.ts +261 -0
  65. package/dist/src/lib/utils.d.ts.map +1 -0
  66. package/dist/src/lib/utils.js +488 -0
  67. package/dist/src/lib/withdrawUnstakedBuilder.d.ts +38 -0
  68. package/dist/src/lib/withdrawUnstakedBuilder.d.ts.map +1 -0
  69. package/dist/src/lib/withdrawUnstakedBuilder.js +88 -0
  70. package/dist/src/register.d.ts +3 -0
  71. package/dist/src/register.d.ts.map +1 -0
  72. package/dist/src/register.js +11 -0
  73. package/dist/src/resources/index.d.ts +4 -0
  74. package/dist/src/resources/index.d.ts.map +1 -0
  75. package/dist/src/resources/index.js +20 -0
  76. package/dist/src/resources/mainnet.d.ts +2 -0
  77. package/dist/src/resources/mainnet.d.ts.map +1 -0
  78. package/dist/src/resources/mainnet.js +5 -0
  79. package/dist/src/resources/westend.d.ts +2 -0
  80. package/dist/src/resources/westend.d.ts.map +1 -0
  81. package/dist/src/resources/westend.js +5 -0
  82. package/dist/src/resources/westendAssetHub.d.ts +2 -0
  83. package/dist/src/resources/westendAssetHub.d.ts.map +1 -0
  84. package/dist/src/resources/westendAssetHub.js +5 -0
  85. package/dist/src/tdot.d.ts +12 -0
  86. package/dist/src/tdot.d.ts.map +1 -0
  87. package/dist/src/tdot.js +27 -0
  88. package/package.json +6 -6
@@ -0,0 +1,154 @@
1
+ import { BaseCoin, BitGoBase, Eddsa, ExplanationResult, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions as BaseSignTransactionOptions, UnsignedTransaction, VerifyAddressOptions, VerifyTransactionOptions, MPCTx, MPCRecoveryOptions, MPCConsolidationRecoveryOptions, MPCSweepTxs, MPCSweepRecoveryOptions, MPCTxs, MultisigType, AuditDecryptedKeyParams } from '@bitgo-beta/sdk-core';
2
+ import { BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
3
+ import { Interface } from './lib';
4
+ import '@polkadot/api-augment';
5
+ import { ApiPromise } from '@polkadot/api';
6
+ import { Material } from './lib/iface';
7
+ export declare const DEFAULT_SCAN_FACTOR = 20;
8
+ export interface SignTransactionOptions extends BaseSignTransactionOptions {
9
+ txPrebuild: TransactionPrebuild;
10
+ prv: string;
11
+ }
12
+ export interface TransactionPrebuild {
13
+ txHex: string;
14
+ transaction: Interface.TxData;
15
+ }
16
+ export interface ExplainTransactionOptions {
17
+ txPrebuild: TransactionPrebuild;
18
+ publicKey: string;
19
+ feeInfo: {
20
+ fee: string;
21
+ };
22
+ }
23
+ export interface VerifiedTransactionParameters {
24
+ txHex: string;
25
+ prv: string;
26
+ }
27
+ export declare class Dot extends BaseCoin {
28
+ protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
29
+ readonly MAX_VALIDITY_DURATION = 2400;
30
+ readonly SWEEP_TXN_DURATION = 64;
31
+ constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
32
+ protected static initialized: boolean;
33
+ protected static MPC: Eddsa;
34
+ protected static nodeApiInitialized: boolean;
35
+ protected static API: ApiPromise;
36
+ static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
37
+ getChain(): string;
38
+ getBaseChain(): string;
39
+ getFamily(): string;
40
+ getFullName(): string;
41
+ getBaseFactor(): number;
42
+ /**
43
+ * Flag for sending value of 0
44
+ * @returns {boolean} True if okay to send 0 value, false otherwise
45
+ */
46
+ valuelessTransferAllowed(): boolean;
47
+ /** @inheritDoc */
48
+ supportsTss(): boolean;
49
+ /** inherited doc */
50
+ getDefaultMultisigType(): MultisigType;
51
+ getMPCAlgorithm(): MPCAlgorithm;
52
+ allowsAccountConsolidations(): boolean;
53
+ /**
54
+ * Generate ed25519 key pair
55
+ *
56
+ * @param seed
57
+ * @returns {Object} object with generated pub, prv
58
+ */
59
+ generateKeyPair(seed?: Buffer): KeyPair;
60
+ /**
61
+ * Return boolean indicating whether input is valid public key for the coin.
62
+ *
63
+ * @param {String} pub the pub to be checked
64
+ * @returns {Boolean} is it valid?
65
+ */
66
+ isValidPub(pub: string): boolean;
67
+ /**
68
+ * Return boolean indicating whether the supplied private key is a valid dot private key
69
+ *
70
+ * @param {String} prv the prv to be checked
71
+ * @returns {Boolean} is it valid?
72
+ */
73
+ isValidPrv(prv: string): boolean;
74
+ /**
75
+ * Return boolean indicating whether input is valid public key for the coin
76
+ *
77
+ * @param {String} address the pub to be checked
78
+ * @returns {Boolean} is it valid?
79
+ */
80
+ isValidAddress(address: string): boolean;
81
+ /**
82
+ * Sign message with private key
83
+ *
84
+ * @param key
85
+ * @param message
86
+ * @return {Buffer} A signature over the given message using the given key
87
+ */
88
+ signMessage(key: KeyPair, message: string | Buffer): Promise<Buffer>;
89
+ /**
90
+ * Explain/parse transaction
91
+ * @param unsignedTransaction
92
+ */
93
+ explainTransaction(unsignedTransaction: UnsignedTransaction): Promise<ExplanationResult>;
94
+ verifySignTransactionParams(params: SignTransactionOptions): VerifiedTransactionParameters;
95
+ /**
96
+ * Assemble keychain and half-sign prebuilt transaction
97
+ *
98
+ * @param params
99
+ * @param params.txPrebuild {TransactionPrebuild} prebuild object returned by platform
100
+ * @param params.prv {String} user prv
101
+ * @returns {Promise<SignedTransaction>}
102
+ */
103
+ signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
104
+ protected getInitializedNodeAPI(): Promise<ApiPromise>;
105
+ protected getAccountInfo(walletAddr: string): Promise<{
106
+ nonce: number;
107
+ freeBalance: number;
108
+ }>;
109
+ protected getHeaderInfo(): Promise<{
110
+ headerNumber: number;
111
+ headerHash: string;
112
+ }>;
113
+ /**
114
+ *
115
+ * Estimate the fee of the transaction
116
+ *
117
+ * @param {string} destAddr destination wallet address
118
+ * @param {string} srcAddr source wallet address
119
+ * @param {string} amount amount to transfer
120
+ * @returns {number} the estimated fee the transaction will cost
121
+ *
122
+ * @see https://polkadot.js.org/docs/api/cookbook/tx#how-do-i-estimate-the-transaction-fees
123
+ */
124
+ protected getFee(destAddr: string, srcAddr: string, amount: number): Promise<number>;
125
+ protected getMaterial(): Promise<Material>;
126
+ /**
127
+ * Builds a funds recovery transaction without BitGo
128
+ * @param {MPCRecoveryOptions} params parameters needed to construct and
129
+ * (maybe) sign the transaction
130
+ *
131
+ * @returns {MPCTx} the serialized transaction hex string and index
132
+ * of the address being swept
133
+ */
134
+ recover(params: MPCRecoveryOptions): Promise<MPCTx | MPCSweepTxs>;
135
+ /**
136
+ * Builds native DOT recoveries of receive addresses in batch without BitGo.
137
+ * Funds will be recovered to base address first. You need to initiate another sweep txn after that.
138
+ *
139
+ * @param {MPCConsolidationRecoveryOptions} params - options for consolidation recovery.
140
+ * @param {string} [params.startingScanIndex] - receive address index to start scanning from. default to 1 (inclusive).
141
+ * @param {string} [params.endingScanIndex] - receive address index to end scanning at. default to startingScanIndex + 20 (exclusive).
142
+ */
143
+ recoverConsolidations(params: MPCConsolidationRecoveryOptions): Promise<MPCTxs | MPCSweepTxs>;
144
+ /** inherited doc */
145
+ createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
146
+ parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
147
+ isWalletAddress(params: VerifyAddressOptions): Promise<boolean>;
148
+ verifyTransaction(params: VerifyTransactionOptions): Promise<boolean>;
149
+ getAddressFromPublicKey(Pubkey: string): string;
150
+ private getBuilder;
151
+ /** @inheritDoc */
152
+ auditDecryptedKey({ publicKey, prv, multiSigType }: AuditDecryptedKeyParams): void;
153
+ }
154
+ //# sourceMappingURL=dot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot.d.ts","sourceRoot":"","sources":["../../src/dot.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,SAAS,EAET,KAAK,EAEL,iBAAiB,EACjB,OAAO,EAEP,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,IAAI,0BAA0B,EACpD,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EAGxB,KAAK,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,WAAW,EAGX,uBAAuB,EACvB,MAAM,EACN,YAAY,EAEZ,uBAAuB,EACxB,MAAM,sBAAsB,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