@buildonspark/spark-sdk 0.1.44 → 0.1.46
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/{RequestLightningSendInput-BxbCtwpV.d.cts → RequestLightningSendInput-2cSh_In4.d.cts} +1 -1
- package/dist/{RequestLightningSendInput-RGel43ks.d.ts → RequestLightningSendInput-CN6BNg_g.d.ts} +1 -1
- package/dist/address/index.cjs +2 -2
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +2 -2
- package/dist/{chunk-EKFD62HN.js → chunk-4EMV7HHW.js} +2 -1
- package/dist/{chunk-4Q2ZDYYU.js → chunk-BGGEVUJK.js} +1157 -208
- package/dist/{chunk-CIZNCBKE.js → chunk-C2S227QR.js} +648 -45
- package/dist/{chunk-WPTRVD2V.js → chunk-DXR2PXJU.js} +15 -15
- package/dist/{chunk-NBCNYDWJ.js → chunk-HHNQ3ZHC.js} +2 -2
- package/dist/{chunk-DAXGVPVM.js → chunk-HSCLBJEL.js} +2 -2
- package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
- package/dist/{chunk-A2ZLMH6I.js → chunk-JB64OQES.js} +259 -327
- package/dist/{chunk-KEKGSH7B.js → chunk-KMUMFYFX.js} +3 -3
- package/dist/chunk-LHRD2WT6.js +2374 -0
- package/dist/{chunk-HTMXTJRK.js → chunk-N5VZVCGJ.js} +4 -4
- package/dist/{chunk-SQKXGAIR.js → chunk-NTFKFRQ2.js} +1 -1
- package/dist/{chunk-K4BJARWM.js → chunk-OBFKIEMP.js} +1 -1
- package/dist/{chunk-UBT6EDVJ.js → chunk-OFCJFZ4I.js} +1 -1
- package/dist/{chunk-XX4RRWOX.js → chunk-UXDODSDT.js} +8 -10
- package/dist/graphql/objects/index.d.cts +5 -4
- package/dist/graphql/objects/index.d.ts +5 -4
- package/dist/index-CKL5DodV.d.cts +214 -0
- package/dist/index-COm59SPw.d.ts +214 -0
- package/dist/index.cjs +4026 -1315
- package/dist/index.d.cts +764 -19
- package/dist/index.d.ts +764 -19
- package/dist/index.js +23 -27
- package/dist/index.node.cjs +4026 -1319
- package/dist/index.node.d.cts +10 -8
- package/dist/index.node.d.ts +10 -8
- package/dist/index.node.js +23 -31
- package/dist/native/index.cjs +4027 -1316
- package/dist/native/index.d.cts +281 -85
- package/dist/native/index.d.ts +281 -85
- package/dist/native/index.js +4018 -1307
- package/dist/{network-CfxLnaot.d.cts → network-Css46DAz.d.cts} +1 -1
- package/dist/{network-CroCOQ0B.d.ts → network-hynb7iTZ.d.ts} +1 -1
- package/dist/proto/lrc20.cjs +222 -19
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +2 -2
- package/dist/proto/spark.cjs +1154 -205
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -1
- package/dist/proto/spark_token.cjs +1377 -58
- package/dist/proto/spark_token.d.cts +153 -15
- package/dist/proto/spark_token.d.ts +153 -15
- package/dist/proto/spark_token.js +40 -4
- package/dist/{sdk-types-CTbTdDbE.d.ts → sdk-types-CKBsylfW.d.ts} +1 -1
- package/dist/{sdk-types-BeCBoozO.d.cts → sdk-types-Ct8xmN7l.d.cts} +1 -1
- package/dist/services/config.cjs +2 -2
- package/dist/services/config.d.cts +5 -4
- package/dist/services/config.d.ts +5 -4
- package/dist/services/config.js +6 -6
- package/dist/services/connection.cjs +2438 -262
- package/dist/services/connection.d.cts +5 -4
- package/dist/services/connection.d.ts +5 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +5937 -3154
- package/dist/services/index.d.cts +7 -6
- package/dist/services/index.d.ts +7 -6
- package/dist/services/index.js +17 -15
- package/dist/services/lrc-connection.cjs +223 -20
- package/dist/services/lrc-connection.d.cts +5 -4
- package/dist/services/lrc-connection.d.ts +5 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +840 -236
- package/dist/services/token-transactions.d.cts +25 -7
- package/dist/services/token-transactions.d.ts +25 -7
- package/dist/services/token-transactions.js +5 -4
- package/dist/services/wallet-config.cjs +3 -1
- package/dist/services/wallet-config.d.cts +7 -5
- package/dist/services/wallet-config.d.ts +7 -5
- package/dist/services/wallet-config.js +3 -1
- package/dist/signer/signer.cjs +1 -1
- package/dist/signer/signer.d.cts +3 -2
- package/dist/signer/signer.d.ts +3 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-D7vfYik9.d.ts → signer-BP6F__oR.d.cts} +2 -6
- package/dist/{signer-DaY8c60s.d.cts → signer-BVZJXcq7.d.ts} +2 -6
- package/dist/{spark-C4ZrsgjC.d.cts → spark-DbzGfse6.d.cts} +93 -15
- package/dist/{spark-C4ZrsgjC.d.ts → spark-DbzGfse6.d.ts} +93 -15
- package/dist/spark_bindings/native/index.cjs +183 -0
- package/dist/spark_bindings/native/index.d.cts +14 -0
- package/dist/spark_bindings/native/index.d.ts +14 -0
- package/dist/spark_bindings/native/index.js +141 -0
- package/dist/spark_bindings/wasm/index.cjs +1093 -0
- package/dist/spark_bindings/wasm/index.d.cts +47 -0
- package/dist/spark_bindings/wasm/index.d.ts +47 -0
- package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
- package/dist/types/index.cjs +1156 -208
- package/dist/types/index.d.cts +5 -4
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js +2 -2
- package/dist/types-C-Rp0Oo7.d.cts +46 -0
- package/dist/types-C-Rp0Oo7.d.ts +46 -0
- package/dist/utils/index.cjs +65 -13
- package/dist/utils/index.d.cts +14 -134
- package/dist/utils/index.d.ts +14 -134
- package/dist/utils/index.js +13 -13
- package/package.json +22 -2
- package/src/index.node.ts +0 -1
- package/src/index.ts +0 -1
- package/src/native/index.ts +1 -2
- package/src/proto/common.ts +5 -5
- package/src/proto/google/protobuf/descriptor.ts +34 -34
- package/src/proto/google/protobuf/duration.ts +2 -2
- package/src/proto/google/protobuf/empty.ts +2 -2
- package/src/proto/google/protobuf/timestamp.ts +2 -2
- package/src/proto/mock.ts +4 -4
- package/src/proto/spark.ts +1452 -185
- package/src/proto/spark_authn.ts +7 -7
- package/src/proto/spark_token.ts +1668 -105
- package/src/proto/validate/validate.ts +24 -24
- package/src/services/bolt11-spark.ts +62 -187
- package/src/services/coop-exit.ts +3 -0
- package/src/services/lrc20.ts +1 -1
- package/src/services/token-transactions.ts +197 -9
- package/src/services/transfer.ts +22 -0
- package/src/services/tree-creation.ts +13 -0
- package/src/services/wallet-config.ts +2 -2
- package/src/spark-wallet/spark-wallet.node.ts +0 -4
- package/src/spark-wallet/spark-wallet.ts +76 -108
- package/src/spark-wallet/types.ts +39 -3
- package/src/tests/bolt11-spark.test.ts +7 -15
- package/src/tests/integration/ssp/coop-exit.test.ts +7 -7
- package/src/tests/integration/swap.test.ts +453 -433
- package/src/tests/integration/transfer.test.ts +261 -248
- package/src/tests/token-identifier.test.ts +54 -0
- package/src/tests/tokens.test.ts +218 -23
- package/src/utils/token-hashing.ts +320 -44
- package/src/utils/token-identifier.ts +88 -0
- package/src/utils/token-transaction-validation.ts +350 -5
- package/src/utils/token-transactions.ts +12 -8
- package/src/utils/transaction.ts +0 -6
- package/dist/chunk-B3AMIGJG.js +0 -1073
- package/dist/index-CZmDdSts.d.cts +0 -829
- package/dist/index-ClIRO_3y.d.ts +0 -829
- package/dist/wasm-7OWFHDMS.js +0 -21
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
SignTokenTransactionResponse,
|
|
10
10
|
OperatorSpecificOwnerSignature,
|
|
11
11
|
RevocationSecretWithIndex,
|
|
12
|
+
TokenTransactionWithStatus as TokenTransactionWithStatusV0,
|
|
13
|
+
QueryTokenTransactionsRequest as QueryTokenTransactionsRequestV0,
|
|
12
14
|
} from "../proto/spark.js";
|
|
13
15
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
14
16
|
import { SparkCallOptions } from "../types/grpc.js";
|
|
@@ -21,7 +23,10 @@ import {
|
|
|
21
23
|
calculateAvailableTokenAmount,
|
|
22
24
|
checkIfSelectedOutputsAreAvailable,
|
|
23
25
|
} from "../utils/token-transactions.js";
|
|
24
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
validateTokenTransactionV0,
|
|
28
|
+
validateTokenTransaction,
|
|
29
|
+
} from "../utils/token-transaction-validation.js";
|
|
25
30
|
import { WalletConfigService } from "./config.js";
|
|
26
31
|
import { ConnectionManager } from "./connection.js";
|
|
27
32
|
import {
|
|
@@ -36,6 +41,8 @@ import {
|
|
|
36
41
|
TokenTransaction,
|
|
37
42
|
SignatureWithIndex,
|
|
38
43
|
InputTtxoSignaturesPerOperator,
|
|
44
|
+
QueryTokenTransactionsRequest as QueryTokenTransactionsRequestV1,
|
|
45
|
+
TokenTransactionWithStatus as TokenTransactionWithStatusV1,
|
|
39
46
|
} from "../proto/spark_token.js";
|
|
40
47
|
import { TokenTransaction as TokenTransactionV0 } from "../proto/spark.js";
|
|
41
48
|
import { collectResponses } from "../utils/response-validation.js";
|
|
@@ -46,6 +53,20 @@ import {
|
|
|
46
53
|
|
|
47
54
|
const MAX_TOKEN_OUTPUTS = 500;
|
|
48
55
|
|
|
56
|
+
export interface FetchOwnedTokenOutputsParams {
|
|
57
|
+
ownerPublicKeys: Uint8Array[];
|
|
58
|
+
issuerPublicKeys?: Uint8Array[];
|
|
59
|
+
tokenIdentifiers?: Uint8Array[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface QueryTokenTransactionsParams {
|
|
63
|
+
ownerPublicKeys?: string[];
|
|
64
|
+
issuerPublicKeys?: string[];
|
|
65
|
+
tokenTransactionHashes?: string[];
|
|
66
|
+
tokenIdentifiers?: string[];
|
|
67
|
+
outputIds?: string[];
|
|
68
|
+
}
|
|
69
|
+
|
|
49
70
|
export class TokenTransactionService {
|
|
50
71
|
protected readonly config: WalletConfigService;
|
|
51
72
|
protected readonly connectionManager: ConnectionManager;
|
|
@@ -272,6 +293,7 @@ export class TokenTransactionService {
|
|
|
272
293
|
tokenOutputs,
|
|
273
294
|
sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
|
|
274
295
|
expiryTime: undefined,
|
|
296
|
+
clientCreatedTimestamp: new Date(),
|
|
275
297
|
};
|
|
276
298
|
}
|
|
277
299
|
|
|
@@ -548,7 +570,7 @@ export class TokenTransactionService {
|
|
|
548
570
|
throw new Error("Keyshare info missing in start response");
|
|
549
571
|
}
|
|
550
572
|
|
|
551
|
-
|
|
573
|
+
validateTokenTransactionV0(
|
|
552
574
|
startResponse.finalTokenTransaction,
|
|
553
575
|
tokenTransaction,
|
|
554
576
|
signingOperators,
|
|
@@ -867,9 +889,34 @@ export class TokenTransactionService {
|
|
|
867
889
|
}
|
|
868
890
|
|
|
869
891
|
public async fetchOwnedTokenOutputs(
|
|
870
|
-
|
|
871
|
-
tokenPublicKeys: Uint8Array[],
|
|
892
|
+
params: FetchOwnedTokenOutputsParams,
|
|
872
893
|
): Promise<OutputWithPreviousTransactionData[]> {
|
|
894
|
+
if (this.config.getTokenTransactionVersion() === "V0") {
|
|
895
|
+
return this.fetchOwnedTokenOutputsV0(params);
|
|
896
|
+
} else {
|
|
897
|
+
return this.fetchOwnedTokenOutputsV1(params);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
public async queryTokenTransactions(
|
|
902
|
+
params: QueryTokenTransactionsParams,
|
|
903
|
+
): Promise<TokenTransactionWithStatusV0[] | TokenTransactionWithStatusV1[]> {
|
|
904
|
+
if (this.config.getTokenTransactionVersion() === "V0") {
|
|
905
|
+
return this.queryTokenTransactionsV0(params);
|
|
906
|
+
} else {
|
|
907
|
+
return this.queryTokenTransactionsV1(params);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
private async fetchOwnedTokenOutputsV0(
|
|
912
|
+
params: FetchOwnedTokenOutputsParams,
|
|
913
|
+
): Promise<OutputWithPreviousTransactionData[]> {
|
|
914
|
+
const {
|
|
915
|
+
ownerPublicKeys,
|
|
916
|
+
issuerPublicKeys: tokenPublicKeys = [],
|
|
917
|
+
tokenIdentifiers = [],
|
|
918
|
+
} = params;
|
|
919
|
+
|
|
873
920
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
874
921
|
this.config.getCoordinatorAddress(),
|
|
875
922
|
);
|
|
@@ -878,6 +925,42 @@ export class TokenTransactionService {
|
|
|
878
925
|
const result = await sparkClient.query_token_outputs({
|
|
879
926
|
ownerPublicKeys,
|
|
880
927
|
tokenPublicKeys,
|
|
928
|
+
tokenIdentifiers,
|
|
929
|
+
network: this.config.getNetworkProto(),
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
return result.outputsWithPreviousTransactionData;
|
|
933
|
+
} catch (error) {
|
|
934
|
+
throw new NetworkError(
|
|
935
|
+
"Failed to fetch owned token outputs",
|
|
936
|
+
{
|
|
937
|
+
operation: "spark.query_token_outputs",
|
|
938
|
+
errorCount: 1,
|
|
939
|
+
errors: error instanceof Error ? error.message : String(error),
|
|
940
|
+
},
|
|
941
|
+
error as Error,
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
private async fetchOwnedTokenOutputsV1(
|
|
947
|
+
params: FetchOwnedTokenOutputsParams,
|
|
948
|
+
): Promise<OutputWithPreviousTransactionData[]> {
|
|
949
|
+
const {
|
|
950
|
+
ownerPublicKeys,
|
|
951
|
+
issuerPublicKeys = [],
|
|
952
|
+
tokenIdentifiers = [],
|
|
953
|
+
} = params;
|
|
954
|
+
|
|
955
|
+
const tokenClient = await this.connectionManager.createSparkTokenClient(
|
|
956
|
+
this.config.getCoordinatorAddress(),
|
|
957
|
+
);
|
|
958
|
+
|
|
959
|
+
try {
|
|
960
|
+
const result = await tokenClient.query_token_outputs({
|
|
961
|
+
ownerPublicKeys,
|
|
962
|
+
issuerPublicKeys,
|
|
963
|
+
tokenIdentifiers,
|
|
881
964
|
network: this.config.getNetworkProto(),
|
|
882
965
|
});
|
|
883
966
|
|
|
@@ -886,7 +969,113 @@ export class TokenTransactionService {
|
|
|
886
969
|
throw new NetworkError(
|
|
887
970
|
"Failed to fetch owned token outputs",
|
|
888
971
|
{
|
|
889
|
-
operation: "query_token_outputs",
|
|
972
|
+
operation: "spark_token.query_token_outputs",
|
|
973
|
+
errorCount: 1,
|
|
974
|
+
errors: error instanceof Error ? error.message : String(error),
|
|
975
|
+
},
|
|
976
|
+
error as Error,
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
private async queryTokenTransactionsV0(
|
|
982
|
+
params: QueryTokenTransactionsParams,
|
|
983
|
+
): Promise<TokenTransactionWithStatusV1[]> {
|
|
984
|
+
const {
|
|
985
|
+
ownerPublicKeys,
|
|
986
|
+
issuerPublicKeys,
|
|
987
|
+
tokenTransactionHashes,
|
|
988
|
+
tokenIdentifiers,
|
|
989
|
+
outputIds,
|
|
990
|
+
} = params;
|
|
991
|
+
|
|
992
|
+
const sparkClient = await this.connectionManager.createSparkClient(
|
|
993
|
+
this.config.getCoordinatorAddress(),
|
|
994
|
+
);
|
|
995
|
+
|
|
996
|
+
let queryParams: QueryTokenTransactionsRequestV0 = {
|
|
997
|
+
tokenPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
|
|
998
|
+
ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
|
|
999
|
+
tokenIdentifiers: tokenIdentifiers?.map(hexToBytes)!,
|
|
1000
|
+
tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
|
|
1001
|
+
outputIds: outputIds || [],
|
|
1002
|
+
limit: 100,
|
|
1003
|
+
offset: 0,
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
try {
|
|
1007
|
+
const response = await sparkClient.query_token_transactions(queryParams);
|
|
1008
|
+
return response.tokenTransactionsWithStatus.map((tx) => {
|
|
1009
|
+
// Convert V0 structure to V1 structure
|
|
1010
|
+
const v1TokenTransaction: TokenTransaction = {
|
|
1011
|
+
version: 1,
|
|
1012
|
+
network: tx.tokenTransaction!.network,
|
|
1013
|
+
tokenInputs: tx.tokenTransaction!.tokenInputs,
|
|
1014
|
+
tokenOutputs: tx.tokenTransaction!.tokenOutputs!,
|
|
1015
|
+
sparkOperatorIdentityPublicKeys:
|
|
1016
|
+
tx.tokenTransaction!.sparkOperatorIdentityPublicKeys!,
|
|
1017
|
+
expiryTime: undefined, // V0 doesn't have expiry time
|
|
1018
|
+
clientCreatedTimestamp:
|
|
1019
|
+
tx.tokenTransaction?.tokenInputs?.$case === "mintInput"
|
|
1020
|
+
? new Date(
|
|
1021
|
+
tx.tokenTransaction.tokenInputs.mintInput
|
|
1022
|
+
.issuerProvidedTimestamp * 1000,
|
|
1023
|
+
)
|
|
1024
|
+
: new Date(),
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
return {
|
|
1028
|
+
tokenTransaction: v1TokenTransaction,
|
|
1029
|
+
status: tx.status,
|
|
1030
|
+
confirmationMetadata: tx.confirmationMetadata,
|
|
1031
|
+
};
|
|
1032
|
+
});
|
|
1033
|
+
} catch (error) {
|
|
1034
|
+
throw new NetworkError(
|
|
1035
|
+
"Failed to query token transactions",
|
|
1036
|
+
{
|
|
1037
|
+
operation: "spark.query_token_transactions",
|
|
1038
|
+
errorCount: 1,
|
|
1039
|
+
errors: error instanceof Error ? error.message : String(error),
|
|
1040
|
+
},
|
|
1041
|
+
error as Error,
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
private async queryTokenTransactionsV1(
|
|
1047
|
+
params: QueryTokenTransactionsParams,
|
|
1048
|
+
): Promise<TokenTransactionWithStatusV1[]> {
|
|
1049
|
+
const {
|
|
1050
|
+
ownerPublicKeys,
|
|
1051
|
+
issuerPublicKeys,
|
|
1052
|
+
tokenTransactionHashes,
|
|
1053
|
+
tokenIdentifiers,
|
|
1054
|
+
outputIds,
|
|
1055
|
+
} = params;
|
|
1056
|
+
|
|
1057
|
+
const tokenClient = await this.connectionManager.createSparkTokenClient(
|
|
1058
|
+
this.config.getCoordinatorAddress(),
|
|
1059
|
+
);
|
|
1060
|
+
|
|
1061
|
+
let queryParams: QueryTokenTransactionsRequestV1 = {
|
|
1062
|
+
issuerPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
|
|
1063
|
+
ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
|
|
1064
|
+
tokenIdentifiers: tokenIdentifiers?.map(hexToBytes)!,
|
|
1065
|
+
tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
|
|
1066
|
+
outputIds: outputIds || [],
|
|
1067
|
+
limit: 100,
|
|
1068
|
+
offset: 0,
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
try {
|
|
1072
|
+
const response = await tokenClient.query_token_transactions(queryParams);
|
|
1073
|
+
return response.tokenTransactionsWithStatus;
|
|
1074
|
+
} catch (error) {
|
|
1075
|
+
throw new NetworkError(
|
|
1076
|
+
"Failed to query token transactions",
|
|
1077
|
+
{
|
|
1078
|
+
operation: "spark_token.query_token_transactions",
|
|
890
1079
|
errorCount: 1,
|
|
891
1080
|
errors: error instanceof Error ? error.message : String(error),
|
|
892
1081
|
},
|
|
@@ -898,10 +1087,9 @@ export class TokenTransactionService {
|
|
|
898
1087
|
public async syncTokenOutputs(
|
|
899
1088
|
tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>,
|
|
900
1089
|
) {
|
|
901
|
-
const unsortedTokenOutputs = await this.fetchOwnedTokenOutputs(
|
|
902
|
-
await this.config.signer.getTrackedPublicKeys(),
|
|
903
|
-
|
|
904
|
-
);
|
|
1090
|
+
const unsortedTokenOutputs = await this.fetchOwnedTokenOutputs({
|
|
1091
|
+
ownerPublicKeys: await this.config.signer.getTrackedPublicKeys(),
|
|
1092
|
+
});
|
|
905
1093
|
|
|
906
1094
|
unsortedTokenOutputs.forEach((output) => {
|
|
907
1095
|
const tokenKey = bytesToHex(output.output!.tokenPublicKey!);
|
package/src/services/transfer.ts
CHANGED
|
@@ -295,6 +295,9 @@ export class BaseTransferService {
|
|
|
295
295
|
leavesToSend: leafSigningJobs,
|
|
296
296
|
keyTweakPackage: encryptedKeyTweaks,
|
|
297
297
|
userSignature: new Uint8Array(),
|
|
298
|
+
// TODO: Add direct refund signature
|
|
299
|
+
directLeavesToSend: [],
|
|
300
|
+
directFromCpfpLeavesToSend: [],
|
|
298
301
|
};
|
|
299
302
|
|
|
300
303
|
const transferPackageSigningPayload = getTransferPackageSigningPayload(
|
|
@@ -426,6 +429,10 @@ export class BaseTransferService {
|
|
|
426
429
|
nodeId: operatorSigningResult.leafId,
|
|
427
430
|
refundTxSignature: refundAggregate,
|
|
428
431
|
nodeTxSignature: new Uint8Array(),
|
|
432
|
+
// TODO: Add direct refund signature
|
|
433
|
+
directNodeTxSignature: new Uint8Array(),
|
|
434
|
+
directRefundTxSignature: new Uint8Array(),
|
|
435
|
+
directFromCpfpRefundTxSignature: new Uint8Array(),
|
|
429
436
|
});
|
|
430
437
|
}
|
|
431
438
|
return nodeSignatures;
|
|
@@ -532,6 +539,9 @@ export class BaseTransferService {
|
|
|
532
539
|
secretCipher,
|
|
533
540
|
signature,
|
|
534
541
|
refundSignature: refundSignature ?? new Uint8Array(),
|
|
542
|
+
// TODO: Add direct refund signature
|
|
543
|
+
directRefundSignature: new Uint8Array(),
|
|
544
|
+
directFromCpfpRefundSignature: new Uint8Array(),
|
|
535
545
|
});
|
|
536
546
|
}
|
|
537
547
|
|
|
@@ -930,6 +940,10 @@ export class TransferService extends BaseTransferService {
|
|
|
930
940
|
rawTx: refundTx.toBytes(),
|
|
931
941
|
signingNonceCommitment: refundNonceCommitmentProto,
|
|
932
942
|
},
|
|
943
|
+
// TODO: Add direct refund signature
|
|
944
|
+
directRefundTxSigningJob: undefined,
|
|
945
|
+
// TODO: Add direct refund signature
|
|
946
|
+
directFromCpfpRefundTxSigningJob: undefined,
|
|
933
947
|
});
|
|
934
948
|
}
|
|
935
949
|
|
|
@@ -1397,6 +1411,10 @@ export class TransferService extends BaseTransferService {
|
|
|
1397
1411
|
nodeId: nodeId,
|
|
1398
1412
|
nodeTxSignature: signature,
|
|
1399
1413
|
refundTxSignature: new Uint8Array(),
|
|
1414
|
+
// TODO: Add direct refund signature
|
|
1415
|
+
directNodeTxSignature: new Uint8Array(),
|
|
1416
|
+
directRefundTxSignature: new Uint8Array(),
|
|
1417
|
+
directFromCpfpRefundTxSignature: new Uint8Array(),
|
|
1400
1418
|
});
|
|
1401
1419
|
} else if (i === nodes.length) {
|
|
1402
1420
|
refundSignature = signature;
|
|
@@ -1414,6 +1432,10 @@ export class TransferService extends BaseTransferService {
|
|
|
1414
1432
|
nodeId: leafNodeId,
|
|
1415
1433
|
nodeTxSignature: leafSignature,
|
|
1416
1434
|
refundTxSignature: refundSignature,
|
|
1435
|
+
// TODO: Add direct refund signature
|
|
1436
|
+
directNodeTxSignature: new Uint8Array(),
|
|
1437
|
+
directRefundTxSignature: new Uint8Array(),
|
|
1438
|
+
directFromCpfpRefundTxSignature: new Uint8Array(),
|
|
1417
1439
|
});
|
|
1418
1440
|
|
|
1419
1441
|
const result = await sparkClient.finalize_node_signatures({
|
|
@@ -315,6 +315,9 @@ export class TreeCreationService {
|
|
|
315
315
|
nodeTxSigningJob: undefined,
|
|
316
316
|
refundTxSigningJob: undefined,
|
|
317
317
|
children: [],
|
|
318
|
+
directNodeTxSigningJob: undefined,
|
|
319
|
+
directRefundTxSigningJob: undefined,
|
|
320
|
+
directFromCpfpRefundTxSigningJob: undefined,
|
|
318
321
|
};
|
|
319
322
|
|
|
320
323
|
const tx = new Transaction({ version: 3 });
|
|
@@ -353,6 +356,9 @@ export class TreeCreationService {
|
|
|
353
356
|
nodeTxSigningJob: undefined,
|
|
354
357
|
refundTxSigningJob: undefined,
|
|
355
358
|
children: [],
|
|
359
|
+
directNodeTxSigningJob: undefined,
|
|
360
|
+
directRefundTxSigningJob: undefined,
|
|
361
|
+
directFromCpfpRefundTxSigningJob: undefined,
|
|
356
362
|
};
|
|
357
363
|
|
|
358
364
|
const childTx = new Transaction({ version: 3 });
|
|
@@ -464,6 +470,9 @@ export class TreeCreationService {
|
|
|
464
470
|
nodeTxSigningJob: rootNodeSigningJob,
|
|
465
471
|
refundTxSigningJob: undefined,
|
|
466
472
|
children: [],
|
|
473
|
+
directNodeTxSigningJob: undefined,
|
|
474
|
+
directRefundTxSigningJob: undefined,
|
|
475
|
+
directFromCpfpRefundTxSigningJob: undefined,
|
|
467
476
|
};
|
|
468
477
|
rootCreationNode.nodeTxSigningCommitment = rootNodeSigningCommitment;
|
|
469
478
|
|
|
@@ -584,6 +593,10 @@ export class TreeCreationService {
|
|
|
584
593
|
nodeId: creationResponseNode.nodeId,
|
|
585
594
|
nodeTxSignature: nodeTxSignature,
|
|
586
595
|
refundTxSignature: refundTxSignature,
|
|
596
|
+
// TODO: Add direct refund signature
|
|
597
|
+
directNodeTxSignature: new Uint8Array(),
|
|
598
|
+
directRefundTxSignature: new Uint8Array(),
|
|
599
|
+
directFromCpfpRefundTxSignature: new Uint8Array(),
|
|
587
600
|
},
|
|
588
601
|
};
|
|
589
602
|
}
|
|
@@ -166,7 +166,7 @@ function getLocalFrostSignerAddress(): string {
|
|
|
166
166
|
return isHermeticTest() ? "localhost:9999" : "unix:///tmp/frost_0.sock";
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
const BASE_CONFIG: Required<ConfigOptions> = {
|
|
169
|
+
export const BASE_CONFIG: Required<ConfigOptions> = {
|
|
170
170
|
network: "LOCAL",
|
|
171
171
|
lrc20Address: getLrc20Url("LOCAL"),
|
|
172
172
|
coodinatorIdentifier:
|
|
@@ -175,7 +175,7 @@ const BASE_CONFIG: Required<ConfigOptions> = {
|
|
|
175
175
|
threshold: 2,
|
|
176
176
|
signingOperators: getLocalSigningOperators(),
|
|
177
177
|
tokenSignatures: "SCHNORR",
|
|
178
|
-
tokenTransactionVersion: "
|
|
178
|
+
tokenTransactionVersion: "V1",
|
|
179
179
|
tokenValidityDurationSeconds: 180,
|
|
180
180
|
electrsUrl: getElectrsUrl("LOCAL"),
|
|
181
181
|
expectedWithdrawBondSats: 10000,
|
|
@@ -66,10 +66,6 @@ export class SparkWallet extends BaseSparkWallet {
|
|
|
66
66
|
"SparkWallet.getTransfers",
|
|
67
67
|
this.getTransfers.bind(this),
|
|
68
68
|
);
|
|
69
|
-
this.getTokenInfo = this.wrapWithOtelSpan(
|
|
70
|
-
"SparkWallet.getTokenInfo",
|
|
71
|
-
this.getTokenInfo.bind(this),
|
|
72
|
-
);
|
|
73
69
|
this.getBalance = this.wrapWithOtelSpan(
|
|
74
70
|
"SparkWallet.getBalance",
|
|
75
71
|
this.getBalance.bind(this),
|