@bitgo-beta/sdk-coin-polygon 1.3.3-alpha.45 → 1.3.3-alpha.450

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 (57) hide show
  1. package/dist/src/index.js +6 -2
  2. package/dist/src/lib/index.d.ts +2 -1
  3. package/dist/src/lib/index.d.ts.map +1 -1
  4. package/dist/src/lib/index.js +30 -12
  5. package/dist/src/lib/resources.d.ts.map +1 -1
  6. package/dist/src/lib/resources.js +8 -4
  7. package/dist/src/lib/transactionBuilder.d.ts +11 -8
  8. package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
  9. package/dist/src/lib/transactionBuilder.js +21 -21
  10. package/dist/src/lib/transferBuilder.d.ts +1 -1
  11. package/dist/src/lib/transferBuilder.js +3 -3
  12. package/dist/src/lib/utils.d.ts +1 -1
  13. package/dist/src/lib/utils.js +6 -6
  14. package/dist/src/polygon.d.ts +23 -63
  15. package/dist/src/polygon.d.ts.map +1 -1
  16. package/dist/src/polygon.js +26 -392
  17. package/dist/src/polygonToken.d.ts +15 -24
  18. package/dist/src/polygonToken.d.ts.map +1 -1
  19. package/dist/src/polygonToken.js +31 -59
  20. package/dist/src/tpolygon.d.ts +0 -1
  21. package/dist/src/tpolygon.d.ts.map +1 -1
  22. package/dist/src/tpolygon.js +1 -4
  23. package/dist/test/fixtures/polygon.d.ts +151 -0
  24. package/dist/test/fixtures/polygon.d.ts.map +1 -0
  25. package/dist/test/fixtures/polygon.js +233 -0
  26. package/dist/test/getBuilder.d.ts +3 -0
  27. package/dist/test/getBuilder.d.ts.map +1 -0
  28. package/dist/test/getBuilder.js +9 -0
  29. package/dist/test/resources.d.ts +27 -0
  30. package/dist/test/resources.d.ts.map +1 -0
  31. package/dist/test/resources.js +41 -0
  32. package/dist/test/unit/polygon.d.ts +2 -0
  33. package/dist/test/unit/polygon.d.ts.map +1 -0
  34. package/dist/test/unit/polygon.js +1202 -0
  35. package/dist/test/unit/polygonToken.d.ts +2 -0
  36. package/dist/test/unit/polygonToken.d.ts.map +1 -0
  37. package/dist/test/unit/polygonToken.js +62 -0
  38. package/dist/test/unit/transaction.d.ts +2 -0
  39. package/dist/test/unit/transaction.d.ts.map +1 -0
  40. package/dist/test/unit/transaction.js +92 -0
  41. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts +2 -0
  42. package/dist/test/unit/transactionBuilder/addressInitialization.d.ts.map +1 -0
  43. package/dist/test/unit/transactionBuilder/addressInitialization.js +104 -0
  44. package/dist/test/unit/transactionBuilder/flushTokens.d.ts +2 -0
  45. package/dist/test/unit/transactionBuilder/flushTokens.d.ts.map +1 -0
  46. package/dist/test/unit/transactionBuilder/flushTokens.js +9 -0
  47. package/dist/test/unit/transactionBuilder/send.d.ts +2 -0
  48. package/dist/test/unit/transactionBuilder/send.d.ts.map +1 -0
  49. package/dist/test/unit/transactionBuilder/send.js +114 -0
  50. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts +2 -0
  51. package/dist/test/unit/transactionBuilder/walletInitialization.d.ts.map +1 -0
  52. package/dist/test/unit/transactionBuilder/walletInitialization.js +169 -0
  53. package/dist/tsconfig.tsbuildinfo +1 -0
  54. package/package.json +20 -19
  55. package/.eslintignore +0 -5
  56. package/.mocharc.yml +0 -8
  57. package/CHANGELOG.md +0 -102
@@ -1,81 +1,41 @@
1
- /// <reference types="node" />
2
- import { ExplainTransactionOptions } from '@bitgo-beta/abstract-eth';
3
- import { Eth, Recipient, GetSendMethodArgsOptions, SendMethodArgs, BuildTransactionParams, SignFinalOptions, SignTransactionOptions, SignedTransaction, RecoverOptions, RecoveryInfo, OfflineVaultTxInfo } from '@bitgo-beta/sdk-coin-eth';
4
- import { BaseCoin, BitGoBase, TransactionExplanation, FullySignedTransaction, MPCAlgorithm } from '@bitgo-beta/sdk-core';
1
+ /**
2
+ * @prettier
3
+ */
4
+ import { AbstractEthLikeNewCoins } from '@bitgo-beta/abstract-eth';
5
+ import { BaseCoin, BitGoBase, MPCAlgorithm, MultisigType } from '@bitgo-beta/sdk-core';
5
6
  import { BaseCoin as StaticsBaseCoin } from '@bitgo-beta/statics';
6
7
  import { TransactionBuilder } from './lib';
