@buildonspark/spark-sdk 0.2.4 → 0.2.6
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 +22 -0
- package/dist/{chunk-3SEOTO43.js → chunk-3SPMJMUX.js} +3 -2
- package/dist/chunk-AVI5E5VT.js +66 -0
- package/dist/{chunk-WAQKYSDI.js → chunk-CQY5ML2A.js} +3 -2
- package/dist/{chunk-W4ZRBSWM.js → chunk-GUZ3WCB4.js} +466 -167
- package/dist/{client-KhNkrXz4.d.cts → client-CusuvuCe.d.cts} +199 -104
- package/dist/{client-BF4cn8F4.d.ts → client-Dn4Ld8pD.d.ts} +199 -104
- package/dist/debug.cjs +662 -336
- package/dist/debug.d.cts +9 -7
- package/dist/debug.d.ts +9 -7
- package/dist/debug.js +3 -3
- package/dist/graphql/objects/index.d.cts +6 -51
- package/dist/graphql/objects/index.d.ts +6 -51
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +713 -327
- package/dist/index.d.cts +19 -188
- package/dist/index.d.ts +19 -188
- package/dist/index.js +15 -8
- package/dist/index.node.cjs +638 -352
- package/dist/index.node.d.cts +7 -7
- package/dist/index.node.d.ts +7 -7
- package/dist/index.node.js +59 -100
- package/dist/native/index.cjs +655 -325
- package/dist/native/index.d.cts +253 -164
- package/dist/native/index.d.ts +253 -164
- package/dist/native/index.js +505 -172
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{spark-B_7nZx6T.d.cts → spark-Cj4brrP5.d.cts} +1 -1
- package/dist/{spark-B_7nZx6T.d.ts → spark-Cj4brrP5.d.ts} +1 -1
- package/dist/{spark-wallet-C1Tr_VKI.d.ts → spark-wallet-B6YthxDI.d.ts} +61 -26
- package/dist/{spark-wallet-DG3x2obf.d.cts → spark-wallet-BbOf2P2l.d.cts} +61 -26
- package/dist/spark-wallet.node-BBk1sGS2.d.cts +12 -0
- package/dist/spark-wallet.node-Bffethig.d.ts +12 -0
- package/dist/tests/test-utils.cjs +86 -54
- package/dist/tests/test-utils.d.cts +24 -24
- package/dist/tests/test-utils.d.ts +24 -24
- package/dist/tests/test-utils.js +4 -4
- package/dist/token-transactions-0_5XMWjs.d.ts +184 -0
- package/dist/token-transactions-CD-Adb5y.d.cts +184 -0
- package/dist/types/index.cjs +3 -2
- package/dist/types/index.d.cts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.js +2 -2
- package/dist/{xchain-address-HBr6isnc.d.cts → xchain-address-BnKZ0-dY.d.cts} +6 -5
- package/dist/{xchain-address-BHu6CpZC.d.ts → xchain-address-Di3lu4Wy.d.ts} +6 -5
- package/package.json +7 -2
- package/src/graphql/client.ts +49 -8
- package/src/graphql/objects/SparkWalletUser.ts +1 -1
- package/src/graphql/queries/Transfers.ts +15 -0
- package/src/index.node.ts +5 -1
- package/src/index.ts +4 -1
- package/src/services/config.ts +13 -2
- package/src/services/token-transactions.ts +22 -8
- package/src/services/wallet-config.ts +22 -13
- package/src/spark-wallet/spark-wallet.browser.ts +72 -0
- package/src/spark-wallet/spark-wallet.node.ts +60 -118
- package/src/spark-wallet/spark-wallet.ts +400 -156
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +233 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +112 -93
- package/src/tests/integration/ssp/static-deposit-validation.test.ts +145 -0
- package/src/tests/integration/ssp/static_deposit.test.ts +453 -64
- package/src/tests/integration/ssp/transfers.test.ts +102 -0
- package/src/tests/integration/static_deposit.test.ts +92 -0
- package/src/tests/integration/transfer.test.ts +1 -1
- package/src/tests/utils/regtest-test-faucet.ts +8 -0
- package/src/tests/utils/spark-testing-wallet.ts +42 -0
- package/src/tests/utils/test-faucet.ts +6 -2
- package/src/types/sdk-types.ts +15 -0
- package/src/utils/bitcoin.ts +13 -0
- package/src/utils/token-identifier.ts +47 -4
- package/src/utils/token-transactions.ts +13 -9
- package/dist/chunk-TVUMSHWA.js +0 -7
- package/dist/sdk-types-CB9HrW5O.d.cts +0 -44
- package/dist/sdk-types-CkRNraXT.d.ts +0 -44
- package/dist/spark-wallet.node-CGxoeCpH.d.ts +0 -13
- package/dist/spark-wallet.node-CN9LoB_O.d.cts +0 -13
- package/src/graphql/queries/Transfer.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @buildonspark/spark-sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- -- Opentelemetry improvements
|
|
8
|
+
-- Utility function to decode bech32mtokenidentifiers to raw token identifiers
|
|
9
|
+
-- Add userRequest to transfer in getTransfer() if it exists
|
|
10
|
+
-- Fixes to getIssuerTokenIdentifier() types
|
|
11
|
+
-- Migrates some internal filtering logic to key on token identifiers
|
|
12
|
+
-- Testing improvements
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @buildonspark/lrc20-sdk@0.0.61
|
|
15
|
+
|
|
16
|
+
## 0.2.5
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Attach the SSP request object to spark transfer if it exists
|
|
21
|
+
- Update static deposit refund flow to take sats per vbyte
|
|
22
|
+
- Allow the creation of multiple refunds in static deposit refund flow
|
|
23
|
+
- Add new function to claim a static deposit while specifying a max fee
|
|
24
|
+
|
|
3
25
|
## 0.2.4
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -35,7 +35,7 @@ function mapTransferLeafToWalletTransferLeaf(proto) {
|
|
|
35
35
|
intermediateRefundTx: bytesToHex(proto.intermediateRefundTx)
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function mapTransferToWalletTransfer(proto, identityPublicKey) {
|
|
38
|
+
function mapTransferToWalletTransfer(proto, identityPublicKey, userRequest) {
|
|
39
39
|
const receiverIdentityPublicKey = bytesToHex(proto.receiverIdentityPublicKey);
|
|
40
40
|
const senderIdentityPublicKey = bytesToHex(proto.senderIdentityPublicKey);
|
|
41
41
|
return {
|
|
@@ -49,7 +49,8 @@ function mapTransferToWalletTransfer(proto, identityPublicKey) {
|
|
|
49
49
|
createdTime: proto.createdTime ? new Date(proto.createdTime) : void 0,
|
|
50
50
|
updatedTime: proto.updatedTime ? new Date(proto.updatedTime) : void 0,
|
|
51
51
|
type: TransferType[proto.type],
|
|
52
|
-
transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING
|
|
52
|
+
transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */,
|
|
53
|
+
userRequest
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SparkWallet,
|
|
3
|
+
setCrypto
|
|
4
|
+
} from "./chunk-GUZ3WCB4.js";
|
|
5
|
+
|
|
6
|
+
// src/spark-wallet/spark-wallet.browser.ts
|
|
7
|
+
import {
|
|
8
|
+
WebTracerProvider
|
|
9
|
+
} from "@opentelemetry/sdk-trace-web";
|
|
10
|
+
import { registerInstrumentations } from "@opentelemetry/instrumentation";
|
|
11
|
+
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
|
|
12
|
+
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
13
|
+
import { propagation } from "@opentelemetry/api";
|
|
14
|
+
var SparkWalletBrowser = class _SparkWalletBrowser extends SparkWallet {
|
|
15
|
+
static async initialize({
|
|
16
|
+
mnemonicOrSeed,
|
|
17
|
+
accountNumber,
|
|
18
|
+
signer,
|
|
19
|
+
options
|
|
20
|
+
}) {
|
|
21
|
+
const wallet = new _SparkWalletBrowser(options, signer);
|
|
22
|
+
wallet.initializeTracer(wallet);
|
|
23
|
+
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
24
|
+
return {
|
|
25
|
+
wallet,
|
|
26
|
+
...initResponse
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
initializeTracerEnv({
|
|
30
|
+
spanProcessors,
|
|
31
|
+
traceUrls
|
|
32
|
+
}) {
|
|
33
|
+
initializeTracerEnvBrowser({ spanProcessors, traceUrls });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function initializeTracerEnvBrowser({
|
|
37
|
+
spanProcessors,
|
|
38
|
+
traceUrls
|
|
39
|
+
}) {
|
|
40
|
+
const provider = new WebTracerProvider({ spanProcessors });
|
|
41
|
+
provider.register();
|
|
42
|
+
propagation.setGlobalPropagator(new W3CTraceContextPropagator());
|
|
43
|
+
registerInstrumentations({
|
|
44
|
+
instrumentations: [
|
|
45
|
+
new FetchInstrumentation({
|
|
46
|
+
ignoreUrls: [
|
|
47
|
+
/* Since we're wrapping global fetch we should be careful to avoid
|
|
48
|
+
adding headers for unrelated requests */
|
|
49
|
+
new RegExp(
|
|
50
|
+
`^(?!(${traceUrls.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")}))`
|
|
51
|
+
)
|
|
52
|
+
],
|
|
53
|
+
propagateTraceHeaderCorsUrls: /.*/
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/index.ts
|
|
60
|
+
var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof global !== "undefined" && global.crypto ? global.crypto : null;
|
|
61
|
+
setCrypto(cryptoImpl);
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
SparkWalletBrowser,
|
|
65
|
+
initializeTracerEnvBrowser
|
|
66
|
+
};
|
|
@@ -1498,14 +1498,15 @@ export {
|
|
|
1498
1498
|
LightningSendRequestFromJson,
|
|
1499
1499
|
FRAGMENT6 as FRAGMENT4,
|
|
1500
1500
|
getLightningSendRequestQuery,
|
|
1501
|
+
ClaimStaticDepositStatus_default,
|
|
1502
|
+
ClaimStaticDepositFromJson,
|
|
1503
|
+
getClaimStaticDepositQuery,
|
|
1501
1504
|
ClaimStaticDepositRequestType_default,
|
|
1502
1505
|
CoopExitFeeQuoteFromJson,
|
|
1503
1506
|
FRAGMENT2 as FRAGMENT5,
|
|
1504
1507
|
getCoopExitFeeQuoteQuery,
|
|
1505
|
-
ClaimStaticDepositStatus_default,
|
|
1506
1508
|
FRAGMENT7 as FRAGMENT6,
|
|
1507
1509
|
getUserRequestQuery,
|
|
1508
|
-
getClaimStaticDepositQuery,
|
|
1509
1510
|
SparkUserRequestStatus_default,
|
|
1510
1511
|
SparkUserRequestType_default,
|
|
1511
1512
|
SparkWalletUser_default
|