@buildonspark/spark-sdk 0.1.39 → 0.1.41
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 +14 -0
- package/README.md +1 -1
- package/dist/{RequestLightningSendInput-39_zGri6.d.cts → RequestLightningSendInput-DXcLoiCe.d.cts} +10 -2
- package/dist/{RequestLightningSendInput-B4JdzclX.d.ts → RequestLightningSendInput-mXUWn_cp.d.ts} +10 -2
- package/dist/address/index.cjs +138 -6
- package/dist/address/index.d.cts +18 -6
- package/dist/address/index.d.ts +18 -6
- package/dist/address/index.js +5 -2
- package/dist/{chunk-FWQPAPXK.js → chunk-2ZXXLPG2.js} +1 -1
- package/dist/{chunk-S7KD6DDL.js → chunk-6YVPOQ2A.js} +41 -20
- package/dist/{chunk-ZUVYYR5T.js → chunk-7EFSUADA.js} +1 -0
- package/dist/{chunk-NS4UZRQ7.js → chunk-ABZA6R5S.js} +1 -1
- package/dist/{chunk-57XLH3ZR.js → chunk-ATEHMLKP.js} +23 -23
- package/dist/{chunk-VJTDG4BQ.js → chunk-HK6LPV6Z.js} +10 -1
- package/dist/{chunk-W3EC5XSA.js → chunk-J5W5Q2ZP.js} +337 -72
- package/dist/{chunk-TKYOYOYJ.js → chunk-KKSU7OZO.js} +653 -76
- package/dist/chunk-L3EHBOUX.js +0 -0
- package/dist/{chunk-C5LTJBI7.js → chunk-M6A4KFIG.js} +125 -226
- package/dist/{chunk-A74XSEW3.js → chunk-MIVX3GHD.js} +1 -1
- package/dist/{chunk-RGWBSZIO.js → chunk-ROKY5KS4.js} +23 -3
- package/dist/{chunk-LIP2K6KR.js → chunk-TM4TOEOX.js} +26 -8
- package/dist/{chunk-RAPBVYJY.js → chunk-UKT6OFLO.js} +125 -35
- package/dist/chunk-VA7MV4MZ.js +1073 -0
- package/dist/chunk-YEZDPUFY.js +840 -0
- package/dist/{chunk-DI7QXUQJ.js → chunk-ZXDE2XMU.js} +8 -5
- package/dist/graphql/objects/index.cjs +6 -3
- package/dist/graphql/objects/index.d.cts +6 -5
- package/dist/graphql/objects/index.d.ts +6 -5
- package/dist/graphql/objects/index.js +1 -1
- package/dist/{index-DEo_hdN3.d.cts → index-CFh4uWzi.d.cts} +60 -6
- package/dist/{index-BVY0yH_H.d.ts → index-OSDtPMmC.d.ts} +60 -6
- package/dist/index.cjs +3316 -954
- package/dist/index.d.cts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +48 -26
- package/dist/index.node.cjs +3316 -954
- package/dist/index.node.d.cts +9 -8
- package/dist/index.node.d.ts +9 -8
- package/dist/index.node.js +48 -26
- package/dist/native/index.cjs +3323 -961
- package/dist/native/index.d.cts +542 -260
- package/dist/native/index.d.ts +542 -260
- package/dist/native/index.js +3192 -838
- package/dist/{network-DobHpaV6.d.ts → network-BF2GYPye.d.ts} +9 -2
- package/dist/{network-GFGEHkS4.d.cts → network-BiwBmoOg.d.cts} +9 -2
- 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 +125 -226
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -5
- package/dist/proto/spark_token.cjs +1364 -0
- package/dist/proto/spark_token.d.cts +209 -0
- package/dist/proto/spark_token.d.ts +209 -0
- package/dist/proto/spark_token.js +32 -0
- package/dist/{sdk-types-BuVMn2rX.d.cts → sdk-types-CfhdFnsA.d.cts} +1 -1
- package/dist/{sdk-types-BeI6DM_M.d.ts → sdk-types-MnQrHolg.d.ts} +1 -1
- package/dist/services/config.cjs +64 -40
- package/dist/services/config.d.cts +6 -5
- package/dist/services/config.d.ts +6 -5
- package/dist/services/config.js +7 -7
- package/dist/services/connection.cjs +1108 -306
- package/dist/services/connection.d.cts +10 -5
- package/dist/services/connection.d.ts +10 -5
- package/dist/services/connection.js +3 -2
- package/dist/services/index.cjs +1702 -488
- package/dist/services/index.d.cts +6 -5
- package/dist/services/index.d.ts +6 -5
- package/dist/services/index.js +16 -14
- package/dist/services/lrc-connection.d.cts +5 -5
- package/dist/services/lrc-connection.d.ts +5 -5
- package/dist/services/lrc-connection.js +3 -3
- package/dist/services/token-transactions.cjs +637 -247
- package/dist/services/token-transactions.d.cts +19 -8
- package/dist/services/token-transactions.d.ts +19 -8
- package/dist/services/token-transactions.js +5 -4
- package/dist/services/wallet-config.cjs +1 -0
- package/dist/services/wallet-config.d.cts +6 -5
- package/dist/services/wallet-config.d.ts +6 -5
- package/dist/services/wallet-config.js +1 -1
- package/dist/signer/signer.cjs +122 -35
- package/dist/signer/signer.d.cts +4 -3
- package/dist/signer/signer.d.ts +4 -3
- package/dist/signer/signer.js +8 -4
- package/dist/{signer-C1t40Wus.d.cts → signer-BhLS7SYR.d.cts} +35 -14
- package/dist/{signer-DFGw9RRp.d.ts → signer-CylxIujU.d.ts} +35 -14
- package/dist/{spark-DXYE9gMM.d.ts → spark-DjR1b3TC.d.cts} +13 -21
- package/dist/{spark-DXYE9gMM.d.cts → spark-DjR1b3TC.d.ts} +13 -21
- package/dist/types/index.cjs +130 -227
- package/dist/types/index.d.cts +6 -5
- package/dist/types/index.d.ts +6 -5
- package/dist/types/index.js +3 -3
- package/dist/utils/index.cjs +1169 -3
- package/dist/utils/index.d.cts +66 -6
- package/dist/utils/index.d.ts +66 -6
- package/dist/utils/index.js +35 -14
- package/package.json +6 -2
- package/src/address/address.ts +41 -6
- package/src/graphql/client.ts +15 -0
- package/src/graphql/objects/Transfer.ts +7 -0
- package/src/graphql/queries/Transfer.ts +10 -0
- package/src/proto/spark.ts +215 -337
- package/src/proto/spark_token.ts +1407 -0
- package/src/services/config.ts +4 -0
- package/src/services/connection.ts +37 -1
- package/src/services/deposit.ts +23 -5
- package/src/services/token-transactions.ts +426 -75
- package/src/services/transfer.ts +182 -11
- package/src/services/tree-creation.ts +29 -14
- package/src/services/wallet-config.ts +2 -0
- package/src/signer/signer.ts +190 -48
- package/src/spark-wallet/spark-wallet.ts +510 -6
- package/src/tests/integration/transfer.test.ts +186 -214
- package/src/tests/integration/tree-creation.test.ts +5 -1
- package/src/tests/signer.test.ts +34 -0
- package/src/tests/transaction.test.ts +12 -0
- package/src/tests/xchain-address.test.ts +28 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/mempool.ts +26 -1
- package/src/utils/network.ts +15 -0
- package/src/utils/transaction.ts +51 -3
- package/src/utils/unilateral-exit.ts +729 -0
- package/src/utils/xchain-address.ts +36 -0
- package/dist/chunk-E5SL7XTO.js +0 -301
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
|
+
import { CallOptions, CallContext } from 'nice-grpc-common';
|
|
3
|
+
import { N as Network, S as SigningKeyshare } from '../spark-DjR1b3TC.cjs';
|
|
4
|
+
|
|
5
|
+
declare const protobufPackage = "spark_token";
|
|
6
|
+
/**
|
|
7
|
+
* This proto is constructed by the wallet to specify leaves it wants to spend
|
|
8
|
+
* as part of the token transaction.
|
|
9
|
+
*/
|
|
10
|
+
interface TokenOutputToSpend {
|
|
11
|
+
prevTokenTransactionHash: Uint8Array;
|
|
12
|
+
prevTokenTransactionVout: number;
|
|
13
|
+
}
|
|
14
|
+
declare const TokenOutputToSpend: MessageFns<TokenOutputToSpend>;
|
|
15
|
+
interface TokenTransferInput {
|
|
16
|
+
outputsToSpend: TokenOutputToSpend[];
|
|
17
|
+
}
|
|
18
|
+
declare const TokenTransferInput: MessageFns<TokenTransferInput>;
|
|
19
|
+
interface TokenMintInput {
|
|
20
|
+
issuerPublicKey: Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* Issuer provided timestamp of when the transaction was signed/constructed.
|
|
23
|
+
* Helps provide idempotency and ensures that each mint input signature is
|
|
24
|
+
* unique as long as multiple mint signatures are not happening at the same
|
|
25
|
+
* time. Also gives a potentially useful data point for when the issuer
|
|
26
|
+
* authorized from their perspective. Note that we have no way of proving
|
|
27
|
+
* this is accurate.
|
|
28
|
+
* TODO: Consider whether implementing generic idempotency controls and/or a
|
|
29
|
+
* random nonce would be favorable to populating this field.
|
|
30
|
+
*/
|
|
31
|
+
issuerProvidedTimestamp: number;
|
|
32
|
+
}
|
|
33
|
+
declare const TokenMintInput: MessageFns<TokenMintInput>;
|
|
34
|
+
/**
|
|
35
|
+
* This proto is constructed by the wallet to specify outputs it wants to create
|
|
36
|
+
* as part of a token transaction. Output id and revocation public key should
|
|
37
|
+
* remain unfilled so that the SE can fill them as part of the
|
|
38
|
+
* StartTokenTransaction() call.
|
|
39
|
+
*/
|
|
40
|
+
interface TokenOutput {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
ownerPublicKey: Uint8Array;
|
|
43
|
+
revocationCommitment?: Uint8Array | undefined;
|
|
44
|
+
withdrawBondSats?: number | undefined;
|
|
45
|
+
withdrawRelativeBlockLocktime?: number | undefined;
|
|
46
|
+
tokenPublicKey: Uint8Array;
|
|
47
|
+
/** Decoded uint128 */
|
|
48
|
+
tokenAmount: Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
declare const TokenOutput: MessageFns<TokenOutput>;
|
|
51
|
+
/**
|
|
52
|
+
* This proto is constructed by the wallet and is the core transaction data
|
|
53
|
+
* structure. This proto is deterministically hashed to generate the
|
|
54
|
+
* token_transaction_hash that is cooperatively signed by the SO group to
|
|
55
|
+
* confirm a token transaction.
|
|
56
|
+
*/
|
|
57
|
+
interface TokenTransaction {
|
|
58
|
+
/**
|
|
59
|
+
* For mint transactions issuer_public_key will be specified without any
|
|
60
|
+
* outputs_to_spend. For transfer transactions the token amount in the input
|
|
61
|
+
* leaves must match the token amount in the output leaves.
|
|
62
|
+
*/
|
|
63
|
+
version: number;
|
|
64
|
+
tokenInputs?: {
|
|
65
|
+
$case: "mintInput";
|
|
66
|
+
mintInput: TokenMintInput;
|
|
67
|
+
} | {
|
|
68
|
+
$case: "transferInput";
|
|
69
|
+
transferInput: TokenTransferInput;
|
|
70
|
+
} | undefined;
|
|
71
|
+
tokenOutputs: TokenOutput[];
|
|
72
|
+
sparkOperatorIdentityPublicKeys: Uint8Array[];
|
|
73
|
+
/**
|
|
74
|
+
* Server-set expiry time. The server calculates this by adding the client's
|
|
75
|
+
* requested validity_duration_seconds to the server's current time when
|
|
76
|
+
* creating the final transaction.
|
|
77
|
+
*/
|
|
78
|
+
expiryTime: Date | undefined;
|
|
79
|
+
network: Network;
|
|
80
|
+
}
|
|
81
|
+
declare const TokenTransaction: MessageFns<TokenTransaction>;
|
|
82
|
+
interface SignatureWithIndex {
|
|
83
|
+
/**
|
|
84
|
+
* This is a Schnorr or ECDSA DER signature which can be between 64 and 73
|
|
85
|
+
* bytes.
|
|
86
|
+
*/
|
|
87
|
+
signature: Uint8Array;
|
|
88
|
+
/** The index of the TTXO associated with this signature. */
|
|
89
|
+
inputIndex: number;
|
|
90
|
+
}
|
|
91
|
+
declare const SignatureWithIndex: MessageFns<SignatureWithIndex>;
|
|
92
|
+
/**
|
|
93
|
+
* A group of signatures for the input TTXOs binding them to the final token
|
|
94
|
+
* transaction hash. This bundle of signatures is specific to a given operator.
|
|
95
|
+
*/
|
|
96
|
+
interface InputTtxoSignaturesPerOperator {
|
|
97
|
+
ttxoSignatures: SignatureWithIndex[];
|
|
98
|
+
operatorIdentityPublicKey: Uint8Array;
|
|
99
|
+
}
|
|
100
|
+
declare const InputTtxoSignaturesPerOperator: MessageFns<InputTtxoSignaturesPerOperator>;
|
|
101
|
+
/** === Start Transaction === */
|
|
102
|
+
interface StartTransactionRequest {
|
|
103
|
+
identityPublicKey: Uint8Array;
|
|
104
|
+
partialTokenTransaction: TokenTransaction | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Filled by signing the partial token transaction hash with the
|
|
107
|
+
* owner/issuer private key. For mint transactions this will be one
|
|
108
|
+
* signature for the input issuer_public_key For transfer transactions this
|
|
109
|
+
* will be one for each output for the output owner_public_key
|
|
110
|
+
*/
|
|
111
|
+
partialTokenTransactionOwnerSignatures: SignatureWithIndex[];
|
|
112
|
+
/**
|
|
113
|
+
* How long the transaction should be valid for, in seconds.
|
|
114
|
+
* The server will set the actual expiry_time in the final transaction based
|
|
115
|
+
* on this duration. Must be between 1 and 300 seconds.
|
|
116
|
+
*/
|
|
117
|
+
validityDurationSeconds: number;
|
|
118
|
+
}
|
|
119
|
+
declare const StartTransactionRequest: MessageFns<StartTransactionRequest>;
|
|
120
|
+
interface StartTransactionResponse {
|
|
121
|
+
finalTokenTransaction: TokenTransaction | undefined;
|
|
122
|
+
keyshareInfo: SigningKeyshare | undefined;
|
|
123
|
+
}
|
|
124
|
+
declare const StartTransactionResponse: MessageFns<StartTransactionResponse>;
|
|
125
|
+
interface CommitTransactionRequest {
|
|
126
|
+
finalTokenTransaction: TokenTransaction | undefined;
|
|
127
|
+
finalTokenTransactionHash: Uint8Array;
|
|
128
|
+
inputTtxoSignaturesPerOperator: InputTtxoSignaturesPerOperator[];
|
|
129
|
+
ownerIdentityPublicKey: Uint8Array;
|
|
130
|
+
}
|
|
131
|
+
declare const CommitTransactionRequest: MessageFns<CommitTransactionRequest>;
|
|
132
|
+
interface CommitTransactionResponse {
|
|
133
|
+
}
|
|
134
|
+
declare const CommitTransactionResponse: MessageFns<CommitTransactionResponse>;
|
|
135
|
+
type SparkTokenServiceDefinition = typeof SparkTokenServiceDefinition;
|
|
136
|
+
declare const SparkTokenServiceDefinition: {
|
|
137
|
+
readonly name: "SparkTokenService";
|
|
138
|
+
readonly fullName: "spark_token.SparkTokenService";
|
|
139
|
+
readonly methods: {
|
|
140
|
+
/**
|
|
141
|
+
* Start process to create final token transaction with all inputs required
|
|
142
|
+
* from user and SOs (including revocation secret commitment)
|
|
143
|
+
*/
|
|
144
|
+
readonly start_transaction: {
|
|
145
|
+
readonly name: "start_transaction";
|
|
146
|
+
readonly requestType: MessageFns<StartTransactionRequest>;
|
|
147
|
+
readonly requestStream: false;
|
|
148
|
+
readonly responseType: MessageFns<StartTransactionResponse>;
|
|
149
|
+
readonly responseStream: false;
|
|
150
|
+
readonly options: {};
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
154
|
+
* coordinated by one SO.
|
|
155
|
+
*/
|
|
156
|
+
readonly commit_transaction: {
|
|
157
|
+
readonly name: "commit_transaction";
|
|
158
|
+
readonly requestType: MessageFns<CommitTransactionRequest>;
|
|
159
|
+
readonly requestStream: false;
|
|
160
|
+
readonly responseType: MessageFns<CommitTransactionResponse>;
|
|
161
|
+
readonly responseStream: false;
|
|
162
|
+
readonly options: {};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
interface SparkTokenServiceImplementation<CallContextExt = {}> {
|
|
167
|
+
/**
|
|
168
|
+
* Start process to create final token transaction with all inputs required
|
|
169
|
+
* from user and SOs (including revocation secret commitment)
|
|
170
|
+
*/
|
|
171
|
+
start_transaction(request: StartTransactionRequest, context: CallContext & CallContextExt): Promise<DeepPartial<StartTransactionResponse>>;
|
|
172
|
+
/**
|
|
173
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
174
|
+
* coordinated by one SO.
|
|
175
|
+
*/
|
|
176
|
+
commit_transaction(request: CommitTransactionRequest, context: CallContext & CallContextExt): Promise<DeepPartial<CommitTransactionResponse>>;
|
|
177
|
+
}
|
|
178
|
+
interface SparkTokenServiceClient<CallOptionsExt = {}> {
|
|
179
|
+
/**
|
|
180
|
+
* Start process to create final token transaction with all inputs required
|
|
181
|
+
* from user and SOs (including revocation secret commitment)
|
|
182
|
+
*/
|
|
183
|
+
start_transaction(request: DeepPartial<StartTransactionRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTransactionResponse>;
|
|
184
|
+
/**
|
|
185
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
186
|
+
* coordinated by one SO.
|
|
187
|
+
*/
|
|
188
|
+
commit_transaction(request: DeepPartial<CommitTransactionRequest>, options?: CallOptions & CallOptionsExt): Promise<CommitTransactionResponse>;
|
|
189
|
+
}
|
|
190
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
191
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
192
|
+
$case: string;
|
|
193
|
+
} ? {
|
|
194
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
195
|
+
} & {
|
|
196
|
+
$case: T["$case"];
|
|
197
|
+
} : T extends {} ? {
|
|
198
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
199
|
+
} : Partial<T>;
|
|
200
|
+
interface MessageFns<T> {
|
|
201
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
202
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
203
|
+
fromJSON(object: any): T;
|
|
204
|
+
toJSON(message: T): unknown;
|
|
205
|
+
create(base?: DeepPartial<T>): T;
|
|
206
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { CommitTransactionRequest, CommitTransactionResponse, type DeepPartial, InputTtxoSignaturesPerOperator, type MessageFns, SignatureWithIndex, type SparkTokenServiceClient, SparkTokenServiceDefinition, type SparkTokenServiceImplementation, StartTransactionRequest, StartTransactionResponse, TokenMintInput, TokenOutput, TokenOutputToSpend, TokenTransaction, TokenTransferInput, protobufPackage };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
|
+
import { CallOptions, CallContext } from 'nice-grpc-common';
|
|
3
|
+
import { N as Network, S as SigningKeyshare } from '../spark-DjR1b3TC.js';
|
|
4
|
+
|
|
5
|
+
declare const protobufPackage = "spark_token";
|
|
6
|
+
/**
|
|
7
|
+
* This proto is constructed by the wallet to specify leaves it wants to spend
|
|
8
|
+
* as part of the token transaction.
|
|
9
|
+
*/
|
|
10
|
+
interface TokenOutputToSpend {
|
|
11
|
+
prevTokenTransactionHash: Uint8Array;
|
|
12
|
+
prevTokenTransactionVout: number;
|
|
13
|
+
}
|
|
14
|
+
declare const TokenOutputToSpend: MessageFns<TokenOutputToSpend>;
|
|
15
|
+
interface TokenTransferInput {
|
|
16
|
+
outputsToSpend: TokenOutputToSpend[];
|
|
17
|
+
}
|
|
18
|
+
declare const TokenTransferInput: MessageFns<TokenTransferInput>;
|
|
19
|
+
interface TokenMintInput {
|
|
20
|
+
issuerPublicKey: Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* Issuer provided timestamp of when the transaction was signed/constructed.
|
|
23
|
+
* Helps provide idempotency and ensures that each mint input signature is
|
|
24
|
+
* unique as long as multiple mint signatures are not happening at the same
|
|
25
|
+
* time. Also gives a potentially useful data point for when the issuer
|
|
26
|
+
* authorized from their perspective. Note that we have no way of proving
|
|
27
|
+
* this is accurate.
|
|
28
|
+
* TODO: Consider whether implementing generic idempotency controls and/or a
|
|
29
|
+
* random nonce would be favorable to populating this field.
|
|
30
|
+
*/
|
|
31
|
+
issuerProvidedTimestamp: number;
|
|
32
|
+
}
|
|
33
|
+
declare const TokenMintInput: MessageFns<TokenMintInput>;
|
|
34
|
+
/**
|
|
35
|
+
* This proto is constructed by the wallet to specify outputs it wants to create
|
|
36
|
+
* as part of a token transaction. Output id and revocation public key should
|
|
37
|
+
* remain unfilled so that the SE can fill them as part of the
|
|
38
|
+
* StartTokenTransaction() call.
|
|
39
|
+
*/
|
|
40
|
+
interface TokenOutput {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
ownerPublicKey: Uint8Array;
|
|
43
|
+
revocationCommitment?: Uint8Array | undefined;
|
|
44
|
+
withdrawBondSats?: number | undefined;
|
|
45
|
+
withdrawRelativeBlockLocktime?: number | undefined;
|
|
46
|
+
tokenPublicKey: Uint8Array;
|
|
47
|
+
/** Decoded uint128 */
|
|
48
|
+
tokenAmount: Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
declare const TokenOutput: MessageFns<TokenOutput>;
|
|
51
|
+
/**
|
|
52
|
+
* This proto is constructed by the wallet and is the core transaction data
|
|
53
|
+
* structure. This proto is deterministically hashed to generate the
|
|
54
|
+
* token_transaction_hash that is cooperatively signed by the SO group to
|
|
55
|
+
* confirm a token transaction.
|
|
56
|
+
*/
|
|
57
|
+
interface TokenTransaction {
|
|
58
|
+
/**
|
|
59
|
+
* For mint transactions issuer_public_key will be specified without any
|
|
60
|
+
* outputs_to_spend. For transfer transactions the token amount in the input
|
|
61
|
+
* leaves must match the token amount in the output leaves.
|
|
62
|
+
*/
|
|
63
|
+
version: number;
|
|
64
|
+
tokenInputs?: {
|
|
65
|
+
$case: "mintInput";
|
|
66
|
+
mintInput: TokenMintInput;
|
|
67
|
+
} | {
|
|
68
|
+
$case: "transferInput";
|
|
69
|
+
transferInput: TokenTransferInput;
|
|
70
|
+
} | undefined;
|
|
71
|
+
tokenOutputs: TokenOutput[];
|
|
72
|
+
sparkOperatorIdentityPublicKeys: Uint8Array[];
|
|
73
|
+
/**
|
|
74
|
+
* Server-set expiry time. The server calculates this by adding the client's
|
|
75
|
+
* requested validity_duration_seconds to the server's current time when
|
|
76
|
+
* creating the final transaction.
|
|
77
|
+
*/
|
|
78
|
+
expiryTime: Date | undefined;
|
|
79
|
+
network: Network;
|
|
80
|
+
}
|
|
81
|
+
declare const TokenTransaction: MessageFns<TokenTransaction>;
|
|
82
|
+
interface SignatureWithIndex {
|
|
83
|
+
/**
|
|
84
|
+
* This is a Schnorr or ECDSA DER signature which can be between 64 and 73
|
|
85
|
+
* bytes.
|
|
86
|
+
*/
|
|
87
|
+
signature: Uint8Array;
|
|
88
|
+
/** The index of the TTXO associated with this signature. */
|
|
89
|
+
inputIndex: number;
|
|
90
|
+
}
|
|
91
|
+
declare const SignatureWithIndex: MessageFns<SignatureWithIndex>;
|
|
92
|
+
/**
|
|
93
|
+
* A group of signatures for the input TTXOs binding them to the final token
|
|
94
|
+
* transaction hash. This bundle of signatures is specific to a given operator.
|
|
95
|
+
*/
|
|
96
|
+
interface InputTtxoSignaturesPerOperator {
|
|
97
|
+
ttxoSignatures: SignatureWithIndex[];
|
|
98
|
+
operatorIdentityPublicKey: Uint8Array;
|
|
99
|
+
}
|
|
100
|
+
declare const InputTtxoSignaturesPerOperator: MessageFns<InputTtxoSignaturesPerOperator>;
|
|
101
|
+
/** === Start Transaction === */
|
|
102
|
+
interface StartTransactionRequest {
|
|
103
|
+
identityPublicKey: Uint8Array;
|
|
104
|
+
partialTokenTransaction: TokenTransaction | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Filled by signing the partial token transaction hash with the
|
|
107
|
+
* owner/issuer private key. For mint transactions this will be one
|
|
108
|
+
* signature for the input issuer_public_key For transfer transactions this
|
|
109
|
+
* will be one for each output for the output owner_public_key
|
|
110
|
+
*/
|
|
111
|
+
partialTokenTransactionOwnerSignatures: SignatureWithIndex[];
|
|
112
|
+
/**
|
|
113
|
+
* How long the transaction should be valid for, in seconds.
|
|
114
|
+
* The server will set the actual expiry_time in the final transaction based
|
|
115
|
+
* on this duration. Must be between 1 and 300 seconds.
|
|
116
|
+
*/
|
|
117
|
+
validityDurationSeconds: number;
|
|
118
|
+
}
|
|
119
|
+
declare const StartTransactionRequest: MessageFns<StartTransactionRequest>;
|
|
120
|
+
interface StartTransactionResponse {
|
|
121
|
+
finalTokenTransaction: TokenTransaction | undefined;
|
|
122
|
+
keyshareInfo: SigningKeyshare | undefined;
|
|
123
|
+
}
|
|
124
|
+
declare const StartTransactionResponse: MessageFns<StartTransactionResponse>;
|
|
125
|
+
interface CommitTransactionRequest {
|
|
126
|
+
finalTokenTransaction: TokenTransaction | undefined;
|
|
127
|
+
finalTokenTransactionHash: Uint8Array;
|
|
128
|
+
inputTtxoSignaturesPerOperator: InputTtxoSignaturesPerOperator[];
|
|
129
|
+
ownerIdentityPublicKey: Uint8Array;
|
|
130
|
+
}
|
|
131
|
+
declare const CommitTransactionRequest: MessageFns<CommitTransactionRequest>;
|
|
132
|
+
interface CommitTransactionResponse {
|
|
133
|
+
}
|
|
134
|
+
declare const CommitTransactionResponse: MessageFns<CommitTransactionResponse>;
|
|
135
|
+
type SparkTokenServiceDefinition = typeof SparkTokenServiceDefinition;
|
|
136
|
+
declare const SparkTokenServiceDefinition: {
|
|
137
|
+
readonly name: "SparkTokenService";
|
|
138
|
+
readonly fullName: "spark_token.SparkTokenService";
|
|
139
|
+
readonly methods: {
|
|
140
|
+
/**
|
|
141
|
+
* Start process to create final token transaction with all inputs required
|
|
142
|
+
* from user and SOs (including revocation secret commitment)
|
|
143
|
+
*/
|
|
144
|
+
readonly start_transaction: {
|
|
145
|
+
readonly name: "start_transaction";
|
|
146
|
+
readonly requestType: MessageFns<StartTransactionRequest>;
|
|
147
|
+
readonly requestStream: false;
|
|
148
|
+
readonly responseType: MessageFns<StartTransactionResponse>;
|
|
149
|
+
readonly responseStream: false;
|
|
150
|
+
readonly options: {};
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
154
|
+
* coordinated by one SO.
|
|
155
|
+
*/
|
|
156
|
+
readonly commit_transaction: {
|
|
157
|
+
readonly name: "commit_transaction";
|
|
158
|
+
readonly requestType: MessageFns<CommitTransactionRequest>;
|
|
159
|
+
readonly requestStream: false;
|
|
160
|
+
readonly responseType: MessageFns<CommitTransactionResponse>;
|
|
161
|
+
readonly responseStream: false;
|
|
162
|
+
readonly options: {};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
interface SparkTokenServiceImplementation<CallContextExt = {}> {
|
|
167
|
+
/**
|
|
168
|
+
* Start process to create final token transaction with all inputs required
|
|
169
|
+
* from user and SOs (including revocation secret commitment)
|
|
170
|
+
*/
|
|
171
|
+
start_transaction(request: StartTransactionRequest, context: CallContext & CallContextExt): Promise<DeepPartial<StartTransactionResponse>>;
|
|
172
|
+
/**
|
|
173
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
174
|
+
* coordinated by one SO.
|
|
175
|
+
*/
|
|
176
|
+
commit_transaction(request: CommitTransactionRequest, context: CallContext & CallContextExt): Promise<DeepPartial<CommitTransactionResponse>>;
|
|
177
|
+
}
|
|
178
|
+
interface SparkTokenServiceClient<CallOptionsExt = {}> {
|
|
179
|
+
/**
|
|
180
|
+
* Start process to create final token transaction with all inputs required
|
|
181
|
+
* from user and SOs (including revocation secret commitment)
|
|
182
|
+
*/
|
|
183
|
+
start_transaction(request: DeepPartial<StartTransactionRequest>, options?: CallOptions & CallOptionsExt): Promise<StartTransactionResponse>;
|
|
184
|
+
/**
|
|
185
|
+
* Complete the transaction and commit it with all SOs. This will be
|
|
186
|
+
* coordinated by one SO.
|
|
187
|
+
*/
|
|
188
|
+
commit_transaction(request: DeepPartial<CommitTransactionRequest>, options?: CallOptions & CallOptionsExt): Promise<CommitTransactionResponse>;
|
|
189
|
+
}
|
|
190
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
191
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
192
|
+
$case: string;
|
|
193
|
+
} ? {
|
|
194
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
195
|
+
} & {
|
|
196
|
+
$case: T["$case"];
|
|
197
|
+
} : T extends {} ? {
|
|
198
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
199
|
+
} : Partial<T>;
|
|
200
|
+
interface MessageFns<T> {
|
|
201
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
202
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
203
|
+
fromJSON(object: any): T;
|
|
204
|
+
toJSON(message: T): unknown;
|
|
205
|
+
create(base?: DeepPartial<T>): T;
|
|
206
|
+
fromPartial(object: DeepPartial<T>): T;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { CommitTransactionRequest, CommitTransactionResponse, type DeepPartial, InputTtxoSignaturesPerOperator, type MessageFns, SignatureWithIndex, type SparkTokenServiceClient, SparkTokenServiceDefinition, type SparkTokenServiceImplementation, StartTransactionRequest, StartTransactionResponse, TokenMintInput, TokenOutput, TokenOutputToSpend, TokenTransaction, TokenTransferInput, protobufPackage };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CommitTransactionRequest,
|
|
3
|
+
CommitTransactionResponse,
|
|
4
|
+
InputTtxoSignaturesPerOperator,
|
|
5
|
+
SignatureWithIndex,
|
|
6
|
+
SparkTokenServiceDefinition,
|
|
7
|
+
StartTransactionRequest,
|
|
8
|
+
StartTransactionResponse,
|
|
9
|
+
TokenMintInput,
|
|
10
|
+
TokenOutput,
|
|
11
|
+
TokenOutputToSpend,
|
|
12
|
+
TokenTransaction,
|
|
13
|
+
TokenTransferInput,
|
|
14
|
+
protobufPackage
|
|
15
|
+
} from "../chunk-VA7MV4MZ.js";
|
|
16
|
+
import "../chunk-M6A4KFIG.js";
|
|
17
|
+
import "../chunk-MVRQ5US7.js";
|
|
18
|
+
export {
|
|
19
|
+
CommitTransactionRequest,
|
|
20
|
+
CommitTransactionResponse,
|
|
21
|
+
InputTtxoSignaturesPerOperator,
|
|
22
|
+
SignatureWithIndex,
|
|
23
|
+
SparkTokenServiceDefinition,
|
|
24
|
+
StartTransactionRequest,
|
|
25
|
+
StartTransactionResponse,
|
|
26
|
+
TokenMintInput,
|
|
27
|
+
TokenOutput,
|
|
28
|
+
TokenOutputToSpend,
|
|
29
|
+
TokenTransaction,
|
|
30
|
+
TokenTransferInput,
|
|
31
|
+
protobufPackage
|
|
32
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TransferStatus, S as SigningKeyshare, N as Network, a as TransferType, b as TreeNode, d as TransferLeaf, e as Transfer } from './spark-DjR1b3TC.cjs';
|
|
2
2
|
|
|
3
3
|
interface WalletLeaf {
|
|
4
4
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TransferStatus, S as SigningKeyshare, N as Network, a as TransferType, b as TreeNode, d as TransferLeaf, e as Transfer } from './spark-DjR1b3TC.js';
|
|
2
2
|
|
|
3
3
|
interface WalletLeaf {
|
|
4
4
|
id: string;
|