@bitgo-beta/sdk-coin-atom 1.1.2-alpha.9 → 3.1.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,37 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.1.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/sdk-coin-atom@3.1.0...@bitgo/sdk-coin-atom@3.1.1) (2023-04-25)
7
+
8
+ **Note:** Version bump only for package @bitgo/sdk-coin-atom
9
+
10
+ # [3.1.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/sdk-coin-atom@3.0.0...@bitgo/sdk-coin-atom@3.1.0) (2023-04-20)
11
+
12
+ ### Features
13
+
14
+ - **sdk-coin-atom:** add memo support for atom ([0287361](https://github.com/BitGo/BitGoJS/commit/0287361265de70a57c833f0ec1598648a88f1c24))
15
+
16
+ # [3.0.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/sdk-coin-atom@2.1.0...@bitgo/sdk-coin-atom@3.0.0) (2023-04-13)
17
+
18
+ ### Bug Fixes
19
+
20
+ - **sdk-coin-atom:** allow transaction creation from both Hex and Base64 ([91fae07](https://github.com/BitGo/BitGoJS/commit/91fae072387bcf79d571ce7537b2de42e8ed1166))
21
+ - **sdk-coin-atom:** fix getAddress of KeyPair ([b966658](https://github.com/BitGo/BitGoJS/commit/b9666588cc0f5f6965f57af50e0c0da5dfe0cc2b))
22
+ - **sdk-core:** add new function in BaseCoin to get hash-function ([e028b31](https://github.com/BitGo/BitGoJS/commit/e028b31b3954810ee6c3fd7fdfa6ed4a07aa458e))
23
+
24
+ ### Features
25
+
26
+ - **sdk-coin-atom:** add function to load inputs and outputs of a transaction ([c3e3c1d](https://github.com/BitGo/BitGoJS/commit/c3e3c1d0632f5f7490f1aad6c0d1042533f222ab))
27
+ - **sdk-coin-atom:** add staking transaction builders ([5fe2e35](https://github.com/BitGo/BitGoJS/commit/5fe2e3589b1ac47031d82e1869dff1e676a4f318))
28
+ - **sdk-coin-atom:** add support to serialise unsigned txn ([f46c31b](https://github.com/BitGo/BitGoJS/commit/f46c31b3a22096b193e521d259fdc8f5c030ab02))
29
+ - **sdk-coin-atom:** implement isValidAddress for atom ([2fb8a93](https://github.com/BitGo/BitGoJS/commit/2fb8a93f05f024e12b72c7ee85ec8563a2e65275))
30
+ - **sdk-coin-atom:** implement remaining methods ([7c03501](https://github.com/BitGo/BitGoJS/commit/7c035019c76a1bbf4fbaa3da7e5823823637d2be))
31
+
32
+ ### BREAKING CHANGES
33
+
34
+ - **sdk-coin-atom:** type MessageData is changed
35
+ - **sdk-coin-atom:** Renamed type interface GasFeeLimitData to FeeData and parameter gas to gasLimit
36
+
6
37
  # [2.1.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/sdk-coin-atom@2.0.0...@bitgo/sdk-coin-atom@2.1.0) (2023-02-17)
7
38
 
8
39
  ### Features
@@ -1,6 +1,30 @@
1
1
  /// <reference types="node" />
2
2
  import { BaseCoin, BitGoBase, ExplanationResult, KeyPair, MPCAlgorithm, ParsedTransaction, ParseTransactionOptions, SignedTransaction, SignTransactionOptions, VerifyAddressOptions, VerifyTransactionOptions } from '@bitgo-beta/sdk-core';
3
3
  import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo-beta/statics';
4
+ import { Hash } from 'crypto';
5
+ import { TransactionBuilderFactory } from './lib/transactionBuilderFactory';
6
+ import * as request from 'superagent';
7
+ /**
8
+ * Atom accounts support memo Id based addresses
9
+ */
10
+ interface AddressDetails {
11
+ address: string;
12
+ memoId?: string | undefined;
13
+ }
14
+ interface RecoveryOptions {
15
+ userKey?: string;
16
+ backupKey?: string;
17
+ bitgoKey: string;
18
+ recoveryDestination: string;
19
+ krsProvider?: string;
20
+ walletPassphrase?: string;
21
+ startingScanIndex?: number;
22
+ scan?: number;
23
+ }
24
+ interface AtomTx {
25
+ serializedTx: string;
26
+ scanIndex: number;
27
+ }
4
28
  export declare class Atom extends BaseCoin {
5
29
  protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
6
30
  protected constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
@@ -21,6 +45,7 @@ export declare class Atom extends BaseCoin {
21
45
  isValidPub(pub: string): boolean;
22
46
  /** @inheritDoc **/
23
47
  isValidPrv(prv: string): boolean;
48
+ getBuilder(): TransactionBuilderFactory;
24
49
  /** @inheritDoc **/
25
50
  isValidAddress(address: string): boolean;
26
51
  /** @inheritDoc **/
@@ -46,7 +71,63 @@ export declare class Atom extends BaseCoin {
46
71
  };
47
72
  prv: string;
48
73
  }): Promise<SignedTransaction>;
74
+ /**
75
+ * Builds a funds recovery transaction without BitGo
76
+ * @param {RecoveryOptions} params parameters needed to construct and
77
+ * (maybe) sign the transaction
78
+ *
79
+ * @returns {AtomTx} the serialized transaction hex string and index
80
+ * of the address being swept
81
+ */
82
+ recover(params: RecoveryOptions): Promise<AtomTx>;
83
+ /**
84
+ * Get balance from public node
85
+ */
86
+ protected getBalanceFromNode(senderAddress: string): Promise<request.Response>;
87
+ /**
88
+ * Helper to fetch chainId
89
+ */
90
+ protected getChainId(): Promise<string>;
91
+ /**
92
+ * Get chain id from public node
93
+ */
94
+ protected getChainIdFromNode(): Promise<request.Response>;
95
+ /**
96
+ * Helper to fetch account number
97
+ */
98
+ protected getAccountDetails(senderAddress: string): Promise<string[]>;
99
+ /**
100
+ * Get account number from public node
101
+ */
102
+ protected getAccountFromNode(senderAddress: string): Promise<request.Response>;
103
+ /**
104
+ * Helper to fetch account balance
105
+ */
106
+ protected getAccountBalance(senderAddress: string): Promise<string>;
107
+ /**
108
+ * Get the public node url from the Environments constant we have defined
109
+ */
110
+ protected getPublicNodeUrl(): string;
111
+ getAddressFromPublicKey(pubKey: string): string;
49
112
  /** @inheritDoc **/
50
113
  isWalletAddress(params: VerifyAddressOptions): Promise<boolean>;
114
+ getHashFunction(): Hash;
115
+ /**
116
+ * Process address into address and memo id
117
+ *
118
+ * @param address the address
119
+ * @returns object containing address and memo id
120
+ */
121
+ getAddressDetails(address: string): AddressDetails;
122
+ /**
123
+ * Return boolean indicating whether a memo id is valid
124
+ *
125
+ * @param memoId memo id
126
+ * @returns true if memo id is valid
127
+ */
128
+ isValidMemoId(memoId: string): boolean;
129
+ private getKeyCombinedFromTssKeyShares;
130
+ private signRecoveryTSS;
51
131
  }
132
+ export {};
52
133
  //# sourceMappingURL=atom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"atom.d.ts","sourceRoot":"","sources":["../../src/atom.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EAEjB,sBAAsB,EAEtB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,UAAU,EAAS,MAAM,qBAAqB,CAAC;AASrF,qBAAa,IAAK,SAAQ,QAAQ;IAChC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC3D,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;IAI1F,mBAAmB;IACnB,aAAa,IAAI,MAAM,GAAG,MAAM;IAIhC,mBAAmB;IACnB,QAAQ,IAAI,MAAM;IAIlB,mBAAmB;IACnB,SAAS,IAAI,UAAU;IAIvB,mBAAmB;IACnB,WAAW,IAAI,MAAM;IAIrB,kBAAkB;IAClB,WAAW,IAAI,OAAO;IAItB,mBAAmB;IACnB,eAAe,IAAI,YAAY;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