@buildonspark/spark-sdk 0.2.7 → 0.2.9
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 +17 -0
- package/dist/bare/index.cjs +1683 -1901
- package/dist/bare/index.d.cts +242 -292
- package/dist/bare/index.d.ts +242 -292
- package/dist/bare/index.js +1604 -1829
- package/dist/{chunk-7LY7PJQL.js → chunk-23BBEC25.js} +14 -5
- package/dist/{chunk-R5VUHUJR.js → chunk-5Y7YILMA.js} +4153 -3728
- package/dist/{chunk-GIDAHHDB.js → chunk-6CMNEDBK.js} +217 -9
- package/dist/{chunk-J24LM4RO.js → chunk-76SYPHOC.js} +1 -1
- package/dist/{chunk-2HD3USKS.js → chunk-A5M55UR3.js} +0 -24
- package/dist/{client-BmnZ1xDg.d.cts → client-B9CAWKWz.d.cts} +1 -1
- package/dist/{client-DmjOifnt.d.ts → client-Dd3QnxQu.d.ts} +1 -1
- package/dist/debug.cjs +1680 -1957
- package/dist/debug.d.cts +13 -8
- package/dist/debug.d.ts +13 -8
- package/dist/debug.js +6 -8
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +1729 -1948
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +17 -8
- package/dist/index.node.cjs +1729 -1948
- package/dist/index.node.d.cts +7 -6
- package/dist/index.node.d.ts +7 -6
- package/dist/index.node.js +22 -6
- package/dist/native/index.cjs +1723 -1949
- package/dist/native/index.d.cts +80 -125
- package/dist/native/index.d.ts +80 -125
- package/dist/native/index.js +1652 -1884
- package/dist/proto/spark.cjs +0 -24
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +1 -1
- package/dist/proto/spark_token.cjs +221 -8
- package/dist/proto/spark_token.d.cts +25 -2
- package/dist/proto/spark_token.d.ts +25 -2
- package/dist/proto/spark_token.js +12 -2
- package/dist/{spark-B305mDNB.d.cts → spark-CtGJPkx4.d.cts} +3 -31
- package/dist/{spark-B305mDNB.d.ts → spark-CtGJPkx4.d.ts} +3 -31
- package/dist/{spark-wallet-BdwARy70.d.cts → spark-wallet-Cp3yv6cK.d.ts} +40 -31
- package/dist/{spark-wallet-enp968Uc.d.ts → spark-wallet-yc2KhsVY.d.cts} +40 -31
- package/dist/{spark-wallet.node-CtpJlYBs.d.cts → spark-wallet.node-D0Qw5Wb4.d.cts} +1 -1
- package/dist/{spark-wallet.node-DqWcsNb6.d.ts → spark-wallet.node-D4IovOHu.d.ts} +1 -1
- package/dist/tests/test-utils.cjs +483 -1120
- package/dist/tests/test-utils.d.cts +9 -5
- package/dist/tests/test-utils.d.ts +9 -5
- package/dist/tests/test-utils.js +5 -6
- package/dist/{token-transactions-3-pVToE0.d.cts → token-transactions-0nmR9mQO.d.ts} +17 -12
- package/dist/{token-transactions-84Hp0hGz.d.ts → token-transactions-CwhlOgIP.d.cts} +17 -12
- package/dist/types/index.cjs +0 -24
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{xchain-address-BtuJEbzG.d.cts → xchain-address-BPwpnmuY.d.ts} +9 -3
- package/dist/{xchain-address-Q1BrcwID.d.ts → xchain-address-CNQEwLjR.d.cts} +9 -3
- package/package.json +1 -1
- package/src/constants.ts +7 -1
- package/src/debug.ts +1 -1
- package/src/proto/spark.ts +2 -48
- package/src/proto/spark_token.ts +255 -7
- package/src/services/token-transactions.ts +92 -44
- package/src/services/transfer.ts +20 -17
- package/src/services/wallet-config.ts +2 -0
- package/src/signer/signer.react-native.ts +0 -2
- package/src/spark-wallet/spark-wallet.browser.ts +9 -8
- package/src/spark-wallet/spark-wallet.node.ts +8 -4
- package/src/spark-wallet/spark-wallet.ts +427 -229
- package/src/tests/address.test.ts +87 -1
- package/src/tests/integration/retry.test.ts +78 -0
- package/src/tests/integration/ssp/static-deposit-validation.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +285 -1
- package/src/tests/integration/wallet.test.ts +160 -0
- package/src/tests/{tokens.test.ts → token-hashing.test.ts} +150 -162
- package/src/tests/token-outputs.test.ts +194 -0
- package/src/tests/utils/spark-testing-wallet.ts +16 -8
- package/src/utils/address.ts +152 -11
- package/src/utils/invoice-hashing.test.ts +235 -0
- package/src/utils/invoice-hashing.ts +227 -0
- package/src/utils/mempool.ts +6 -0
- package/src/utils/retry.ts +116 -0
- package/src/utils/token-hashing.ts +566 -0
- package/src/utils/token-transactions.ts +9 -5
- package/dist/chunk-7N6R7G3E.js +0 -7
- package/dist/spark-wallet.browser-BYlprQpX.d.ts +0 -12
- package/dist/spark-wallet.browser-CVI2Ss3u.d.cts +0 -12
- package/src/services/tree-creation.ts +0 -893
- package/src/tests/integration/tree-creation.test.ts +0 -46
|
@@ -6,15 +6,19 @@ import {
|
|
|
6
6
|
Bech32mTokenIdentifier,
|
|
7
7
|
decodeBech32mTokenIdentifier,
|
|
8
8
|
} from "./token-identifier.js";
|
|
9
|
-
import { NetworkType } from "./network.js";
|
|
10
9
|
|
|
11
10
|
export function sumAvailableTokens(
|
|
12
11
|
outputs: OutputWithPreviousTransactionData[],
|
|
13
12
|
): bigint {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
try {
|
|
14
|
+
return outputs.reduce(
|
|
15
|
+
(sum, output) =>
|
|
16
|
+
sum + BigInt(bytesToNumberBE(output.output!.tokenAmount!)),
|
|
17
|
+
BigInt(0),
|
|
18
|
+
);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
return 0n;
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export function checkIfSelectedOutputsAreAvailable(
|
package/dist/chunk-7N6R7G3E.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-enp968Uc.js';
|
|
2
|
-
|
|
3
|
-
declare class SparkWalletBrowser extends SparkWallet {
|
|
4
|
-
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
5
|
-
mnemonic?: string | undefined;
|
|
6
|
-
wallet: SparkWalletBrowser;
|
|
7
|
-
}>;
|
|
8
|
-
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
9
|
-
}
|
|
10
|
-
declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
11
|
-
|
|
12
|
-
export { SparkWalletBrowser as S, initializeTracerEnvBrowser as i };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-BdwARy70.cjs';
|
|
2
|
-
|
|
3
|
-
declare class SparkWalletBrowser extends SparkWallet {
|
|
4
|
-
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
5
|
-
mnemonic?: string | undefined;
|
|
6
|
-
wallet: SparkWalletBrowser;
|
|
7
|
-
}>;
|
|
8
|
-
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
9
|
-
}
|
|
10
|
-
declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
11
|
-
|
|
12
|
-
export { SparkWalletBrowser as S, initializeTracerEnvBrowser as i };
|