@buildonspark/spark-sdk 0.3.6 → 0.3.8
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 +16 -0
- package/dist/bare/index.cjs +11107 -10443
- package/dist/bare/index.d.cts +274 -219
- package/dist/bare/index.d.ts +274 -219
- package/dist/bare/index.js +11459 -10792
- package/dist/{chunk-LIZFXQWK.js → chunk-3LPEQGVJ.js} +1 -1
- package/dist/{chunk-J2P3KTQP.js → chunk-5ASXVNTM.js} +1 -1
- package/dist/{chunk-FJ7LTA2O.js → chunk-5HU5W56H.js} +40 -213
- package/dist/{chunk-XPHYQ2L6.js → chunk-FP2CRVQH.js} +6471 -5813
- package/dist/{chunk-EHKP3Y65.js → chunk-FXIESWE6.js} +8 -11
- package/dist/{chunk-IC4IUEOS.js → chunk-VFN34EOX.js} +56 -43
- package/dist/{chunk-XWLR6G5C.js → chunk-XI6FCNYG.js} +1 -1
- package/dist/{client-GOlkXliC.d.ts → client-By-N7oJS.d.ts} +13 -11
- package/dist/{client-AHn11NHe.d.cts → client-pNpGP15j.d.cts} +13 -11
- package/dist/debug.cjs +11179 -10516
- package/dist/debug.d.cts +12 -8
- package/dist/debug.d.ts +12 -8
- package/dist/debug.js +5 -5
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +7063 -6395
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +12 -6
- package/dist/index.node.cjs +6598 -6100
- package/dist/index.node.d.cts +8 -7
- package/dist/index.node.d.ts +8 -7
- package/dist/index.node.js +11 -5
- package/dist/{logging-CW3kwBaM.d.cts → logging-DMFVY384.d.ts} +10 -4
- package/dist/{logging-D7ukPwRA.d.ts → logging-DxLp34Xm.d.cts} +10 -4
- package/dist/native/{chunk-X2QXUON7.js → chunk-AFP5QR4O.js} +11 -8
- package/dist/native/{index.cjs → index.react-native.cjs} +7143 -6464
- package/dist/native/{index.d.cts → index.react-native.d.cts} +110 -54
- package/dist/native/{index.d.ts → index.react-native.d.ts} +110 -54
- package/dist/native/{index.js → index.react-native.js} +7162 -6484
- package/dist/native/{wasm-GKEDPGTM.js → wasm-D4TI35NF.js} +1 -1
- package/dist/proto/spark.cjs +56 -43
- 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.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{spark-WA_4wcBr.d.ts → spark-By6yHsrk.d.cts} +31 -6
- package/dist/{spark-WA_4wcBr.d.cts → spark-By6yHsrk.d.ts} +31 -6
- package/dist/{spark-wallet.browser-Cg4fB-Nm.d.ts → spark-wallet.browser-C1dQknVj.d.ts} +8 -8
- package/dist/{spark-wallet.browser-Db7Y95Kt.d.cts → spark-wallet.browser-CNMo3IvO.d.cts} +8 -8
- package/dist/{spark-wallet.node-HEG2ahNd.d.cts → spark-wallet.node-BZJhJZKq.d.cts} +9 -31
- package/dist/{spark-wallet.node-DB3ZqtJG.d.ts → spark-wallet.node-Og6__NMh.d.ts} +9 -31
- package/dist/tests/test-utils.cjs +8835 -8332
- package/dist/tests/test-utils.d.cts +8 -6
- package/dist/tests/test-utils.d.ts +8 -6
- package/dist/tests/test-utils.js +7 -7
- package/dist/{token-transactions-B2-BO7Oz.d.ts → token-transactions-C7yefB2S.d.ts} +2 -2
- package/dist/{token-transactions-BAN68xwg.d.cts → token-transactions-CLR3rnYi.d.cts} +2 -2
- package/dist/types/index.cjs +56 -43
- 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/{spark-wallet-jwNvWvpK.d.ts → wallet-config-BoyMVa6n.d.ts} +293 -267
- package/dist/{spark-wallet-NxG55m7K.d.cts → wallet-config-xom-9UFF.d.cts} +293 -267
- package/package.json +16 -6
- package/src/graphql/client.ts +6 -9
- package/src/graphql/mutations/CompleteCoopExit.ts +1 -1
- package/src/graphql/mutations/RequestCoopExit.ts +3 -1
- package/src/graphql/mutations/RequestLightningSend.ts +3 -1
- package/src/graphql/objects/CompleteCoopExitInput.ts +22 -33
- package/src/graphql/objects/RequestCoopExitInput.ts +39 -45
- package/src/graphql/objects/RequestLightningSendInput.ts +31 -39
- package/src/index.react-native.ts +21 -0
- package/src/proto/mock.ts +0 -264
- package/src/proto/spark.ts +94 -51
- package/src/services/config.ts +7 -2
- package/src/services/connection/connection.browser.ts +27 -19
- package/src/services/connection/connection.node.ts +79 -24
- package/src/services/connection/connection.ts +396 -224
- package/src/services/coop-exit.ts +5 -1
- package/src/services/lightning.ts +30 -4
- package/src/services/signing.ts +137 -0
- package/src/services/token-transactions.ts +8 -8
- package/src/services/transfer.ts +116 -1
- package/src/services/wallet-config.ts +6 -0
- package/src/spark-wallet/proto-descriptors.ts +1 -1
- package/src/spark-wallet/spark-wallet.browser.ts +0 -1
- package/src/spark-wallet/spark-wallet.react-native.ts +5 -3
- package/src/spark-wallet/spark-wallet.ts +124 -83
- package/src/spark_descriptors.pb +0 -0
- package/src/tests/connection.test.ts +537 -0
- package/src/tests/integration/connection.test.ts +39 -0
- package/src/tests/integration/coop-exit.test.ts +2 -0
- package/src/tests/integration/lightning.test.ts +30 -12
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +5 -6
- package/src/tests/integration/ssp/static_deposit.test.ts +45 -35
- package/src/tests/integration/static_deposit.test.ts +11 -10
- package/src/tests/integration/transfer.test.ts +13 -1
- package/src/tests/isHermeticTest.ts +1 -1
- package/src/tests/optimize.test.ts +45 -0
- package/src/tests/token-outputs.test.ts +60 -1
- package/src/tests/utils/test-faucet.ts +65 -28
- package/src/utils/htlc-transactions.ts +224 -0
- package/src/utils/optimize.ts +226 -0
- package/src/utils/transaction.ts +36 -0
- package/src/native/index.ts +0 -21
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
NetworkError,
|
|
4
4
|
SparkWallet,
|
|
5
5
|
clientEnv
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FP2CRVQH.js";
|
|
7
7
|
|
|
8
8
|
// src/services/connection/connection.browser.ts
|
|
9
9
|
import {
|
|
@@ -19,7 +19,7 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
|
19
19
|
super(config);
|
|
20
20
|
this.transport = transport;
|
|
21
21
|
}
|
|
22
|
-
async createChannelWithTLS(address
|
|
22
|
+
async createChannelWithTLS(address) {
|
|
23
23
|
try {
|
|
24
24
|
return createChannel(address, this.transport);
|
|
25
25
|
} catch (error) {
|
|
@@ -45,16 +45,14 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
|
45
45
|
});
|
|
46
46
|
}.bind(this);
|
|
47
47
|
}
|
|
48
|
-
createMiddleware(address
|
|
48
|
+
createMiddleware(address) {
|
|
49
49
|
return async function* (call, options) {
|
|
50
50
|
const metadata = Metadata(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
|
|
51
51
|
try {
|
|
52
|
+
const token = await this.authenticate(address);
|
|
52
53
|
return yield* call.next(call.request, {
|
|
53
54
|
...options,
|
|
54
|
-
metadata: metadata.set(
|
|
55
|
-
"Authorization",
|
|
56
|
-
`Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`
|
|
57
|
-
)
|
|
55
|
+
metadata: metadata.set("Authorization", `Bearer ${token}`)
|
|
58
56
|
});
|
|
59
57
|
} catch (error) {
|
|
60
58
|
return yield* this.handleMiddlewareError(
|
|
@@ -67,7 +65,7 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
|
67
65
|
}
|
|
68
66
|
}.bind(this);
|
|
69
67
|
}
|
|
70
|
-
async createGrpcClient(
|
|
68
|
+
async createGrpcClient(definition, channel, withRetries, middleware, channelKey) {
|
|
71
69
|
let clientFactory;
|
|
72
70
|
const retryOptions = {
|
|
73
71
|
retry: true,
|
|
@@ -82,12 +80,12 @@ var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
|
82
80
|
if (middleware) {
|
|
83
81
|
clientFactory = clientFactory.use(middleware);
|
|
84
82
|
}
|
|
85
|
-
const client = clientFactory.create(
|
|
83
|
+
const client = clientFactory.create(definition, channel, {
|
|
86
84
|
"*": options
|
|
87
85
|
});
|
|
88
86
|
return {
|
|
89
87
|
...client,
|
|
90
|
-
close: void 0
|
|
88
|
+
close: channelKey ? () => ConnectionManager.releaseChannel(channelKey) : void 0
|
|
91
89
|
};
|
|
92
90
|
}
|
|
93
91
|
};
|
|
@@ -106,7 +104,6 @@ var SparkWalletBrowser = class extends SparkWallet {
|
|
|
106
104
|
spanProcessors,
|
|
107
105
|
traceUrls
|
|
108
106
|
}) {
|
|
109
|
-
console.log("initializeTracerEnvBrowser");
|
|
110
107
|
initializeTracerEnvBrowser({ spanProcessors, traceUrls });
|
|
111
108
|
}
|
|
112
109
|
};
|
|
@@ -2954,24 +2954,21 @@ var SigningResult_SignatureSharesEntry = {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
};
|
|
2956
2956
|
function createBaseRenewLeafRequest() {
|
|
2957
|
-
return { leafId: "",
|
|
2957
|
+
return { leafId: "", signingJobs: void 0 };
|
|
2958
2958
|
}
|
|
2959
2959
|
var RenewLeafRequest = {
|
|
2960
2960
|
encode(message, writer = new BinaryWriter4()) {
|
|
2961
2961
|
if (message.leafId !== "") {
|
|
2962
2962
|
writer.uint32(10).string(message.leafId);
|
|
2963
2963
|
}
|
|
2964
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
2965
|
-
writer.uint32(18).bytes(message.ownerIdentityPublicKey);
|
|
2966
|
-
}
|
|
2967
2964
|
switch (message.signingJobs?.$case) {
|
|
2968
2965
|
case "renewNodeTimelockSigningJob":
|
|
2969
|
-
RenewNodeTimelockSigningJob.encode(message.signingJobs.renewNodeTimelockSigningJob, writer.uint32(
|
|
2966
|
+
RenewNodeTimelockSigningJob.encode(message.signingJobs.renewNodeTimelockSigningJob, writer.uint32(18).fork()).join();
|
|
2970
2967
|
break;
|
|
2971
2968
|
case "renewRefundTimelockSigningJob":
|
|
2972
2969
|
RenewRefundTimelockSigningJob.encode(
|
|
2973
2970
|
message.signingJobs.renewRefundTimelockSigningJob,
|
|
2974
|
-
writer.uint32(
|
|
2971
|
+
writer.uint32(26).fork()
|
|
2975
2972
|
).join();
|
|
2976
2973
|
break;
|
|
2977
2974
|
}
|
|
@@ -2995,21 +2992,14 @@ var RenewLeafRequest = {
|
|
|
2995
2992
|
if (tag !== 18) {
|
|
2996
2993
|
break;
|
|
2997
2994
|
}
|
|
2998
|
-
message.ownerIdentityPublicKey = reader.bytes();
|
|
2999
|
-
continue;
|
|
3000
|
-
}
|
|
3001
|
-
case 3: {
|
|
3002
|
-
if (tag !== 26) {
|
|
3003
|
-
break;
|
|
3004
|
-
}
|
|
3005
2995
|
message.signingJobs = {
|
|
3006
2996
|
$case: "renewNodeTimelockSigningJob",
|
|
3007
2997
|
renewNodeTimelockSigningJob: RenewNodeTimelockSigningJob.decode(reader, reader.uint32())
|
|
3008
2998
|
};
|
|
3009
2999
|
continue;
|
|
3010
3000
|
}
|
|
3011
|
-
case
|
|
3012
|
-
if (tag !==
|
|
3001
|
+
case 3: {
|
|
3002
|
+
if (tag !== 26) {
|
|
3013
3003
|
break;
|
|
3014
3004
|
}
|
|
3015
3005
|
message.signingJobs = {
|
|
@@ -3029,7 +3019,6 @@ var RenewLeafRequest = {
|
|
|
3029
3019
|
fromJSON(object) {
|
|
3030
3020
|
return {
|
|
3031
3021
|
leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : "",
|
|
3032
|
-
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
3033
3022
|
signingJobs: isSet3(object.renewNodeTimelockSigningJob) ? {
|
|
3034
3023
|
$case: "renewNodeTimelockSigningJob",
|
|
3035
3024
|
renewNodeTimelockSigningJob: RenewNodeTimelockSigningJob.fromJSON(object.renewNodeTimelockSigningJob)
|
|
@@ -3044,9 +3033,6 @@ var RenewLeafRequest = {
|
|
|
3044
3033
|
if (message.leafId !== "") {
|
|
3045
3034
|
obj.leafId = message.leafId;
|
|
3046
3035
|
}
|
|
3047
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
3048
|
-
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
3049
|
-
}
|
|
3050
3036
|
if (message.signingJobs?.$case === "renewNodeTimelockSigningJob") {
|
|
3051
3037
|
obj.renewNodeTimelockSigningJob = RenewNodeTimelockSigningJob.toJSON(
|
|
3052
3038
|
message.signingJobs.renewNodeTimelockSigningJob
|
|
@@ -3064,7 +3050,6 @@ var RenewLeafRequest = {
|
|
|
3064
3050
|
fromPartial(object) {
|
|
3065
3051
|
const message = createBaseRenewLeafRequest();
|
|
3066
3052
|
message.leafId = object.leafId ?? "";
|
|
3067
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
3068
3053
|
switch (object.signingJobs?.$case) {
|
|
3069
3054
|
case "renewNodeTimelockSigningJob": {
|
|
3070
3055
|
if (object.signingJobs?.renewNodeTimelockSigningJob !== void 0 && object.signingJobs?.renewNodeTimelockSigningJob !== null) {
|
|
@@ -3368,11 +3353,11 @@ function createBaseRenewLeafResponse() {
|
|
|
3368
3353
|
var RenewLeafResponse = {
|
|
3369
3354
|
encode(message, writer = new BinaryWriter4()) {
|
|
3370
3355
|
switch (message.renewResult?.$case) {
|
|
3371
|
-
case "
|
|
3372
|
-
RenewNodeTimelockResult.encode(message.renewResult.
|
|
3356
|
+
case "renewNodeTimelockResult":
|
|
3357
|
+
RenewNodeTimelockResult.encode(message.renewResult.renewNodeTimelockResult, writer.uint32(10).fork()).join();
|
|
3373
3358
|
break;
|
|
3374
|
-
case "
|
|
3375
|
-
RenewRefundTimelockResult.encode(message.renewResult.
|
|
3359
|
+
case "renewRefundTimelockResult":
|
|
3360
|
+
RenewRefundTimelockResult.encode(message.renewResult.renewRefundTimelockResult, writer.uint32(18).fork()).join();
|
|
3376
3361
|
break;
|
|
3377
3362
|
}
|
|
3378
3363
|
return writer;
|
|
@@ -3389,8 +3374,8 @@ var RenewLeafResponse = {
|
|
|
3389
3374
|
break;
|
|
3390
3375
|
}
|
|
3391
3376
|
message.renewResult = {
|
|
3392
|
-
$case: "
|
|
3393
|
-
|
|
3377
|
+
$case: "renewNodeTimelockResult",
|
|
3378
|
+
renewNodeTimelockResult: RenewNodeTimelockResult.decode(reader, reader.uint32())
|
|
3394
3379
|
};
|
|
3395
3380
|
continue;
|
|
3396
3381
|
}
|
|
@@ -3399,8 +3384,8 @@ var RenewLeafResponse = {
|
|
|
3399
3384
|
break;
|
|
3400
3385
|
}
|
|
3401
3386
|
message.renewResult = {
|
|
3402
|
-
$case: "
|
|
3403
|
-
|
|
3387
|
+
$case: "renewRefundTimelockResult",
|
|
3388
|
+
renewRefundTimelockResult: RenewRefundTimelockResult.decode(reader, reader.uint32())
|
|
3404
3389
|
};
|
|
3405
3390
|
continue;
|
|
3406
3391
|
}
|
|
@@ -3414,15 +3399,21 @@ var RenewLeafResponse = {
|
|
|
3414
3399
|
},
|
|
3415
3400
|
fromJSON(object) {
|
|
3416
3401
|
return {
|
|
3417
|
-
renewResult: isSet3(object.
|
|
3402
|
+
renewResult: isSet3(object.renewNodeTimelockResult) ? {
|
|
3403
|
+
$case: "renewNodeTimelockResult",
|
|
3404
|
+
renewNodeTimelockResult: RenewNodeTimelockResult.fromJSON(object.renewNodeTimelockResult)
|
|
3405
|
+
} : isSet3(object.renewRefundTimelockResult) ? {
|
|
3406
|
+
$case: "renewRefundTimelockResult",
|
|
3407
|
+
renewRefundTimelockResult: RenewRefundTimelockResult.fromJSON(object.renewRefundTimelockResult)
|
|
3408
|
+
} : void 0
|
|
3418
3409
|
};
|
|
3419
3410
|
},
|
|
3420
3411
|
toJSON(message) {
|
|
3421
3412
|
const obj = {};
|
|
3422
|
-
if (message.renewResult?.$case === "
|
|
3423
|
-
obj.
|
|
3424
|
-
} else if (message.renewResult?.$case === "
|
|
3425
|
-
obj.
|
|
3413
|
+
if (message.renewResult?.$case === "renewNodeTimelockResult") {
|
|
3414
|
+
obj.renewNodeTimelockResult = RenewNodeTimelockResult.toJSON(message.renewResult.renewNodeTimelockResult);
|
|
3415
|
+
} else if (message.renewResult?.$case === "renewRefundTimelockResult") {
|
|
3416
|
+
obj.renewRefundTimelockResult = RenewRefundTimelockResult.toJSON(message.renewResult.renewRefundTimelockResult);
|
|
3426
3417
|
}
|
|
3427
3418
|
return obj;
|
|
3428
3419
|
},
|
|
@@ -3432,20 +3423,22 @@ var RenewLeafResponse = {
|
|
|
3432
3423
|
fromPartial(object) {
|
|
3433
3424
|
const message = createBaseRenewLeafResponse();
|
|
3434
3425
|
switch (object.renewResult?.$case) {
|
|
3435
|
-
case "
|
|
3436
|
-
if (object.renewResult?.
|
|
3426
|
+
case "renewNodeTimelockResult": {
|
|
3427
|
+
if (object.renewResult?.renewNodeTimelockResult !== void 0 && object.renewResult?.renewNodeTimelockResult !== null) {
|
|
3437
3428
|
message.renewResult = {
|
|
3438
|
-
$case: "
|
|
3439
|
-
|
|
3429
|
+
$case: "renewNodeTimelockResult",
|
|
3430
|
+
renewNodeTimelockResult: RenewNodeTimelockResult.fromPartial(object.renewResult.renewNodeTimelockResult)
|
|
3440
3431
|
};
|
|
3441
3432
|
}
|
|
3442
3433
|
break;
|
|
3443
3434
|
}
|
|
3444
|
-
case "
|
|
3445
|
-
if (object.renewResult?.
|
|
3435
|
+
case "renewRefundTimelockResult": {
|
|
3436
|
+
if (object.renewResult?.renewRefundTimelockResult !== void 0 && object.renewResult?.renewRefundTimelockResult !== null) {
|
|
3446
3437
|
message.renewResult = {
|
|
3447
|
-
$case: "
|
|
3448
|
-
|
|
3438
|
+
$case: "renewRefundTimelockResult",
|
|
3439
|
+
renewRefundTimelockResult: RenewRefundTimelockResult.fromPartial(
|
|
3440
|
+
object.renewResult.renewRefundTimelockResult
|
|
3441
|
+
)
|
|
3449
3442
|
};
|
|
3450
3443
|
}
|
|
3451
3444
|
break;
|
|
@@ -10647,7 +10640,8 @@ function createBaseInitiatePreimageSwapRequest() {
|
|
|
10647
10640
|
reason: 0,
|
|
10648
10641
|
transfer: void 0,
|
|
10649
10642
|
receiverIdentityPublicKey: new Uint8Array(0),
|
|
10650
|
-
feeSats: 0
|
|
10643
|
+
feeSats: 0,
|
|
10644
|
+
transferRequest: void 0
|
|
10651
10645
|
};
|
|
10652
10646
|
}
|
|
10653
10647
|
var InitiatePreimageSwapRequest = {
|
|
@@ -10670,6 +10664,9 @@ var InitiatePreimageSwapRequest = {
|
|
|
10670
10664
|
if (message.feeSats !== 0) {
|
|
10671
10665
|
writer.uint32(48).uint64(message.feeSats);
|
|
10672
10666
|
}
|
|
10667
|
+
if (message.transferRequest !== void 0) {
|
|
10668
|
+
StartTransferRequest.encode(message.transferRequest, writer.uint32(58).fork()).join();
|
|
10669
|
+
}
|
|
10673
10670
|
return writer;
|
|
10674
10671
|
},
|
|
10675
10672
|
decode(input, length) {
|
|
@@ -10721,6 +10718,13 @@ var InitiatePreimageSwapRequest = {
|
|
|
10721
10718
|
message.feeSats = longToNumber2(reader.uint64());
|
|
10722
10719
|
continue;
|
|
10723
10720
|
}
|
|
10721
|
+
case 7: {
|
|
10722
|
+
if (tag !== 58) {
|
|
10723
|
+
break;
|
|
10724
|
+
}
|
|
10725
|
+
message.transferRequest = StartTransferRequest.decode(reader, reader.uint32());
|
|
10726
|
+
continue;
|
|
10727
|
+
}
|
|
10724
10728
|
}
|
|
10725
10729
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10726
10730
|
break;
|
|
@@ -10736,7 +10740,8 @@ var InitiatePreimageSwapRequest = {
|
|
|
10736
10740
|
reason: isSet3(object.reason) ? initiatePreimageSwapRequest_ReasonFromJSON(object.reason) : 0,
|
|
10737
10741
|
transfer: isSet3(object.transfer) ? StartUserSignedTransferRequest.fromJSON(object.transfer) : void 0,
|
|
10738
10742
|
receiverIdentityPublicKey: isSet3(object.receiverIdentityPublicKey) ? bytesFromBase642(object.receiverIdentityPublicKey) : new Uint8Array(0),
|
|
10739
|
-
feeSats: isSet3(object.feeSats) ? globalThis.Number(object.feeSats) : 0
|
|
10743
|
+
feeSats: isSet3(object.feeSats) ? globalThis.Number(object.feeSats) : 0,
|
|
10744
|
+
transferRequest: isSet3(object.transferRequest) ? StartTransferRequest.fromJSON(object.transferRequest) : void 0
|
|
10740
10745
|
};
|
|
10741
10746
|
},
|
|
10742
10747
|
toJSON(message) {
|
|
@@ -10759,6 +10764,9 @@ var InitiatePreimageSwapRequest = {
|
|
|
10759
10764
|
if (message.feeSats !== 0) {
|
|
10760
10765
|
obj.feeSats = Math.round(message.feeSats);
|
|
10761
10766
|
}
|
|
10767
|
+
if (message.transferRequest !== void 0) {
|
|
10768
|
+
obj.transferRequest = StartTransferRequest.toJSON(message.transferRequest);
|
|
10769
|
+
}
|
|
10762
10770
|
return obj;
|
|
10763
10771
|
},
|
|
10764
10772
|
create(base) {
|
|
@@ -10772,6 +10780,7 @@ var InitiatePreimageSwapRequest = {
|
|
|
10772
10780
|
message.transfer = object.transfer !== void 0 && object.transfer !== null ? StartUserSignedTransferRequest.fromPartial(object.transfer) : void 0;
|
|
10773
10781
|
message.receiverIdentityPublicKey = object.receiverIdentityPublicKey ?? new Uint8Array(0);
|
|
10774
10782
|
message.feeSats = object.feeSats ?? 0;
|
|
10783
|
+
message.transferRequest = object.transferRequest !== void 0 && object.transferRequest !== null ? StartTransferRequest.fromPartial(object.transferRequest) : void 0;
|
|
10775
10784
|
return message;
|
|
10776
10785
|
}
|
|
10777
10786
|
};
|
|
@@ -16656,6 +16665,10 @@ var SparkServiceDefinition = {
|
|
|
16656
16665
|
responseStream: false,
|
|
16657
16666
|
options: {}
|
|
16658
16667
|
},
|
|
16668
|
+
/**
|
|
16669
|
+
* Gets a specified number of signing commmitments for a set of nodes, which can be used as
|
|
16670
|
+
* part of a transfer package.
|
|
16671
|
+
*/
|
|
16659
16672
|
get_signing_commitments: {
|
|
16660
16673
|
name: "get_signing_commitments",
|
|
16661
16674
|
requestType: GetSigningCommitmentsRequest,
|
|
@@ -2,7 +2,7 @@ import { Query } from '@lightsparkdev/core';
|
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { HDKey } from '@scure/bip32';
|
|
4
4
|
import { a as ISigningCommitment } from './types-B3hMoTYO.js';
|
|
5
|
-
import { S as SigningKeyshare, N as Network,
|
|
5
|
+
import { S as SigningKeyshare, N as Network, k as TransferStatus, l as TransferType, c as TreeNode, m as TransferLeaf, T as Transfer$1 } from './spark-By6yHsrk.js';
|
|
6
6
|
|
|
7
7
|
type Polynomial = {
|
|
8
8
|
fieldModulus: bigint;
|
|
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
|
|
|
651
651
|
|
|
652
652
|
interface CompleteCoopExitInput {
|
|
653
653
|
userOutboundTransferExternalId: string;
|
|
654
|
-
coopExitRequestId
|
|
654
|
+
coopExitRequestId?: string | undefined;
|
|
655
655
|
}
|
|
656
656
|
|
|
657
657
|
interface CompleteLeavesSwapInput {
|
|
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
|
|
|
740
740
|
interface RequestCoopExitInput {
|
|
741
741
|
leafExternalIds: string[];
|
|
742
742
|
withdrawalAddress: string;
|
|
743
|
-
idempotencyKey
|
|
743
|
+
idempotencyKey?: string | undefined;
|
|
744
744
|
exitSpeed: ExitSpeed;
|
|
745
745
|
withdrawAll: boolean;
|
|
746
746
|
feeLeafExternalIds?: string[] | undefined;
|
|
747
747
|
feeQuoteId?: string | undefined;
|
|
748
|
+
userOutboundTransferExternalId?: string | undefined;
|
|
748
749
|
}
|
|
749
750
|
|
|
750
751
|
interface UserLeafInput {
|
|
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
|
|
|
804
805
|
|
|
805
806
|
interface RequestLightningSendInput {
|
|
806
807
|
encodedInvoice: string;
|
|
807
|
-
idempotencyKey
|
|
808
|
+
idempotencyKey?: string | undefined;
|
|
808
809
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
**/
|
|
810
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
811
|
+
* zero.
|
|
812
|
+
**/
|
|
812
813
|
amountSats?: number | undefined;
|
|
814
|
+
userOutboundTransferExternalId?: string | undefined;
|
|
813
815
|
}
|
|
814
816
|
|
|
815
817
|
interface StaticDepositQuoteInput {
|
|
@@ -866,10 +868,10 @@ declare class SspClient {
|
|
|
866
868
|
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
867
869
|
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
868
870
|
getCurrentUser(): Promise<void>;
|
|
869
|
-
completeCoopExit({ userOutboundTransferExternalId,
|
|
870
|
-
requestCoopExit({ leafExternalIds, withdrawalAddress,
|
|
871
|
+
completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
872
|
+
requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
871
873
|
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
872
|
-
requestLightningSend({ encodedInvoice,
|
|
874
|
+
requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
873
875
|
requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
874
876
|
completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
875
877
|
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
@@ -893,4 +895,4 @@ declare class SspClient {
|
|
|
893
895
|
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
894
896
|
}
|
|
895
897
|
|
|
896
|
-
export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type
|
|
898
|
+
export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletLeaf as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletTransfer as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };
|
|
@@ -2,7 +2,7 @@ import { Query } from '@lightsparkdev/core';
|
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { HDKey } from '@scure/bip32';
|
|
4
4
|
import { a as ISigningCommitment } from './types-B3hMoTYO.cjs';
|
|
5
|
-
import { S as SigningKeyshare, N as Network,
|
|
5
|
+
import { S as SigningKeyshare, N as Network, k as TransferStatus, l as TransferType, c as TreeNode, m as TransferLeaf, T as Transfer$1 } from './spark-By6yHsrk.cjs';
|
|
6
6
|
|
|
7
7
|
type Polynomial = {
|
|
8
8
|
fieldModulus: bigint;
|
|
@@ -651,7 +651,7 @@ interface ClaimStaticDepositOutput {
|
|
|
651
651
|
|
|
652
652
|
interface CompleteCoopExitInput {
|
|
653
653
|
userOutboundTransferExternalId: string;
|
|
654
|
-
coopExitRequestId
|
|
654
|
+
coopExitRequestId?: string | undefined;
|
|
655
655
|
}
|
|
656
656
|
|
|
657
657
|
interface CompleteLeavesSwapInput {
|
|
@@ -740,11 +740,12 @@ interface LightningSendFeeEstimateOutput {
|
|
|
740
740
|
interface RequestCoopExitInput {
|
|
741
741
|
leafExternalIds: string[];
|
|
742
742
|
withdrawalAddress: string;
|
|
743
|
-
idempotencyKey
|
|
743
|
+
idempotencyKey?: string | undefined;
|
|
744
744
|
exitSpeed: ExitSpeed;
|
|
745
745
|
withdrawAll: boolean;
|
|
746
746
|
feeLeafExternalIds?: string[] | undefined;
|
|
747
747
|
feeQuoteId?: string | undefined;
|
|
748
|
+
userOutboundTransferExternalId?: string | undefined;
|
|
748
749
|
}
|
|
749
750
|
|
|
750
751
|
interface UserLeafInput {
|
|
@@ -804,12 +805,13 @@ interface RequestLightningReceiveInput {
|
|
|
804
805
|
|
|
805
806
|
interface RequestLightningSendInput {
|
|
806
807
|
encodedInvoice: string;
|
|
807
|
-
idempotencyKey
|
|
808
|
+
idempotencyKey?: string | undefined;
|
|
808
809
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
**/
|
|
810
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
811
|
+
* zero.
|
|
812
|
+
**/
|
|
812
813
|
amountSats?: number | undefined;
|
|
814
|
+
userOutboundTransferExternalId?: string | undefined;
|
|
813
815
|
}
|
|
814
816
|
|
|
815
817
|
interface StaticDepositQuoteInput {
|
|
@@ -866,10 +868,10 @@ declare class SspClient {
|
|
|
866
868
|
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
867
869
|
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
868
870
|
getCurrentUser(): Promise<void>;
|
|
869
|
-
completeCoopExit({ userOutboundTransferExternalId,
|
|
870
|
-
requestCoopExit({ leafExternalIds, withdrawalAddress,
|
|
871
|
+
completeCoopExit({ userOutboundTransferExternalId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
872
|
+
requestCoopExit({ leafExternalIds, withdrawalAddress, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, userOutboundTransferExternalId, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
871
873
|
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
872
|
-
requestLightningSend({ encodedInvoice,
|
|
874
|
+
requestLightningSend({ encodedInvoice, amountSats, userOutboundTransferExternalId, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
873
875
|
requestLeaveSwap({ adaptorPubkey, directAdaptorPubkey, directFromCpfpAdaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
874
876
|
completeLeaveSwap({ adaptorSecretKey, directAdaptorSecretKey, directFromCpfpAdaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
875
877
|
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
@@ -893,4 +895,4 @@ declare class SspClient {
|
|
|
893
895
|
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
894
896
|
}
|
|
895
897
|
|
|
896
|
-
export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type
|
|
898
|
+
export { getCoopExitFeeQuoteQuery as $, type AggregateFrostParams as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, DefaultSparkSigner as D, ExitSpeed as E, type CoopExitFeeQuote as F, type CoopExitRequest as G, type HasSspClientOptions as H, type TransferWithUserRequest as I, SspClient as J, KeyDerivationType as K, type LeavesSwapFeeEstimateOutput as L, type MayHaveSspClientOptions as M, getClaimStaticDepositQuery as N, type ClaimStaticDeposit as O, type PageInfo as P, ClaimStaticDepositStatus as Q, type CompleteCoopExitInput as R, type SparkSigner as S, TaprootOutputKeysGenerator as T, UnsafeStatelessSparkSigner as U, type VerifiableSecretShare as V, type WalletLeaf as W, type CompleteLeavesSwapInput as X, type CoopExitFeeEstimate as Y, type CoopExitFeeEstimatesInput as Z, type CoopExitFeeEstimatesOutput as _, TaprootSparkSigner as a, type CoopExitFeeQuoteInput as a0, getCoopExitRequestQuery as a1, type CurrencyAmount as a2, CurrencyUnit as a3, type GetChallengeOutput as a4, type Invoice as a5, type Leaf as a6, getLeavesSwapRequestQuery as a7, type LeavesSwapRequest as a8, getLightningReceiveRequestQuery as a9, LightningReceiveRequestStatus as aa, type LightningSendFeeEstimateOutput as ab, getLightningSendRequestQuery as ac, LightningSendRequestStatus as ad, type RequestCoopExitInput as ae, type RequestLeavesSwapInput as af, type RequestLightningReceiveInput as ag, type RequestLightningSendInput as ah, SparkCoopExitRequestStatus as ai, SparkLeavesSwapRequestStatus as aj, type SparkTransferToLeavesConnection as ak, type StaticDepositQuoteInput as al, type SwapLeaf as am, Transfer as an, type UserLeafInput as ao, type VerifyChallengeOutput as ap, mapTreeNodeToWalletLeaf as aq, TransferDirection as ar, type UserRequestType as as, type WalletTransferLeaf as at, mapTransferLeafToWalletTransferLeaf as au, mapTransferToWalletTransfer as av, generatePolynomialForSecretSharing as b, computerLagrangeCoefficients as c, splitSecretWithProofs as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, bigIntToPrivateKey as h, type SigningCommitmentWithOptionalNonce as i, type SigningNonce as j, type SigningCommitment as k, type KeyDerivation as l, modInverse as m, type SignFrostParams as n, type SplitSecretWithProofsParams as o, type DerivedHDKey as p, type KeyPair as q, recoverSecret as r, splitSecret as s, type SspClientOptions as t, type StaticDepositQuoteOutput as u, validateShare as v, type WalletTransfer as w, type LightningReceiveRequest as x, type LightningSendRequest as y, type LightningSendFeeEstimateInput as z };
|