@bitgo/sdk-coin-stx 3.8.13 → 3.8.15
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 +8 -0
- package/package.json +6 -6
- package/LICENSE +0 -191
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -46
- package/dist/src/lib/abstractContractBuilder.d.ts +0 -19
- package/dist/src/lib/abstractContractBuilder.d.ts.map +0 -1
- package/dist/src/lib/abstractContractBuilder.js +0 -70
- package/dist/src/lib/constants.d.ts +0 -9
- package/dist/src/lib/constants.d.ts.map +0 -1
- package/dist/src/lib/constants.js +0 -21
- package/dist/src/lib/contractBuilder.d.ts +0 -33
- package/dist/src/lib/contractBuilder.d.ts.map +0 -1
- package/dist/src/lib/contractBuilder.js +0 -116
- package/dist/src/lib/fungibleTokenTransferBuilder.d.ts +0 -62
- package/dist/src/lib/fungibleTokenTransferBuilder.d.ts.map +0 -1
- package/dist/src/lib/fungibleTokenTransferBuilder.js +0 -131
- package/dist/src/lib/iface.d.ts +0 -104
- package/dist/src/lib/iface.d.ts.map +0 -1
- package/dist/src/lib/iface.js +0 -3
- package/dist/src/lib/index.d.ts +0 -6
- package/dist/src/lib/index.d.ts.map +0 -1
- package/dist/src/lib/index.js +0 -47
- package/dist/src/lib/keyPair.d.ts +0 -55
- package/dist/src/lib/keyPair.d.ts.map +0 -1
- package/dist/src/lib/keyPair.js +0 -119
- package/dist/src/lib/sendmanyBuilder.d.ts +0 -23
- package/dist/src/lib/sendmanyBuilder.d.ts.map +0 -1
- package/dist/src/lib/sendmanyBuilder.js +0 -75
- package/dist/src/lib/transaction.d.ts +0 -49
- package/dist/src/lib/transaction.d.ts.map +0 -1
- package/dist/src/lib/transaction.js +0 -241
- package/dist/src/lib/transactionBuilder.d.ts +0 -86
- package/dist/src/lib/transactionBuilder.d.ts.map +0 -1
- package/dist/src/lib/transactionBuilder.js +0 -263
- package/dist/src/lib/transactionBuilderFactory.d.ts +0 -32
- package/dist/src/lib/transactionBuilderFactory.d.ts.map +0 -1
- package/dist/src/lib/transactionBuilderFactory.js +0 -88
- package/dist/src/lib/transferBuilder.d.ts +0 -30
- package/dist/src/lib/transferBuilder.d.ts.map +0 -1
- package/dist/src/lib/transferBuilder.js +0 -99
- package/dist/src/lib/utils.d.ts +0 -230
- package/dist/src/lib/utils.d.ts.map +0 -1
- package/dist/src/lib/utils.js +0 -582
- package/dist/src/register.d.ts +0 -3
- package/dist/src/register.d.ts.map +0 -1
- package/dist/src/register.js +0 -15
- package/dist/src/sip10Token.d.ts +0 -22
- package/dist/src/sip10Token.d.ts.map +0 -1
- package/dist/src/sip10Token.js +0 -128
- package/dist/src/stx.d.ts +0 -200
- package/dist/src/stx.d.ts.map +0 -1
- package/dist/src/stx.js +0 -605
- package/dist/src/tstx.d.ts +0 -16
- package/dist/src/tstx.d.ts.map +0 -1
- package/dist/src/tstx.js +0 -24
- package/dist/src/types.d.ts +0 -34
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -3
package/dist/src/lib/utils.d.ts
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { AddressHashMode, AddressVersion, ClarityValue, StacksTransaction } from '@stacks/transactions';
|
|
2
|
-
import { AddressDetails, SendParams, TokenTransferParams } from './iface';
|
|
3
|
-
import { KeyPair } from '.';
|
|
4
|
-
import { StacksNetwork as BitgoStacksNetwork } from '@bitgo/statics';
|
|
5
|
-
/**
|
|
6
|
-
* Encodes a buffer as a "0x" prefixed lower-case hex string.
|
|
7
|
-
*
|
|
8
|
-
* @param {Buffer} buff - a buffer with a hexadecimal string
|
|
9
|
-
* @returns {string} - the hexadecimal string prefixed with "0x"
|
|
10
|
-
*/
|
|
11
|
-
export declare function bufferToHexPrefixString(buff: Buffer): string;
|
|
12
|
-
/**
|
|
13
|
-
* Remove the "0x" prefix from the given string, if present.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} hex - a hexadecimal string
|
|
16
|
-
* @returns {string} - the hexadecimal string without a leading "0x"
|
|
17
|
-
*/
|
|
18
|
-
export declare function removeHexPrefix(hex: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* @param tx
|
|
21
|
-
*/
|
|
22
|
-
export declare function getTxSenderAddress(tx: StacksTransaction): string;
|
|
23
|
-
/**
|
|
24
|
-
* Returns whether or not the string is a valid amount number
|
|
25
|
-
*
|
|
26
|
-
* @param {string} amount - the string to validate
|
|
27
|
-
* @returns {boolean} - the validation result
|
|
28
|
-
*/
|
|
29
|
-
export declare function isValidAmount(amount: string): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Returns whether or not the string is a valid protocol address
|
|
32
|
-
*
|
|
33
|
-
* @param {string} address - the address to be validated
|
|
34
|
-
* @returns {boolean} - the validation result
|
|
35
|
-
*/
|
|
36
|
-
export declare function isValidAddress(address: string): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Returns whether or not the string is a valid protocol transaction id or not.
|
|
39
|
-
*
|
|
40
|
-
* A valid transaction id is a SHA-512/256 hash of a serialized transaction; see
|
|
41
|
-
* the txidFromData function in @stacks/transaction:
|
|
42
|
-
* https://github.com/blockstack/stacks.js/blob/master/packages/transactions/src/utils.ts#L97
|
|
43
|
-
*
|
|
44
|
-
* @param {string} txId - the transaction id to be validated
|
|
45
|
-
* @returns {boolean} - the validation result
|
|
46
|
-
*/
|
|
47
|
-
export declare function isValidTransactionId(txId: string): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Returns whether or not the string is a valid protocol public key or
|
|
50
|
-
* extended public key.
|
|
51
|
-
*
|
|
52
|
-
* The key format is documented at
|
|
53
|
-
* https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md#transaction-authorization
|
|
54
|
-
*
|
|
55
|
-
* @param {string} pub - the public key to be validated
|
|
56
|
-
* @returns {boolean} - the validation result
|
|
57
|
-
*/
|
|
58
|
-
export declare function isValidPublicKey(pub: string): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Returns whether or not the string is a valid protocol private key, or extended
|
|
61
|
-
* private key.
|
|
62
|
-
*
|
|
63
|
-
* The protocol key format is described in the @stacks/transactions npm package, in the
|
|
64
|
-
* createStacksPrivateKey function:
|
|
65
|
-
* https://github.com/blockstack/stacks.js/blob/master/packages/transactions/src/keys.ts#L125
|
|
66
|
-
*
|
|
67
|
-
* @param {string} prv - the private key (or extended private key) to be validated
|
|
68
|
-
* @returns {boolean} - the validation result
|
|
69
|
-
*/
|
|
70
|
-
export declare function isValidPrivateKey(prv: string): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Checks if raw transaction can be deserialized
|
|
73
|
-
*
|
|
74
|
-
* @param {unknown} rawTransaction - transaction in raw hex format
|
|
75
|
-
* @returns {boolean} - the validation result
|
|
76
|
-
*/
|
|
77
|
-
export declare function isValidRawTransaction(rawTransaction: unknown): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Returns whether or not the memo string is valid
|
|
80
|
-
*
|
|
81
|
-
* @param {string} memo - the string to be validated
|
|
82
|
-
* @returns {boolean} - the validation result
|
|
83
|
-
*/
|
|
84
|
-
export declare function isValidMemo(memo: string): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Checks for valid contract address
|
|
87
|
-
*
|
|
88
|
-
* @param {string} addr - contract deployer address
|
|
89
|
-
* @param {BitgoStacksNetwork} network - network object
|
|
90
|
-
* @returns {boolean} - the validation result
|
|
91
|
-
*/
|
|
92
|
-
export declare function isValidContractAddress(addr: string, network: BitgoStacksNetwork): boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Check if the name is one of valid contract names
|
|
95
|
-
*
|
|
96
|
-
* @param {string} name - function name
|
|
97
|
-
* @returns {boolean} - validation result
|
|
98
|
-
*/
|
|
99
|
-
export declare function isValidContractFunctionName(name: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Unpads a memo string, so it removes nulls.
|
|
102
|
-
*
|
|
103
|
-
* Useful when memo is fill up the length. Result is becomes readable.
|
|
104
|
-
*
|
|
105
|
-
* @param {string} memo - the string to be validated
|
|
106
|
-
* @returns {boolean} - the validation result
|
|
107
|
-
*/
|
|
108
|
-
export declare function unpadMemo(memo: string): string;
|
|
109
|
-
/**
|
|
110
|
-
* Generate a multisig address from multiple STX public keys
|
|
111
|
-
*
|
|
112
|
-
* @param {string[]} pubKeys - list of public keys as strings
|
|
113
|
-
* @param {AddressVersion} addressVersion - MainnetMultiSig, TestnetMultiSig
|
|
114
|
-
* @param {AddressHashMode} addressHashMode - SerializeP2SH
|
|
115
|
-
* @param {number} [signaturesRequired] - number of signatures required, default value its 2
|
|
116
|
-
* @returns {address: string, hash160: string} - a multisig address
|
|
117
|
-
*/
|
|
118
|
-
export declare function getSTXAddressFromPubKeys(pubKeys: string[], addressVersion?: AddressVersion, addressHashMode?: AddressHashMode, signaturesRequired?: number): {
|
|
119
|
-
address: string;
|
|
120
|
-
hash160: string;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* signs a string message
|
|
124
|
-
*
|
|
125
|
-
* @param keyPair
|
|
126
|
-
* @param data - message to be signed
|
|
127
|
-
* @returns signed message string
|
|
128
|
-
*/
|
|
129
|
-
export declare function signMessage(keyPair: KeyPair, data: string): string;
|
|
130
|
-
/**
|
|
131
|
-
* Verifies a signed message
|
|
132
|
-
*
|
|
133
|
-
* The signature must be 130 bytes long -- see RECOVERABLE_ECDSA_SIG_LENGTH_BYTES
|
|
134
|
-
* in @stacks/transactions/src/constants.ts
|
|
135
|
-
*
|
|
136
|
-
* @param {string} message - message to verify the signature
|
|
137
|
-
* @param {string} signature - signature to verify
|
|
138
|
-
* @param {string} publicKey - public key as hex string used to verify the signature
|
|
139
|
-
* @returns {boolean} - verification result
|
|
140
|
-
*/
|
|
141
|
-
export declare function verifySignature(message: string, signature: string, publicKey: string): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Process address into address and memo id
|
|
144
|
-
*
|
|
145
|
-
* @param {string} address the address to process
|
|
146
|
-
* @returns {Object} object containing address and memo id
|
|
147
|
-
*/
|
|
148
|
-
export declare function getAddressDetails(address: string): AddressDetails;
|
|
149
|
-
/**
|
|
150
|
-
* Validate and return address with appended memo id
|
|
151
|
-
*
|
|
152
|
-
* @param {AddressDetails} addressDetails
|
|
153
|
-
* @returns {string} address with memo id
|
|
154
|
-
*/
|
|
155
|
-
export declare function normalizeAddress({ address, memoId }: AddressDetails): string;
|
|
156
|
-
/**
|
|
157
|
-
* Return boolean indicating whether input is a valid address with memo id
|
|
158
|
-
*
|
|
159
|
-
* @param {string} address address in the form <address>?memoId=<memoId>
|
|
160
|
-
* @returns {boolean} true is input is a valid address
|
|
161
|
-
*/
|
|
162
|
-
export declare function isValidAddressWithPaymentId(address: string): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Return string representation of clarity value input
|
|
165
|
-
*
|
|
166
|
-
* @param {ClarityValue} cv clarity value function argument
|
|
167
|
-
* @returns {String} stringified clarity value
|
|
168
|
-
*/
|
|
169
|
-
export declare function stringifyCv(cv: ClarityValue): any;
|
|
170
|
-
/**
|
|
171
|
-
* Parse functionArgs into send params for send-many-memo contract calls
|
|
172
|
-
*
|
|
173
|
-
* @param {ClarityValue[]} args functionArgs from a contract call payload
|
|
174
|
-
* @returns {SendParams[]} An array of sendParams
|
|
175
|
-
*/
|
|
176
|
-
export declare function functionArgsToSendParams(args: ClarityValue[]): SendParams[];
|
|
177
|
-
export declare function functionArgsToTokenTransferParams(args: ClarityValue[]): TokenTransferParams;
|
|
178
|
-
/**
|
|
179
|
-
* Gets the version of an address
|
|
180
|
-
*
|
|
181
|
-
* @param {String} address the address with or without the memoId
|
|
182
|
-
* @returns {AddressVersion} A number that represent the Address Version
|
|
183
|
-
*/
|
|
184
|
-
export declare function getAddressVersion(address: string): AddressVersion;
|
|
185
|
-
/**
|
|
186
|
-
* Returns a STX pub key from an xpub
|
|
187
|
-
*
|
|
188
|
-
* @param {String} xpub an xpub
|
|
189
|
-
* @returns {String} a compressed STX pub key
|
|
190
|
-
*/
|
|
191
|
-
export declare function xpubToSTXPubkey(xpub: string, compressed?: boolean): string;
|
|
192
|
-
/**
|
|
193
|
-
* Returns the base address portion of an address
|
|
194
|
-
*
|
|
195
|
-
* @param {String} address - an address
|
|
196
|
-
* @returns {String} - the base address
|
|
197
|
-
*/
|
|
198
|
-
export declare function getBaseAddress(address: string): string;
|
|
199
|
-
/**
|
|
200
|
-
* Compares an address to the base address to check if matchs.
|
|
201
|
-
*
|
|
202
|
-
* @param {String} address - an address
|
|
203
|
-
* @param {String} baseAddress - a base address
|
|
204
|
-
* @returns {boolean}
|
|
205
|
-
*/
|
|
206
|
-
export declare function isSameBaseAddress(address: string, baseAddress: string): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* Function to get tokenName from list of sip10 tokens using contract details
|
|
209
|
-
*
|
|
210
|
-
* @param {String} contractAddress
|
|
211
|
-
* @param {String} contractName
|
|
212
|
-
* @returns {String|Undefined}
|
|
213
|
-
*/
|
|
214
|
-
export declare function findTokenNameByContract(contractAddress: string, contractName: string): string | undefined;
|
|
215
|
-
/**
|
|
216
|
-
* Function to get contractTokenName from list of sip10 tokens using contract details
|
|
217
|
-
*
|
|
218
|
-
* @param {String} contractAddress
|
|
219
|
-
* @param {String} contractName
|
|
220
|
-
* @returns {String|Undefined}
|
|
221
|
-
*/
|
|
222
|
-
export declare function findContractTokenNameUsingContract(contractAddress: string, contractName: string): string | undefined;
|
|
223
|
-
/**
|
|
224
|
-
* Function to get address and memo details from address input
|
|
225
|
-
*
|
|
226
|
-
* @param address
|
|
227
|
-
* @returns {AddressDetails}
|
|
228
|
-
*/
|
|
229
|
-
export declare function getMemoIdAndBaseAddressFromAddress(address: string): AddressDetails;
|
|
230
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,eAAe,EAG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