@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
package/dist/chunk-B3AMIGJG.js
DELETED
|
@@ -1,1073 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SigningKeyshare,
|
|
3
|
-
Timestamp,
|
|
4
|
-
networkFromJSON,
|
|
5
|
-
networkToJSON
|
|
6
|
-
} from "./chunk-4Q2ZDYYU.js";
|
|
7
|
-
|
|
8
|
-
// src/proto/spark_token.ts
|
|
9
|
-
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
10
|
-
var protobufPackage = "spark_token";
|
|
11
|
-
function createBaseTokenOutputToSpend() {
|
|
12
|
-
return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
|
|
13
|
-
}
|
|
14
|
-
var TokenOutputToSpend = {
|
|
15
|
-
encode(message, writer = new BinaryWriter()) {
|
|
16
|
-
if (message.prevTokenTransactionHash.length !== 0) {
|
|
17
|
-
writer.uint32(10).bytes(message.prevTokenTransactionHash);
|
|
18
|
-
}
|
|
19
|
-
if (message.prevTokenTransactionVout !== 0) {
|
|
20
|
-
writer.uint32(16).uint32(message.prevTokenTransactionVout);
|
|
21
|
-
}
|
|
22
|
-
return writer;
|
|
23
|
-
},
|
|
24
|
-
decode(input, length) {
|
|
25
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
26
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
27
|
-
const message = createBaseTokenOutputToSpend();
|
|
28
|
-
while (reader.pos < end) {
|
|
29
|
-
const tag = reader.uint32();
|
|
30
|
-
switch (tag >>> 3) {
|
|
31
|
-
case 1: {
|
|
32
|
-
if (tag !== 10) {
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
message.prevTokenTransactionHash = reader.bytes();
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
case 2: {
|
|
39
|
-
if (tag !== 16) {
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
message.prevTokenTransactionVout = reader.uint32();
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
reader.skip(tag & 7);
|
|
50
|
-
}
|
|
51
|
-
return message;
|
|
52
|
-
},
|
|
53
|
-
fromJSON(object) {
|
|
54
|
-
return {
|
|
55
|
-
prevTokenTransactionHash: isSet(object.prevTokenTransactionHash) ? bytesFromBase64(object.prevTokenTransactionHash) : new Uint8Array(0),
|
|
56
|
-
prevTokenTransactionVout: isSet(object.prevTokenTransactionVout) ? globalThis.Number(object.prevTokenTransactionVout) : 0
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
toJSON(message) {
|
|
60
|
-
const obj = {};
|
|
61
|
-
if (message.prevTokenTransactionHash.length !== 0) {
|
|
62
|
-
obj.prevTokenTransactionHash = base64FromBytes(message.prevTokenTransactionHash);
|
|
63
|
-
}
|
|
64
|
-
if (message.prevTokenTransactionVout !== 0) {
|
|
65
|
-
obj.prevTokenTransactionVout = Math.round(message.prevTokenTransactionVout);
|
|
66
|
-
}
|
|
67
|
-
return obj;
|
|
68
|
-
},
|
|
69
|
-
create(base) {
|
|
70
|
-
return TokenOutputToSpend.fromPartial(base ?? {});
|
|
71
|
-
},
|
|
72
|
-
fromPartial(object) {
|
|
73
|
-
const message = createBaseTokenOutputToSpend();
|
|
74
|
-
message.prevTokenTransactionHash = object.prevTokenTransactionHash ?? new Uint8Array(0);
|
|
75
|
-
message.prevTokenTransactionVout = object.prevTokenTransactionVout ?? 0;
|
|
76
|
-
return message;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
function createBaseTokenTransferInput() {
|
|
80
|
-
return { outputsToSpend: [] };
|
|
81
|
-
}
|
|
82
|
-
var TokenTransferInput = {
|
|
83
|
-
encode(message, writer = new BinaryWriter()) {
|
|
84
|
-
for (const v of message.outputsToSpend) {
|
|
85
|
-
TokenOutputToSpend.encode(v, writer.uint32(10).fork()).join();
|
|
86
|
-
}
|
|
87
|
-
return writer;
|
|
88
|
-
},
|
|
89
|
-
decode(input, length) {
|
|
90
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
91
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
92
|
-
const message = createBaseTokenTransferInput();
|
|
93
|
-
while (reader.pos < end) {
|
|
94
|
-
const tag = reader.uint32();
|
|
95
|
-
switch (tag >>> 3) {
|
|
96
|
-
case 1: {
|
|
97
|
-
if (tag !== 10) {
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
message.outputsToSpend.push(TokenOutputToSpend.decode(reader, reader.uint32()));
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
reader.skip(tag & 7);
|
|
108
|
-
}
|
|
109
|
-
return message;
|
|
110
|
-
},
|
|
111
|
-
fromJSON(object) {
|
|
112
|
-
return {
|
|
113
|
-
outputsToSpend: globalThis.Array.isArray(object?.outputsToSpend) ? object.outputsToSpend.map((e) => TokenOutputToSpend.fromJSON(e)) : []
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
toJSON(message) {
|
|
117
|
-
const obj = {};
|
|
118
|
-
if (message.outputsToSpend?.length) {
|
|
119
|
-
obj.outputsToSpend = message.outputsToSpend.map((e) => TokenOutputToSpend.toJSON(e));
|
|
120
|
-
}
|
|
121
|
-
return obj;
|
|
122
|
-
},
|
|
123
|
-
create(base) {
|
|
124
|
-
return TokenTransferInput.fromPartial(base ?? {});
|
|
125
|
-
},
|
|
126
|
-
fromPartial(object) {
|
|
127
|
-
const message = createBaseTokenTransferInput();
|
|
128
|
-
message.outputsToSpend = object.outputsToSpend?.map((e) => TokenOutputToSpend.fromPartial(e)) || [];
|
|
129
|
-
return message;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
function createBaseTokenMintInput() {
|
|
133
|
-
return { issuerPublicKey: new Uint8Array(0), issuerProvidedTimestamp: 0 };
|
|
134
|
-
}
|
|
135
|
-
var TokenMintInput = {
|
|
136
|
-
encode(message, writer = new BinaryWriter()) {
|
|
137
|
-
if (message.issuerPublicKey.length !== 0) {
|
|
138
|
-
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
139
|
-
}
|
|
140
|
-
if (message.issuerProvidedTimestamp !== 0) {
|
|
141
|
-
writer.uint32(16).uint64(message.issuerProvidedTimestamp);
|
|
142
|
-
}
|
|
143
|
-
return writer;
|
|
144
|
-
},
|
|
145
|
-
decode(input, length) {
|
|
146
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
147
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
148
|
-
const message = createBaseTokenMintInput();
|
|
149
|
-
while (reader.pos < end) {
|
|
150
|
-
const tag = reader.uint32();
|
|
151
|
-
switch (tag >>> 3) {
|
|
152
|
-
case 1: {
|
|
153
|
-
if (tag !== 10) {
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
message.issuerPublicKey = reader.bytes();
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
case 2: {
|
|
160
|
-
if (tag !== 16) {
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
message.issuerProvidedTimestamp = longToNumber(reader.uint64());
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
reader.skip(tag & 7);
|
|
171
|
-
}
|
|
172
|
-
return message;
|
|
173
|
-
},
|
|
174
|
-
fromJSON(object) {
|
|
175
|
-
return {
|
|
176
|
-
issuerPublicKey: isSet(object.issuerPublicKey) ? bytesFromBase64(object.issuerPublicKey) : new Uint8Array(0),
|
|
177
|
-
issuerProvidedTimestamp: isSet(object.issuerProvidedTimestamp) ? globalThis.Number(object.issuerProvidedTimestamp) : 0
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
toJSON(message) {
|
|
181
|
-
const obj = {};
|
|
182
|
-
if (message.issuerPublicKey.length !== 0) {
|
|
183
|
-
obj.issuerPublicKey = base64FromBytes(message.issuerPublicKey);
|
|
184
|
-
}
|
|
185
|
-
if (message.issuerProvidedTimestamp !== 0) {
|
|
186
|
-
obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
|
|
187
|
-
}
|
|
188
|
-
return obj;
|
|
189
|
-
},
|
|
190
|
-
create(base) {
|
|
191
|
-
return TokenMintInput.fromPartial(base ?? {});
|
|
192
|
-
},
|
|
193
|
-
fromPartial(object) {
|
|
194
|
-
const message = createBaseTokenMintInput();
|
|
195
|
-
message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
|
|
196
|
-
message.issuerProvidedTimestamp = object.issuerProvidedTimestamp ?? 0;
|
|
197
|
-
return message;
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
function createBaseTokenOutput() {
|
|
201
|
-
return {
|
|
202
|
-
id: void 0,
|
|
203
|
-
ownerPublicKey: new Uint8Array(0),
|
|
204
|
-
revocationCommitment: void 0,
|
|
205
|
-
withdrawBondSats: void 0,
|
|
206
|
-
withdrawRelativeBlockLocktime: void 0,
|
|
207
|
-
tokenPublicKey: new Uint8Array(0),
|
|
208
|
-
tokenAmount: new Uint8Array(0)
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
var TokenOutput = {
|
|
212
|
-
encode(message, writer = new BinaryWriter()) {
|
|
213
|
-
if (message.id !== void 0) {
|
|
214
|
-
writer.uint32(10).string(message.id);
|
|
215
|
-
}
|
|
216
|
-
if (message.ownerPublicKey.length !== 0) {
|
|
217
|
-
writer.uint32(18).bytes(message.ownerPublicKey);
|
|
218
|
-
}
|
|
219
|
-
if (message.revocationCommitment !== void 0) {
|
|
220
|
-
writer.uint32(26).bytes(message.revocationCommitment);
|
|
221
|
-
}
|
|
222
|
-
if (message.withdrawBondSats !== void 0) {
|
|
223
|
-
writer.uint32(32).uint64(message.withdrawBondSats);
|
|
224
|
-
}
|
|
225
|
-
if (message.withdrawRelativeBlockLocktime !== void 0) {
|
|
226
|
-
writer.uint32(40).uint64(message.withdrawRelativeBlockLocktime);
|
|
227
|
-
}
|
|
228
|
-
if (message.tokenPublicKey.length !== 0) {
|
|
229
|
-
writer.uint32(50).bytes(message.tokenPublicKey);
|
|
230
|
-
}
|
|
231
|
-
if (message.tokenAmount.length !== 0) {
|
|
232
|
-
writer.uint32(58).bytes(message.tokenAmount);
|
|
233
|
-
}
|
|
234
|
-
return writer;
|
|
235
|
-
},
|
|
236
|
-
decode(input, length) {
|
|
237
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
238
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
239
|
-
const message = createBaseTokenOutput();
|
|
240
|
-
while (reader.pos < end) {
|
|
241
|
-
const tag = reader.uint32();
|
|
242
|
-
switch (tag >>> 3) {
|
|
243
|
-
case 1: {
|
|
244
|
-
if (tag !== 10) {
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
message.id = reader.string();
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
case 2: {
|
|
251
|
-
if (tag !== 18) {
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
message.ownerPublicKey = reader.bytes();
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
case 3: {
|
|
258
|
-
if (tag !== 26) {
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
message.revocationCommitment = reader.bytes();
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
case 4: {
|
|
265
|
-
if (tag !== 32) {
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
message.withdrawBondSats = longToNumber(reader.uint64());
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
case 5: {
|
|
272
|
-
if (tag !== 40) {
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
message.withdrawRelativeBlockLocktime = longToNumber(reader.uint64());
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
case 6: {
|
|
279
|
-
if (tag !== 50) {
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
message.tokenPublicKey = reader.bytes();
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
case 7: {
|
|
286
|
-
if (tag !== 58) {
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
message.tokenAmount = reader.bytes();
|
|
290
|
-
continue;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
reader.skip(tag & 7);
|
|
297
|
-
}
|
|
298
|
-
return message;
|
|
299
|
-
},
|
|
300
|
-
fromJSON(object) {
|
|
301
|
-
return {
|
|
302
|
-
id: isSet(object.id) ? globalThis.String(object.id) : void 0,
|
|
303
|
-
ownerPublicKey: isSet(object.ownerPublicKey) ? bytesFromBase64(object.ownerPublicKey) : new Uint8Array(0),
|
|
304
|
-
revocationCommitment: isSet(object.revocationCommitment) ? bytesFromBase64(object.revocationCommitment) : void 0,
|
|
305
|
-
withdrawBondSats: isSet(object.withdrawBondSats) ? globalThis.Number(object.withdrawBondSats) : void 0,
|
|
306
|
-
withdrawRelativeBlockLocktime: isSet(object.withdrawRelativeBlockLocktime) ? globalThis.Number(object.withdrawRelativeBlockLocktime) : void 0,
|
|
307
|
-
tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : new Uint8Array(0),
|
|
308
|
-
tokenAmount: isSet(object.tokenAmount) ? bytesFromBase64(object.tokenAmount) : new Uint8Array(0)
|
|
309
|
-
};
|
|
310
|
-
},
|
|
311
|
-
toJSON(message) {
|
|
312
|
-
const obj = {};
|
|
313
|
-
if (message.id !== void 0) {
|
|
314
|
-
obj.id = message.id;
|
|
315
|
-
}
|
|
316
|
-
if (message.ownerPublicKey.length !== 0) {
|
|
317
|
-
obj.ownerPublicKey = base64FromBytes(message.ownerPublicKey);
|
|
318
|
-
}
|
|
319
|
-
if (message.revocationCommitment !== void 0) {
|
|
320
|
-
obj.revocationCommitment = base64FromBytes(message.revocationCommitment);
|
|
321
|
-
}
|
|
322
|
-
if (message.withdrawBondSats !== void 0) {
|
|
323
|
-
obj.withdrawBondSats = Math.round(message.withdrawBondSats);
|
|
324
|
-
}
|
|
325
|
-
if (message.withdrawRelativeBlockLocktime !== void 0) {
|
|
326
|
-
obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
|
|
327
|
-
}
|
|
328
|
-
if (message.tokenPublicKey.length !== 0) {
|
|
329
|
-
obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
|
|
330
|
-
}
|
|
331
|
-
if (message.tokenAmount.length !== 0) {
|
|
332
|
-
obj.tokenAmount = base64FromBytes(message.tokenAmount);
|
|
333
|
-
}
|
|
334
|
-
return obj;
|
|
335
|
-
},
|
|
336
|
-
create(base) {
|
|
337
|
-
return TokenOutput.fromPartial(base ?? {});
|
|
338
|
-
},
|
|
339
|
-
fromPartial(object) {
|
|
340
|
-
const message = createBaseTokenOutput();
|
|
341
|
-
message.id = object.id ?? void 0;
|
|
342
|
-
message.ownerPublicKey = object.ownerPublicKey ?? new Uint8Array(0);
|
|
343
|
-
message.revocationCommitment = object.revocationCommitment ?? void 0;
|
|
344
|
-
message.withdrawBondSats = object.withdrawBondSats ?? void 0;
|
|
345
|
-
message.withdrawRelativeBlockLocktime = object.withdrawRelativeBlockLocktime ?? void 0;
|
|
346
|
-
message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
|
|
347
|
-
message.tokenAmount = object.tokenAmount ?? new Uint8Array(0);
|
|
348
|
-
return message;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
function createBaseTokenTransaction() {
|
|
352
|
-
return {
|
|
353
|
-
version: 0,
|
|
354
|
-
tokenInputs: void 0,
|
|
355
|
-
tokenOutputs: [],
|
|
356
|
-
sparkOperatorIdentityPublicKeys: [],
|
|
357
|
-
expiryTime: void 0,
|
|
358
|
-
network: 0
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
var TokenTransaction = {
|
|
362
|
-
encode(message, writer = new BinaryWriter()) {
|
|
363
|
-
if (message.version !== 0) {
|
|
364
|
-
writer.uint32(8).uint32(message.version);
|
|
365
|
-
}
|
|
366
|
-
switch (message.tokenInputs?.$case) {
|
|
367
|
-
case "mintInput":
|
|
368
|
-
TokenMintInput.encode(message.tokenInputs.mintInput, writer.uint32(18).fork()).join();
|
|
369
|
-
break;
|
|
370
|
-
case "transferInput":
|
|
371
|
-
TokenTransferInput.encode(message.tokenInputs.transferInput, writer.uint32(26).fork()).join();
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
for (const v of message.tokenOutputs) {
|
|
375
|
-
TokenOutput.encode(v, writer.uint32(34).fork()).join();
|
|
376
|
-
}
|
|
377
|
-
for (const v of message.sparkOperatorIdentityPublicKeys) {
|
|
378
|
-
writer.uint32(42).bytes(v);
|
|
379
|
-
}
|
|
380
|
-
if (message.expiryTime !== void 0) {
|
|
381
|
-
Timestamp.encode(toTimestamp(message.expiryTime), writer.uint32(50).fork()).join();
|
|
382
|
-
}
|
|
383
|
-
if (message.network !== 0) {
|
|
384
|
-
writer.uint32(56).int32(message.network);
|
|
385
|
-
}
|
|
386
|
-
return writer;
|
|
387
|
-
},
|
|
388
|
-
decode(input, length) {
|
|
389
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
390
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
391
|
-
const message = createBaseTokenTransaction();
|
|
392
|
-
while (reader.pos < end) {
|
|
393
|
-
const tag = reader.uint32();
|
|
394
|
-
switch (tag >>> 3) {
|
|
395
|
-
case 1: {
|
|
396
|
-
if (tag !== 8) {
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
message.version = reader.uint32();
|
|
400
|
-
continue;
|
|
401
|
-
}
|
|
402
|
-
case 2: {
|
|
403
|
-
if (tag !== 18) {
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
message.tokenInputs = { $case: "mintInput", mintInput: TokenMintInput.decode(reader, reader.uint32()) };
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
case 3: {
|
|
410
|
-
if (tag !== 26) {
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
message.tokenInputs = {
|
|
414
|
-
$case: "transferInput",
|
|
415
|
-
transferInput: TokenTransferInput.decode(reader, reader.uint32())
|
|
416
|
-
};
|
|
417
|
-
continue;
|
|
418
|
-
}
|
|
419
|
-
case 4: {
|
|
420
|
-
if (tag !== 34) {
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
message.tokenOutputs.push(TokenOutput.decode(reader, reader.uint32()));
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
case 5: {
|
|
427
|
-
if (tag !== 42) {
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
message.sparkOperatorIdentityPublicKeys.push(reader.bytes());
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
case 6: {
|
|
434
|
-
if (tag !== 50) {
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
message.expiryTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
case 7: {
|
|
441
|
-
if (tag !== 56) {
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
message.network = reader.int32();
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
reader.skip(tag & 7);
|
|
452
|
-
}
|
|
453
|
-
return message;
|
|
454
|
-
},
|
|
455
|
-
fromJSON(object) {
|
|
456
|
-
return {
|
|
457
|
-
version: isSet(object.version) ? globalThis.Number(object.version) : 0,
|
|
458
|
-
tokenInputs: isSet(object.mintInput) ? { $case: "mintInput", mintInput: TokenMintInput.fromJSON(object.mintInput) } : isSet(object.transferInput) ? { $case: "transferInput", transferInput: TokenTransferInput.fromJSON(object.transferInput) } : void 0,
|
|
459
|
-
tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs) ? object.tokenOutputs.map((e) => TokenOutput.fromJSON(e)) : [],
|
|
460
|
-
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase64(e)) : [],
|
|
461
|
-
expiryTime: isSet(object.expiryTime) ? fromJsonTimestamp(object.expiryTime) : void 0,
|
|
462
|
-
network: isSet(object.network) ? networkFromJSON(object.network) : 0
|
|
463
|
-
};
|
|
464
|
-
},
|
|
465
|
-
toJSON(message) {
|
|
466
|
-
const obj = {};
|
|
467
|
-
if (message.version !== 0) {
|
|
468
|
-
obj.version = Math.round(message.version);
|
|
469
|
-
}
|
|
470
|
-
if (message.tokenInputs?.$case === "mintInput") {
|
|
471
|
-
obj.mintInput = TokenMintInput.toJSON(message.tokenInputs.mintInput);
|
|
472
|
-
} else if (message.tokenInputs?.$case === "transferInput") {
|
|
473
|
-
obj.transferInput = TokenTransferInput.toJSON(message.tokenInputs.transferInput);
|
|
474
|
-
}
|
|
475
|
-
if (message.tokenOutputs?.length) {
|
|
476
|
-
obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput.toJSON(e));
|
|
477
|
-
}
|
|
478
|
-
if (message.sparkOperatorIdentityPublicKeys?.length) {
|
|
479
|
-
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) => base64FromBytes(e));
|
|
480
|
-
}
|
|
481
|
-
if (message.expiryTime !== void 0) {
|
|
482
|
-
obj.expiryTime = message.expiryTime.toISOString();
|
|
483
|
-
}
|
|
484
|
-
if (message.network !== 0) {
|
|
485
|
-
obj.network = networkToJSON(message.network);
|
|
486
|
-
}
|
|
487
|
-
return obj;
|
|
488
|
-
},
|
|
489
|
-
create(base) {
|
|
490
|
-
return TokenTransaction.fromPartial(base ?? {});
|
|
491
|
-
},
|
|
492
|
-
fromPartial(object) {
|
|
493
|
-
const message = createBaseTokenTransaction();
|
|
494
|
-
message.version = object.version ?? 0;
|
|
495
|
-
switch (object.tokenInputs?.$case) {
|
|
496
|
-
case "mintInput": {
|
|
497
|
-
if (object.tokenInputs?.mintInput !== void 0 && object.tokenInputs?.mintInput !== null) {
|
|
498
|
-
message.tokenInputs = {
|
|
499
|
-
$case: "mintInput",
|
|
500
|
-
mintInput: TokenMintInput.fromPartial(object.tokenInputs.mintInput)
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
case "transferInput": {
|
|
506
|
-
if (object.tokenInputs?.transferInput !== void 0 && object.tokenInputs?.transferInput !== null) {
|
|
507
|
-
message.tokenInputs = {
|
|
508
|
-
$case: "transferInput",
|
|
509
|
-
transferInput: TokenTransferInput.fromPartial(object.tokenInputs.transferInput)
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
break;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
message.tokenOutputs = object.tokenOutputs?.map((e) => TokenOutput.fromPartial(e)) || [];
|
|
516
|
-
message.sparkOperatorIdentityPublicKeys = object.sparkOperatorIdentityPublicKeys?.map((e) => e) || [];
|
|
517
|
-
message.expiryTime = object.expiryTime ?? void 0;
|
|
518
|
-
message.network = object.network ?? 0;
|
|
519
|
-
return message;
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
function createBaseSignatureWithIndex() {
|
|
523
|
-
return { signature: new Uint8Array(0), inputIndex: 0 };
|
|
524
|
-
}
|
|
525
|
-
var SignatureWithIndex = {
|
|
526
|
-
encode(message, writer = new BinaryWriter()) {
|
|
527
|
-
if (message.signature.length !== 0) {
|
|
528
|
-
writer.uint32(10).bytes(message.signature);
|
|
529
|
-
}
|
|
530
|
-
if (message.inputIndex !== 0) {
|
|
531
|
-
writer.uint32(16).uint32(message.inputIndex);
|
|
532
|
-
}
|
|
533
|
-
return writer;
|
|
534
|
-
},
|
|
535
|
-
decode(input, length) {
|
|
536
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
537
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
538
|
-
const message = createBaseSignatureWithIndex();
|
|
539
|
-
while (reader.pos < end) {
|
|
540
|
-
const tag = reader.uint32();
|
|
541
|
-
switch (tag >>> 3) {
|
|
542
|
-
case 1: {
|
|
543
|
-
if (tag !== 10) {
|
|
544
|
-
break;
|
|
545
|
-
}
|
|
546
|
-
message.signature = reader.bytes();
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
case 2: {
|
|
550
|
-
if (tag !== 16) {
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
message.inputIndex = reader.uint32();
|
|
554
|
-
continue;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
reader.skip(tag & 7);
|
|
561
|
-
}
|
|
562
|
-
return message;
|
|
563
|
-
},
|
|
564
|
-
fromJSON(object) {
|
|
565
|
-
return {
|
|
566
|
-
signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0),
|
|
567
|
-
inputIndex: isSet(object.inputIndex) ? globalThis.Number(object.inputIndex) : 0
|
|
568
|
-
};
|
|
569
|
-
},
|
|
570
|
-
toJSON(message) {
|
|
571
|
-
const obj = {};
|
|
572
|
-
if (message.signature.length !== 0) {
|
|
573
|
-
obj.signature = base64FromBytes(message.signature);
|
|
574
|
-
}
|
|
575
|
-
if (message.inputIndex !== 0) {
|
|
576
|
-
obj.inputIndex = Math.round(message.inputIndex);
|
|
577
|
-
}
|
|
578
|
-
return obj;
|
|
579
|
-
},
|
|
580
|
-
create(base) {
|
|
581
|
-
return SignatureWithIndex.fromPartial(base ?? {});
|
|
582
|
-
},
|
|
583
|
-
fromPartial(object) {
|
|
584
|
-
const message = createBaseSignatureWithIndex();
|
|
585
|
-
message.signature = object.signature ?? new Uint8Array(0);
|
|
586
|
-
message.inputIndex = object.inputIndex ?? 0;
|
|
587
|
-
return message;
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
function createBaseInputTtxoSignaturesPerOperator() {
|
|
591
|
-
return { ttxoSignatures: [], operatorIdentityPublicKey: new Uint8Array(0) };
|
|
592
|
-
}
|
|
593
|
-
var InputTtxoSignaturesPerOperator = {
|
|
594
|
-
encode(message, writer = new BinaryWriter()) {
|
|
595
|
-
for (const v of message.ttxoSignatures) {
|
|
596
|
-
SignatureWithIndex.encode(v, writer.uint32(10).fork()).join();
|
|
597
|
-
}
|
|
598
|
-
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
599
|
-
writer.uint32(18).bytes(message.operatorIdentityPublicKey);
|
|
600
|
-
}
|
|
601
|
-
return writer;
|
|
602
|
-
},
|
|
603
|
-
decode(input, length) {
|
|
604
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
605
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
606
|
-
const message = createBaseInputTtxoSignaturesPerOperator();
|
|
607
|
-
while (reader.pos < end) {
|
|
608
|
-
const tag = reader.uint32();
|
|
609
|
-
switch (tag >>> 3) {
|
|
610
|
-
case 1: {
|
|
611
|
-
if (tag !== 10) {
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
614
|
-
message.ttxoSignatures.push(SignatureWithIndex.decode(reader, reader.uint32()));
|
|
615
|
-
continue;
|
|
616
|
-
}
|
|
617
|
-
case 2: {
|
|
618
|
-
if (tag !== 18) {
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
message.operatorIdentityPublicKey = reader.bytes();
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
reader.skip(tag & 7);
|
|
629
|
-
}
|
|
630
|
-
return message;
|
|
631
|
-
},
|
|
632
|
-
fromJSON(object) {
|
|
633
|
-
return {
|
|
634
|
-
ttxoSignatures: globalThis.Array.isArray(object?.ttxoSignatures) ? object.ttxoSignatures.map((e) => SignatureWithIndex.fromJSON(e)) : [],
|
|
635
|
-
operatorIdentityPublicKey: isSet(object.operatorIdentityPublicKey) ? bytesFromBase64(object.operatorIdentityPublicKey) : new Uint8Array(0)
|
|
636
|
-
};
|
|
637
|
-
},
|
|
638
|
-
toJSON(message) {
|
|
639
|
-
const obj = {};
|
|
640
|
-
if (message.ttxoSignatures?.length) {
|
|
641
|
-
obj.ttxoSignatures = message.ttxoSignatures.map((e) => SignatureWithIndex.toJSON(e));
|
|
642
|
-
}
|
|
643
|
-
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
644
|
-
obj.operatorIdentityPublicKey = base64FromBytes(message.operatorIdentityPublicKey);
|
|
645
|
-
}
|
|
646
|
-
return obj;
|
|
647
|
-
},
|
|
648
|
-
create(base) {
|
|
649
|
-
return InputTtxoSignaturesPerOperator.fromPartial(base ?? {});
|
|
650
|
-
},
|
|
651
|
-
fromPartial(object) {
|
|
652
|
-
const message = createBaseInputTtxoSignaturesPerOperator();
|
|
653
|
-
message.ttxoSignatures = object.ttxoSignatures?.map((e) => SignatureWithIndex.fromPartial(e)) || [];
|
|
654
|
-
message.operatorIdentityPublicKey = object.operatorIdentityPublicKey ?? new Uint8Array(0);
|
|
655
|
-
return message;
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
function createBaseStartTransactionRequest() {
|
|
659
|
-
return {
|
|
660
|
-
identityPublicKey: new Uint8Array(0),
|
|
661
|
-
partialTokenTransaction: void 0,
|
|
662
|
-
partialTokenTransactionOwnerSignatures: [],
|
|
663
|
-
validityDurationSeconds: 0
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
var StartTransactionRequest = {
|
|
667
|
-
encode(message, writer = new BinaryWriter()) {
|
|
668
|
-
if (message.identityPublicKey.length !== 0) {
|
|
669
|
-
writer.uint32(10).bytes(message.identityPublicKey);
|
|
670
|
-
}
|
|
671
|
-
if (message.partialTokenTransaction !== void 0) {
|
|
672
|
-
TokenTransaction.encode(message.partialTokenTransaction, writer.uint32(18).fork()).join();
|
|
673
|
-
}
|
|
674
|
-
for (const v of message.partialTokenTransactionOwnerSignatures) {
|
|
675
|
-
SignatureWithIndex.encode(v, writer.uint32(26).fork()).join();
|
|
676
|
-
}
|
|
677
|
-
if (message.validityDurationSeconds !== 0) {
|
|
678
|
-
writer.uint32(32).uint64(message.validityDurationSeconds);
|
|
679
|
-
}
|
|
680
|
-
return writer;
|
|
681
|
-
},
|
|
682
|
-
decode(input, length) {
|
|
683
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
684
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
685
|
-
const message = createBaseStartTransactionRequest();
|
|
686
|
-
while (reader.pos < end) {
|
|
687
|
-
const tag = reader.uint32();
|
|
688
|
-
switch (tag >>> 3) {
|
|
689
|
-
case 1: {
|
|
690
|
-
if (tag !== 10) {
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
message.identityPublicKey = reader.bytes();
|
|
694
|
-
continue;
|
|
695
|
-
}
|
|
696
|
-
case 2: {
|
|
697
|
-
if (tag !== 18) {
|
|
698
|
-
break;
|
|
699
|
-
}
|
|
700
|
-
message.partialTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
|
|
701
|
-
continue;
|
|
702
|
-
}
|
|
703
|
-
case 3: {
|
|
704
|
-
if (tag !== 26) {
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
message.partialTokenTransactionOwnerSignatures.push(SignatureWithIndex.decode(reader, reader.uint32()));
|
|
708
|
-
continue;
|
|
709
|
-
}
|
|
710
|
-
case 4: {
|
|
711
|
-
if (tag !== 32) {
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
message.validityDurationSeconds = longToNumber(reader.uint64());
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
719
|
-
break;
|
|
720
|
-
}
|
|
721
|
-
reader.skip(tag & 7);
|
|
722
|
-
}
|
|
723
|
-
return message;
|
|
724
|
-
},
|
|
725
|
-
fromJSON(object) {
|
|
726
|
-
return {
|
|
727
|
-
identityPublicKey: isSet(object.identityPublicKey) ? bytesFromBase64(object.identityPublicKey) : new Uint8Array(0),
|
|
728
|
-
partialTokenTransaction: isSet(object.partialTokenTransaction) ? TokenTransaction.fromJSON(object.partialTokenTransaction) : void 0,
|
|
729
|
-
partialTokenTransactionOwnerSignatures: globalThis.Array.isArray(object?.partialTokenTransactionOwnerSignatures) ? object.partialTokenTransactionOwnerSignatures.map((e) => SignatureWithIndex.fromJSON(e)) : [],
|
|
730
|
-
validityDurationSeconds: isSet(object.validityDurationSeconds) ? globalThis.Number(object.validityDurationSeconds) : 0
|
|
731
|
-
};
|
|
732
|
-
},
|
|
733
|
-
toJSON(message) {
|
|
734
|
-
const obj = {};
|
|
735
|
-
if (message.identityPublicKey.length !== 0) {
|
|
736
|
-
obj.identityPublicKey = base64FromBytes(message.identityPublicKey);
|
|
737
|
-
}
|
|
738
|
-
if (message.partialTokenTransaction !== void 0) {
|
|
739
|
-
obj.partialTokenTransaction = TokenTransaction.toJSON(message.partialTokenTransaction);
|
|
740
|
-
}
|
|
741
|
-
if (message.partialTokenTransactionOwnerSignatures?.length) {
|
|
742
|
-
obj.partialTokenTransactionOwnerSignatures = message.partialTokenTransactionOwnerSignatures.map(
|
|
743
|
-
(e) => SignatureWithIndex.toJSON(e)
|
|
744
|
-
);
|
|
745
|
-
}
|
|
746
|
-
if (message.validityDurationSeconds !== 0) {
|
|
747
|
-
obj.validityDurationSeconds = Math.round(message.validityDurationSeconds);
|
|
748
|
-
}
|
|
749
|
-
return obj;
|
|
750
|
-
},
|
|
751
|
-
create(base) {
|
|
752
|
-
return StartTransactionRequest.fromPartial(base ?? {});
|
|
753
|
-
},
|
|
754
|
-
fromPartial(object) {
|
|
755
|
-
const message = createBaseStartTransactionRequest();
|
|
756
|
-
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
757
|
-
message.partialTokenTransaction = object.partialTokenTransaction !== void 0 && object.partialTokenTransaction !== null ? TokenTransaction.fromPartial(object.partialTokenTransaction) : void 0;
|
|
758
|
-
message.partialTokenTransactionOwnerSignatures = object.partialTokenTransactionOwnerSignatures?.map((e) => SignatureWithIndex.fromPartial(e)) || [];
|
|
759
|
-
message.validityDurationSeconds = object.validityDurationSeconds ?? 0;
|
|
760
|
-
return message;
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
function createBaseStartTransactionResponse() {
|
|
764
|
-
return { finalTokenTransaction: void 0, keyshareInfo: void 0 };
|
|
765
|
-
}
|
|
766
|
-
var StartTransactionResponse = {
|
|
767
|
-
encode(message, writer = new BinaryWriter()) {
|
|
768
|
-
if (message.finalTokenTransaction !== void 0) {
|
|
769
|
-
TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
770
|
-
}
|
|
771
|
-
if (message.keyshareInfo !== void 0) {
|
|
772
|
-
SigningKeyshare.encode(message.keyshareInfo, writer.uint32(18).fork()).join();
|
|
773
|
-
}
|
|
774
|
-
return writer;
|
|
775
|
-
},
|
|
776
|
-
decode(input, length) {
|
|
777
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
778
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
779
|
-
const message = createBaseStartTransactionResponse();
|
|
780
|
-
while (reader.pos < end) {
|
|
781
|
-
const tag = reader.uint32();
|
|
782
|
-
switch (tag >>> 3) {
|
|
783
|
-
case 1: {
|
|
784
|
-
if (tag !== 10) {
|
|
785
|
-
break;
|
|
786
|
-
}
|
|
787
|
-
message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
case 2: {
|
|
791
|
-
if (tag !== 18) {
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
|
-
message.keyshareInfo = SigningKeyshare.decode(reader, reader.uint32());
|
|
795
|
-
continue;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
799
|
-
break;
|
|
800
|
-
}
|
|
801
|
-
reader.skip(tag & 7);
|
|
802
|
-
}
|
|
803
|
-
return message;
|
|
804
|
-
},
|
|
805
|
-
fromJSON(object) {
|
|
806
|
-
return {
|
|
807
|
-
finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
|
|
808
|
-
keyshareInfo: isSet(object.keyshareInfo) ? SigningKeyshare.fromJSON(object.keyshareInfo) : void 0
|
|
809
|
-
};
|
|
810
|
-
},
|
|
811
|
-
toJSON(message) {
|
|
812
|
-
const obj = {};
|
|
813
|
-
if (message.finalTokenTransaction !== void 0) {
|
|
814
|
-
obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
|
|
815
|
-
}
|
|
816
|
-
if (message.keyshareInfo !== void 0) {
|
|
817
|
-
obj.keyshareInfo = SigningKeyshare.toJSON(message.keyshareInfo);
|
|
818
|
-
}
|
|
819
|
-
return obj;
|
|
820
|
-
},
|
|
821
|
-
create(base) {
|
|
822
|
-
return StartTransactionResponse.fromPartial(base ?? {});
|
|
823
|
-
},
|
|
824
|
-
fromPartial(object) {
|
|
825
|
-
const message = createBaseStartTransactionResponse();
|
|
826
|
-
message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
|
|
827
|
-
message.keyshareInfo = object.keyshareInfo !== void 0 && object.keyshareInfo !== null ? SigningKeyshare.fromPartial(object.keyshareInfo) : void 0;
|
|
828
|
-
return message;
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
function createBaseCommitTransactionRequest() {
|
|
832
|
-
return {
|
|
833
|
-
finalTokenTransaction: void 0,
|
|
834
|
-
finalTokenTransactionHash: new Uint8Array(0),
|
|
835
|
-
inputTtxoSignaturesPerOperator: [],
|
|
836
|
-
ownerIdentityPublicKey: new Uint8Array(0)
|
|
837
|
-
};
|
|
838
|
-
}
|
|
839
|
-
var CommitTransactionRequest = {
|
|
840
|
-
encode(message, writer = new BinaryWriter()) {
|
|
841
|
-
if (message.finalTokenTransaction !== void 0) {
|
|
842
|
-
TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
843
|
-
}
|
|
844
|
-
if (message.finalTokenTransactionHash.length !== 0) {
|
|
845
|
-
writer.uint32(18).bytes(message.finalTokenTransactionHash);
|
|
846
|
-
}
|
|
847
|
-
for (const v of message.inputTtxoSignaturesPerOperator) {
|
|
848
|
-
InputTtxoSignaturesPerOperator.encode(v, writer.uint32(26).fork()).join();
|
|
849
|
-
}
|
|
850
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
851
|
-
writer.uint32(34).bytes(message.ownerIdentityPublicKey);
|
|
852
|
-
}
|
|
853
|
-
return writer;
|
|
854
|
-
},
|
|
855
|
-
decode(input, length) {
|
|
856
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
857
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
858
|
-
const message = createBaseCommitTransactionRequest();
|
|
859
|
-
while (reader.pos < end) {
|
|
860
|
-
const tag = reader.uint32();
|
|
861
|
-
switch (tag >>> 3) {
|
|
862
|
-
case 1: {
|
|
863
|
-
if (tag !== 10) {
|
|
864
|
-
break;
|
|
865
|
-
}
|
|
866
|
-
message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
|
|
867
|
-
continue;
|
|
868
|
-
}
|
|
869
|
-
case 2: {
|
|
870
|
-
if (tag !== 18) {
|
|
871
|
-
break;
|
|
872
|
-
}
|
|
873
|
-
message.finalTokenTransactionHash = reader.bytes();
|
|
874
|
-
continue;
|
|
875
|
-
}
|
|
876
|
-
case 3: {
|
|
877
|
-
if (tag !== 26) {
|
|
878
|
-
break;
|
|
879
|
-
}
|
|
880
|
-
message.inputTtxoSignaturesPerOperator.push(InputTtxoSignaturesPerOperator.decode(reader, reader.uint32()));
|
|
881
|
-
continue;
|
|
882
|
-
}
|
|
883
|
-
case 4: {
|
|
884
|
-
if (tag !== 34) {
|
|
885
|
-
break;
|
|
886
|
-
}
|
|
887
|
-
message.ownerIdentityPublicKey = reader.bytes();
|
|
888
|
-
continue;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
892
|
-
break;
|
|
893
|
-
}
|
|
894
|
-
reader.skip(tag & 7);
|
|
895
|
-
}
|
|
896
|
-
return message;
|
|
897
|
-
},
|
|
898
|
-
fromJSON(object) {
|
|
899
|
-
return {
|
|
900
|
-
finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
|
|
901
|
-
finalTokenTransactionHash: isSet(object.finalTokenTransactionHash) ? bytesFromBase64(object.finalTokenTransactionHash) : new Uint8Array(0),
|
|
902
|
-
inputTtxoSignaturesPerOperator: globalThis.Array.isArray(object?.inputTtxoSignaturesPerOperator) ? object.inputTtxoSignaturesPerOperator.map((e) => InputTtxoSignaturesPerOperator.fromJSON(e)) : [],
|
|
903
|
-
ownerIdentityPublicKey: isSet(object.ownerIdentityPublicKey) ? bytesFromBase64(object.ownerIdentityPublicKey) : new Uint8Array(0)
|
|
904
|
-
};
|
|
905
|
-
},
|
|
906
|
-
toJSON(message) {
|
|
907
|
-
const obj = {};
|
|
908
|
-
if (message.finalTokenTransaction !== void 0) {
|
|
909
|
-
obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
|
|
910
|
-
}
|
|
911
|
-
if (message.finalTokenTransactionHash.length !== 0) {
|
|
912
|
-
obj.finalTokenTransactionHash = base64FromBytes(message.finalTokenTransactionHash);
|
|
913
|
-
}
|
|
914
|
-
if (message.inputTtxoSignaturesPerOperator?.length) {
|
|
915
|
-
obj.inputTtxoSignaturesPerOperator = message.inputTtxoSignaturesPerOperator.map(
|
|
916
|
-
(e) => InputTtxoSignaturesPerOperator.toJSON(e)
|
|
917
|
-
);
|
|
918
|
-
}
|
|
919
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
920
|
-
obj.ownerIdentityPublicKey = base64FromBytes(message.ownerIdentityPublicKey);
|
|
921
|
-
}
|
|
922
|
-
return obj;
|
|
923
|
-
},
|
|
924
|
-
create(base) {
|
|
925
|
-
return CommitTransactionRequest.fromPartial(base ?? {});
|
|
926
|
-
},
|
|
927
|
-
fromPartial(object) {
|
|
928
|
-
const message = createBaseCommitTransactionRequest();
|
|
929
|
-
message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
|
|
930
|
-
message.finalTokenTransactionHash = object.finalTokenTransactionHash ?? new Uint8Array(0);
|
|
931
|
-
message.inputTtxoSignaturesPerOperator = object.inputTtxoSignaturesPerOperator?.map((e) => InputTtxoSignaturesPerOperator.fromPartial(e)) || [];
|
|
932
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
933
|
-
return message;
|
|
934
|
-
}
|
|
935
|
-
};
|
|
936
|
-
function createBaseCommitTransactionResponse() {
|
|
937
|
-
return {};
|
|
938
|
-
}
|
|
939
|
-
var CommitTransactionResponse = {
|
|
940
|
-
encode(_, writer = new BinaryWriter()) {
|
|
941
|
-
return writer;
|
|
942
|
-
},
|
|
943
|
-
decode(input, length) {
|
|
944
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
945
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
946
|
-
const message = createBaseCommitTransactionResponse();
|
|
947
|
-
while (reader.pos < end) {
|
|
948
|
-
const tag = reader.uint32();
|
|
949
|
-
switch (tag >>> 3) {
|
|
950
|
-
}
|
|
951
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
952
|
-
break;
|
|
953
|
-
}
|
|
954
|
-
reader.skip(tag & 7);
|
|
955
|
-
}
|
|
956
|
-
return message;
|
|
957
|
-
},
|
|
958
|
-
fromJSON(_) {
|
|
959
|
-
return {};
|
|
960
|
-
},
|
|
961
|
-
toJSON(_) {
|
|
962
|
-
const obj = {};
|
|
963
|
-
return obj;
|
|
964
|
-
},
|
|
965
|
-
create(base) {
|
|
966
|
-
return CommitTransactionResponse.fromPartial(base ?? {});
|
|
967
|
-
},
|
|
968
|
-
fromPartial(_) {
|
|
969
|
-
const message = createBaseCommitTransactionResponse();
|
|
970
|
-
return message;
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
var SparkTokenServiceDefinition = {
|
|
974
|
-
name: "SparkTokenService",
|
|
975
|
-
fullName: "spark_token.SparkTokenService",
|
|
976
|
-
methods: {
|
|
977
|
-
/**
|
|
978
|
-
* Start process to create final token transaction with all inputs required
|
|
979
|
-
* from user and SOs (including revocation secret commitment)
|
|
980
|
-
*/
|
|
981
|
-
start_transaction: {
|
|
982
|
-
name: "start_transaction",
|
|
983
|
-
requestType: StartTransactionRequest,
|
|
984
|
-
requestStream: false,
|
|
985
|
-
responseType: StartTransactionResponse,
|
|
986
|
-
responseStream: false,
|
|
987
|
-
options: {}
|
|
988
|
-
},
|
|
989
|
-
/**
|
|
990
|
-
* Complete the transaction and commit it with all SOs. This will be
|
|
991
|
-
* coordinated by one SO.
|
|
992
|
-
*/
|
|
993
|
-
commit_transaction: {
|
|
994
|
-
name: "commit_transaction",
|
|
995
|
-
requestType: CommitTransactionRequest,
|
|
996
|
-
requestStream: false,
|
|
997
|
-
responseType: CommitTransactionResponse,
|
|
998
|
-
responseStream: false,
|
|
999
|
-
options: {}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
function bytesFromBase64(b64) {
|
|
1004
|
-
if (globalThis.Buffer) {
|
|
1005
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
1006
|
-
} else {
|
|
1007
|
-
const bin = globalThis.atob(b64);
|
|
1008
|
-
const arr = new Uint8Array(bin.length);
|
|
1009
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
1010
|
-
arr[i] = bin.charCodeAt(i);
|
|
1011
|
-
}
|
|
1012
|
-
return arr;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
function base64FromBytes(arr) {
|
|
1016
|
-
if (globalThis.Buffer) {
|
|
1017
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
1018
|
-
} else {
|
|
1019
|
-
const bin = [];
|
|
1020
|
-
arr.forEach((byte) => {
|
|
1021
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
1022
|
-
});
|
|
1023
|
-
return globalThis.btoa(bin.join(""));
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
function toTimestamp(date) {
|
|
1027
|
-
const seconds = Math.trunc(date.getTime() / 1e3);
|
|
1028
|
-
const nanos = date.getTime() % 1e3 * 1e6;
|
|
1029
|
-
return { seconds, nanos };
|
|
1030
|
-
}
|
|
1031
|
-
function fromTimestamp(t) {
|
|
1032
|
-
let millis = (t.seconds || 0) * 1e3;
|
|
1033
|
-
millis += (t.nanos || 0) / 1e6;
|
|
1034
|
-
return new globalThis.Date(millis);
|
|
1035
|
-
}
|
|
1036
|
-
function fromJsonTimestamp(o) {
|
|
1037
|
-
if (o instanceof globalThis.Date) {
|
|
1038
|
-
return o;
|
|
1039
|
-
} else if (typeof o === "string") {
|
|
1040
|
-
return new globalThis.Date(o);
|
|
1041
|
-
} else {
|
|
1042
|
-
return fromTimestamp(Timestamp.fromJSON(o));
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
function longToNumber(int64) {
|
|
1046
|
-
const num = globalThis.Number(int64.toString());
|
|
1047
|
-
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
1048
|
-
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
1049
|
-
}
|
|
1050
|
-
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
1051
|
-
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
1052
|
-
}
|
|
1053
|
-
return num;
|
|
1054
|
-
}
|
|
1055
|
-
function isSet(value) {
|
|
1056
|
-
return value !== null && value !== void 0;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
export {
|
|
1060
|
-
protobufPackage,
|
|
1061
|
-
TokenOutputToSpend,
|
|
1062
|
-
TokenTransferInput,
|
|
1063
|
-
TokenMintInput,
|
|
1064
|
-
TokenOutput,
|
|
1065
|
-
TokenTransaction,
|
|
1066
|
-
SignatureWithIndex,
|
|
1067
|
-
InputTtxoSignaturesPerOperator,
|
|
1068
|
-
StartTransactionRequest,
|
|
1069
|
-
StartTransactionResponse,
|
|
1070
|
-
CommitTransactionRequest,
|
|
1071
|
-
CommitTransactionResponse,
|
|
1072
|
-
SparkTokenServiceDefinition
|
|
1073
|
-
};
|