7
- import type * as EthTxLib from '@ethereumjs/tx';
8
- export declare class Polygon extends Eth {
9
- protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
10
- protected readonly sendMethodName: 'sendMultiSig' | 'sendMultiSigToken';
8
+ import { UnsignedSweepTxMPCv2, RecoverOptions, OfflineVaultTxInfo } from '../../abstract-eth/src/abstractEthLikeNewCoins';
9
+ export declare class Polygon extends AbstractEthLikeNewCoins {
11
10
  protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
12
- static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
13
- static getCustomChainName(chainId?: number): string;
14
- static buildTransaction(params: BuildTransactionParams): EthTxLib.FeeMarketEIP1559Transaction | EthTxLib.Transaction;
15
- getChain(): string;
16
- getFamily(): string;
17
- getFullName(): string;
18
11
  /**
19
- * Get the base chain that the coin exists on.
12
+ * Builds an unsigned sweep transaction for TSS
13
+ * @param params - Recovery options
14
+ * @returns {Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>}
20
15
  */
21
- getBaseChain(): string;
22
- isValidPub(pub: string): boolean;
23
- /** @inheritDoc */
24
- explainTransaction(options: ExplainTransactionOptions): Promise<TransactionExplanation>;
16
+ protected buildUnsignedSweepTxnTSS(params: RecoverOptions): Promise<OfflineVaultTxInfo | UnsignedSweepTxMPCv2>;
17
+ static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
25
18
  /**
26
19
  * Create a new transaction builder for the current chain
27
20
  * @return a new transaction builder
28
21
  */
29
- getTransactionBuilder(): TransactionBuilder;
30
- /**
31
- * Get transfer operation for coin
32
- * @param recipient recipient info
33
- * @param expireTime expiry time
34
- * @param contractSequenceId sequence id
35
- * @returns {Array} operation array
36
- */
37
- getOperation(recipient: Recipient, expireTime: number, contractSequenceId: number): (string | Buffer)[][];
38
- /**
39
- * Build arguments to call the send method on the wallet contract
40
- * @param txInfo
41
- */
42
- getSendMethodArgs(txInfo: GetSendMethodArgsOptions): SendMethodArgs[];
43
- /**
44
- * Helper function for signTransaction for the rare case that SDK is doing the second signature
45
- * Note: we are expecting this to be called from the offline vault
46
- * @param params.txPrebuild
47
- * @param params.prv
48
- * @returns {{txHex: string}}
49
- */
50
- signFinalPolygon(params: SignFinalOptions): Promise<FullySignedTransaction>;
22
+ protected getTransactionBuilder(): TransactionBuilder;
51
23
  /**
52
- * Assemble half-sign prebuilt transaction
53
- * @param params
54
- */
55
- signTransaction(params: SignTransactionOptions): Promise<SignedTransaction>;
56
- /**
57
- * Make a query to Polygonscan for information such as balance, token balance, solidity calls
24
+ * Make a query to Polygon explorer for information such as balance, token balance, solidity calls
58
25
  * @param {Object} query key-value pairs of parameters to append after /api
59
- * @returns {Promise<Object>} response from Polygonscan
26
+ * @param {string} apiKey optional API key to use instead of the one from the environment
27
+ * @returns {Promise<Object>} response from Polygon
60
28
  */
61
- recoveryBlockchainExplorerQuery(query: Record<string, string>): Promise<any>;
62
- /**
63
- * Builds a funds recovery transaction without BitGo for non-TSS transaction
64
- * @param params
65
- * @param {String} params.userKey [encrypted] xprv or xpub
66
- * @param {String} params.backupKey [encrypted] xprv or xpub if the xprv is held by a KRS provider
67
- * @param {String} params.walletPassphrase used to decrypt userKey and backupKey
68
- * @param {String} params.walletContractAddress the Polygon address of the wallet contract
69
- * @param {String} params.krsProvider necessary if backup key is held by KRS
70
- * @param {String} params.recoveryDestination target address to send recovered funds to
71
- * @returns {Promise<RecoveryInfo | OfflineVaultTxInfo>}
72
- */
73
- recoverEthLike(params: RecoverOptions): Promise<RecoveryInfo | OfflineVaultTxInfo>;
74
- /** @inheritDoc */
75
- supportsTss(): boolean;
29
+ recoveryBlockchainExplorerQuery(query: Record<string, string>, apiKey?: string): Promise<Record<string, unknown>>;
76
30
  /** @inheritDoc */
77
31
  supportsMessageSigning(): boolean;
78
32
  /** @inheritDoc */
33
+ supportsSigningTypedData(): boolean;
34
+ /** @inheritDoc */
35
+ supportsTss(): boolean;
36
+ /** inherited doc */
37
+ getDefaultMultisigType(): MultisigType;
38
+ /** @inheritDoc */
79
39
  getMPCAlgorithm(): MPCAlgorithm;
80
40
  }
81
41
  //# sourceMappingURL=polygon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../src/polygon.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,GAAG,EACH,SAAS,EACT,wBAAwB,EACxB,cAAc,EAEd,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,QAAQ,EACR,SAAS,EAET,sBAAsB,EACtB,sBAAsB,EAGtB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAS,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAW,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAEhD,qBAAa,OAAQ,SAAQ,GAAG;IAC9B,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC3D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,mBAAmB,CAAC;IAExE,SAAS,aAAa,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;IAU/E,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,QAAQ;IAG1F,M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