@toon-protocol/client 3.3.0 → 4.1.0
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/dist/{chunk-PTTRHLYV.js → chunk-2DGVNDKA.js} +2 -2
- package/dist/{chunk-G36D22II.js → chunk-4WH4G747.js} +5079 -5157
- package/dist/chunk-4WH4G747.js.map +1 -0
- package/dist/{chunk-O6KX7MHD.js → chunk-WJKJ6Y4N.js} +17 -8
- package/dist/{chunk-O6KX7MHD.js.map → chunk-WJKJ6Y4N.js.map} +1 -1
- package/dist/cli/main.js +177 -121
- package/dist/cli/main.js.map +1 -1
- package/dist/{client-FFEFAMJ4.js → client-GAU5TOT4.js} +7 -7
- package/dist/{hidden-service-BsBH2HNi.d.ts → hidden-service-BtIv3u0L.d.ts} +2 -123
- package/dist/index.d.ts +2965 -2964
- package/dist/index.js +153 -188
- package/dist/index.js.map +1 -1
- package/dist/transport/hidden-service.d.ts +1 -1
- package/package.json +2 -1
- package/dist/chunk-G36D22II.js.map +0 -1
- /package/dist/{chunk-PTTRHLYV.js.map → chunk-2DGVNDKA.js.map} +0 -0
- /package/dist/{client-FFEFAMJ4.js.map → client-GAU5TOT4.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -8,23 +8,25 @@ import {
|
|
|
8
8
|
loadKeystore,
|
|
9
9
|
openKeystore,
|
|
10
10
|
writeKeystoreFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2DGVNDKA.js";
|
|
12
12
|
import {
|
|
13
13
|
ACCUMULATED_COST_HEADER,
|
|
14
14
|
ACCUMULATED_COST_PROTOCOL,
|
|
15
15
|
BTPMessageType,
|
|
16
|
+
BatchChannelManager,
|
|
17
|
+
BatchSettlementPayer,
|
|
16
18
|
BeforePayRefusedError,
|
|
17
19
|
BtpAuthError,
|
|
18
20
|
BtpConnectionError,
|
|
19
21
|
BtpPaidWriteTransport,
|
|
20
22
|
BtpRuntimeClient,
|
|
23
|
+
CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS,
|
|
21
24
|
CLAIM_ACK_HEADER,
|
|
22
25
|
CLAIM_ACK_PROTOCOL,
|
|
23
|
-
CLAIM_REJECT_CODE,
|
|
24
26
|
CLAIM_REJECT_REASONS,
|
|
27
|
+
CONNECTOR_MAX_TIMEOUT_SECONDS,
|
|
25
28
|
ChainUnavailableError,
|
|
26
29
|
ChannelFundingError,
|
|
27
|
-
ChannelManager,
|
|
28
30
|
ChannelNotOpenError,
|
|
29
31
|
ChannelResumeError,
|
|
30
32
|
ClientChannelFacade,
|
|
@@ -34,14 +36,16 @@ import {
|
|
|
34
36
|
ConnectorEdgeError,
|
|
35
37
|
ConnectorError,
|
|
36
38
|
DEFAULT_DEPOSIT,
|
|
37
|
-
DEFAULT_SETTLEMENT_TIMEOUT,
|
|
38
39
|
DEFAULT_TIMEOUT_MS,
|
|
39
|
-
|
|
40
|
+
EIP2612_GAS_SPONSORING,
|
|
41
|
+
ERC20_APPROVAL_GAS_SPONSORING,
|
|
42
|
+
ERC3009_DEPOSIT_COLLECTOR_ADDRESS,
|
|
40
43
|
EnvelopeError,
|
|
41
44
|
EnvelopeErrorKind,
|
|
42
45
|
EvmSigner,
|
|
43
46
|
FULFILLMENT_MISMATCH_CODE,
|
|
44
47
|
FULFILLMENT_MISMATCH_MESSAGE,
|
|
48
|
+
FacilitatorError,
|
|
45
49
|
GIFTWRAP_NONCE_LENGTH,
|
|
46
50
|
GIFTWRAP_PUBLIC_KEY_LENGTH,
|
|
47
51
|
GIFTWRAP_SECRET_LENGTH,
|
|
@@ -58,24 +62,26 @@ import {
|
|
|
58
62
|
InvalidAddressError,
|
|
59
63
|
IsomorphicBtpClient,
|
|
60
64
|
JsonFileChannelStore,
|
|
61
|
-
|
|
65
|
+
MAX_GRACE_PERIOD_SECONDS,
|
|
66
|
+
MAX_WITHDRAW_DELAY_SECONDS,
|
|
67
|
+
MIN_GRACE_PERIOD_SECONDS,
|
|
68
|
+
MIN_WITHDRAW_DELAY_SECONDS,
|
|
62
69
|
NetworkError,
|
|
63
70
|
OerError,
|
|
64
71
|
OerErrorKind,
|
|
65
|
-
OnChainChannelClient,
|
|
66
72
|
PACKET_EXPIRY_HEADROOM_MS,
|
|
73
|
+
PAYMENT_CHANNELS_PROGRAM_ID,
|
|
67
74
|
PAYMENT_REQUIRED_HEADER,
|
|
68
75
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
76
|
+
PERMIT2_ADDRESS,
|
|
77
|
+
PERMIT2_DEPOSIT_COLLECTOR_ADDRESS,
|
|
69
78
|
PROXIED_RPC_DEFAULTS,
|
|
70
79
|
PaymentRequiredError,
|
|
71
80
|
RouteNotPricedError,
|
|
72
81
|
SealedResponseError,
|
|
73
82
|
SolanaRpcTransportError,
|
|
74
|
-
|
|
83
|
+
SponsorRefusedError,
|
|
75
84
|
StaleRpcReadError,
|
|
76
|
-
TOKEN_NETWORK_ABI,
|
|
77
|
-
TOKEN_NETWORK_REGISTRY_ABI,
|
|
78
|
-
TokenNetworkClient,
|
|
79
85
|
ToonClient,
|
|
80
86
|
ToonClientError,
|
|
81
87
|
TransactionOutcomeError,
|
|
@@ -84,12 +90,29 @@ import {
|
|
|
84
90
|
TransportRequiredError,
|
|
85
91
|
UnknownChainError,
|
|
86
92
|
ValidationError,
|
|
93
|
+
X402_BATCH_SETTLEMENT_ADDRESS,
|
|
94
|
+
X402_BATCH_SETTLEMENT_DEPOSIT_ABI,
|
|
95
|
+
X402_BATCH_SETTLEMENT_EXIT_ABI,
|
|
96
|
+
X402_BATCH_SETTLEMENT_READ_ABI,
|
|
87
97
|
addressFor,
|
|
98
|
+
approvePermit2,
|
|
99
|
+
batchChannelId,
|
|
100
|
+
batchVoucherDigest,
|
|
101
|
+
buildBatchChannelConfig,
|
|
102
|
+
buildEip3009Deposit,
|
|
103
|
+
buildPermit2Deposit,
|
|
88
104
|
buildResponseMeta,
|
|
105
|
+
buildSponsoredOpen,
|
|
106
|
+
buildSvmBatchChannelConfig,
|
|
107
|
+
buildSvmRequestCloseInstruction,
|
|
108
|
+
buildSvmSealInstruction,
|
|
109
|
+
buildSvmTopUpInstruction,
|
|
110
|
+
buildSvmVoucherMessage,
|
|
111
|
+
buildSvmWithdrawPayerInstruction,
|
|
89
112
|
chainUnavailableMessage,
|
|
90
113
|
chargeFor,
|
|
114
|
+
chooseBatchSettlement,
|
|
91
115
|
connectorEdgeBaseUrl,
|
|
92
|
-
counterpartyMatch,
|
|
93
116
|
decodeAccumulatedCost,
|
|
94
117
|
decodeBase64Text,
|
|
95
118
|
decodeClaimAck,
|
|
@@ -97,15 +120,18 @@ import {
|
|
|
97
120
|
decodeEnvelopeRequest,
|
|
98
121
|
decodeEnvelopeResponse,
|
|
99
122
|
decodePaymentRequired,
|
|
123
|
+
decodeSvmBatchChannel,
|
|
100
124
|
decodeUtf8,
|
|
101
125
|
decodeVarOctetString,
|
|
102
126
|
decodeVarUint,
|
|
103
127
|
defaultDestinationFor,
|
|
104
128
|
defaultFaucetTimeout,
|
|
105
|
-
|
|
129
|
+
depositDirectly,
|
|
106
130
|
deriveFulfillment,
|
|
107
131
|
deserializeIlpPacket,
|
|
108
132
|
deserializeIlpPrepare,
|
|
133
|
+
eip2612Nonce,
|
|
134
|
+
eip2612PermitData,
|
|
109
135
|
encodeEnvelope,
|
|
110
136
|
encodeEnvelopeRequest,
|
|
111
137
|
encodeEnvelopeResponse,
|
|
@@ -113,25 +139,42 @@ import {
|
|
|
113
139
|
encodeVarOctetString,
|
|
114
140
|
encodeVarUint,
|
|
115
141
|
envelopeHeader,
|
|
142
|
+
erc3009CollectorData,
|
|
143
|
+
evmChainIdOf,
|
|
144
|
+
evmChallengeDigest,
|
|
145
|
+
evmVoucherClaim,
|
|
146
|
+
evmWalletAccess,
|
|
147
|
+
facilitatorExtensions,
|
|
148
|
+
finalizeEvmBatchWithdraw,
|
|
116
149
|
fromBase64,
|
|
117
150
|
fundWallet,
|
|
151
|
+
generateSolanaKeypair,
|
|
152
|
+
getSvmBatchChannel,
|
|
118
153
|
giftWrapPublicKey,
|
|
119
154
|
httpEndpointToBtpUrl,
|
|
155
|
+
initiateEvmBatchWithdraw,
|
|
120
156
|
isInsufficientGasError,
|
|
121
|
-
isUnknownChannelReject,
|
|
122
157
|
localGiftWrapEcdh,
|
|
123
158
|
looksLikeSealedResponse,
|
|
124
159
|
mapIlpResponse,
|
|
160
|
+
nextVoucherAmount,
|
|
161
|
+
offerFromTerms,
|
|
125
162
|
openRequest,
|
|
126
163
|
openResponse,
|
|
164
|
+
parseBatchSettlementOffer,
|
|
165
|
+
parseBatchSettlementTerms,
|
|
127
166
|
parseBtpMessage,
|
|
128
|
-
parseEvmChainId,
|
|
129
167
|
parsePaymentTerms,
|
|
130
168
|
parseSelfDescription,
|
|
131
|
-
|
|
169
|
+
parseSolanaWireTransaction,
|
|
132
170
|
parseX402Body,
|
|
133
171
|
parseX402Challenge,
|
|
172
|
+
patchSolanaRecentBlockhash,
|
|
173
|
+
paymentChannelsEventAuthority,
|
|
174
|
+
permit2Allowance,
|
|
175
|
+
permit2CollectorData,
|
|
134
176
|
readBaseUnits,
|
|
177
|
+
readEvmBatchChannel,
|
|
135
178
|
readEvmNativeBalance,
|
|
136
179
|
readEvmTokenBalance,
|
|
137
180
|
readExchangeOutcome,
|
|
@@ -139,8 +182,10 @@ import {
|
|
|
139
182
|
readResponseMeta2,
|
|
140
183
|
readSolanaNativeBalance,
|
|
141
184
|
readSolanaTokenBalance,
|
|
185
|
+
readVoucherRefusal,
|
|
142
186
|
readWalletBalances,
|
|
143
|
-
|
|
187
|
+
requestSponsoredOpen,
|
|
188
|
+
requestSvmBatchClose,
|
|
144
189
|
resolveConfig,
|
|
145
190
|
resolveExpectedFulfillment,
|
|
146
191
|
resolveExpiresAt,
|
|
@@ -148,7 +193,6 @@ import {
|
|
|
148
193
|
routePriceFor,
|
|
149
194
|
rpcFetch,
|
|
150
195
|
rpcTransport,
|
|
151
|
-
sameSettlementAddress,
|
|
152
196
|
sealExchange,
|
|
153
197
|
sealRequest,
|
|
154
198
|
sealRequestWithRandomness,
|
|
@@ -161,21 +205,32 @@ import {
|
|
|
161
205
|
serializeIlpFulfill,
|
|
162
206
|
serializeIlpPrepare,
|
|
163
207
|
serializeIlpReject,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
208
|
+
settleDeposit,
|
|
209
|
+
signBatchVoucher,
|
|
210
|
+
signEip2612GasSponsoring,
|
|
211
|
+
signErc20ApprovalGasSponsoring,
|
|
212
|
+
signEvmChallenge,
|
|
213
|
+
signSolanaChallenge,
|
|
214
|
+
signSolanaWireTransaction,
|
|
215
|
+
signSvmVoucher,
|
|
216
|
+
singleRecipientDistributionHash,
|
|
217
|
+
solanaChallengeMessage,
|
|
218
|
+
solanaKeypair,
|
|
219
|
+
solanaVoucherClaim,
|
|
220
|
+
svmBatchChannelAddress,
|
|
167
221
|
toEnvelopeRequest,
|
|
168
222
|
toHex,
|
|
169
223
|
trimTrailingSlashes,
|
|
170
|
-
withRetry
|
|
171
|
-
|
|
224
|
+
withRetry,
|
|
225
|
+
withdrawSvmBatchChannel
|
|
226
|
+
} from "./chunk-4WH4G747.js";
|
|
172
227
|
import {
|
|
173
228
|
DEVNET,
|
|
174
229
|
HS_HOSTNAME_MAX_LENGTH,
|
|
175
230
|
HS_HOSTNAME_REGEX,
|
|
176
231
|
assertRoutableHsHostname,
|
|
177
|
-
base58Decode,
|
|
178
232
|
base58Encode,
|
|
233
|
+
defaultFacilitatorFor,
|
|
179
234
|
defaultRpcUrl,
|
|
180
235
|
deriveFullIdentity,
|
|
181
236
|
evmDerivationPath,
|
|
@@ -185,157 +240,15 @@ import {
|
|
|
185
240
|
isHiddenServiceUrl,
|
|
186
241
|
isRoutableHsHostname,
|
|
187
242
|
validateMnemonic
|
|
188
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-WJKJ6Y4N.js";
|
|
189
244
|
import {
|
|
190
245
|
validateSocks5hUrl
|
|
191
246
|
} from "./chunk-32MD3CXE.js";
|
|
192
247
|
|
|
193
|
-
// src/channel/solana/wire-transaction.ts
|
|
194
|
-
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
195
|
-
import { randomBytes } from "@noble/hashes/utils.js";
|
|
196
|
-
var SIGNATURE_LENGTH = 64;
|
|
197
|
-
var PUBKEY_LENGTH = 32;
|
|
198
|
-
var SEED_LENGTH = 32;
|
|
199
|
-
var SECRET_KEY_LENGTH = 64;
|
|
200
|
-
var VERSION_PREFIX_MASK = 128;
|
|
201
|
-
function readCompactU16(bytes, offset) {
|
|
202
|
-
let value = 0;
|
|
203
|
-
for (let shift = 0; shift < 3; shift++) {
|
|
204
|
-
const byte = bytes[offset + shift];
|
|
205
|
-
if (byte === void 0) {
|
|
206
|
-
throw new Error("malformed Solana transaction: truncated compact-u16");
|
|
207
|
-
}
|
|
208
|
-
value |= (byte & 127) << shift * 7;
|
|
209
|
-
if ((byte & 128) === 0) return { value, offset: offset + shift + 1 };
|
|
210
|
-
}
|
|
211
|
-
throw new Error("malformed Solana transaction: compact-u16 exceeds three bytes");
|
|
212
|
-
}
|
|
213
|
-
function toWireBytes(wire) {
|
|
214
|
-
return typeof wire === "string" ? fromBase64(wire) : wire;
|
|
215
|
-
}
|
|
216
|
-
function likeInput(wire, bytes) {
|
|
217
|
-
return typeof wire === "string" ? toBase64(bytes) : bytes;
|
|
218
|
-
}
|
|
219
|
-
function parseSolanaWireTransaction(wire) {
|
|
220
|
-
const bytes = toWireBytes(wire);
|
|
221
|
-
const count = readCompactU16(bytes, 0);
|
|
222
|
-
const signaturesOffset = count.offset;
|
|
223
|
-
const messageOffset = signaturesOffset + count.value * SIGNATURE_LENGTH;
|
|
224
|
-
if (messageOffset > bytes.length) {
|
|
225
|
-
throw new Error(
|
|
226
|
-
`malformed Solana transaction: ${count.value} signature slots do not fit in ${bytes.length} bytes`
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
const prefix = bytes[messageOffset];
|
|
230
|
-
if (prefix === void 0) {
|
|
231
|
-
throw new Error("malformed Solana transaction: no message after the signatures");
|
|
232
|
-
}
|
|
233
|
-
const versioned = (prefix & VERSION_PREFIX_MASK) !== 0;
|
|
234
|
-
const version = versioned ? prefix & ~VERSION_PREFIX_MASK : "legacy";
|
|
235
|
-
const headerOffset = messageOffset + (versioned ? 1 : 0);
|
|
236
|
-
const numRequiredSignatures = bytes[headerOffset];
|
|
237
|
-
if (numRequiredSignatures === void 0) {
|
|
238
|
-
throw new Error("malformed Solana transaction: truncated message header");
|
|
239
|
-
}
|
|
240
|
-
if (numRequiredSignatures !== count.value) {
|
|
241
|
-
throw new Error(
|
|
242
|
-
`malformed Solana transaction: ${count.value} signature slots but the header requires ${numRequiredSignatures}`
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
const accountCount = readCompactU16(bytes, headerOffset + 3);
|
|
246
|
-
const keysOffset = accountCount.offset;
|
|
247
|
-
const recentBlockhashOffset = keysOffset + accountCount.value * PUBKEY_LENGTH;
|
|
248
|
-
if (recentBlockhashOffset + PUBKEY_LENGTH > bytes.length) {
|
|
249
|
-
throw new Error(
|
|
250
|
-
`malformed Solana transaction: ${accountCount.value} account keys and a blockhash do not fit in ${bytes.length} bytes`
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
if (numRequiredSignatures > accountCount.value) {
|
|
254
|
-
throw new Error(
|
|
255
|
-
`malformed Solana transaction: header requires ${numRequiredSignatures} signatures but the message names only ${accountCount.value} accounts`
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
const staticAccounts = [];
|
|
259
|
-
for (let i = 0; i < accountCount.value; i++) {
|
|
260
|
-
const start = keysOffset + i * PUBKEY_LENGTH;
|
|
261
|
-
staticAccounts.push(base58Encode(bytes.slice(start, start + PUBKEY_LENGTH)));
|
|
262
|
-
}
|
|
263
|
-
const signers = staticAccounts.slice(0, numRequiredSignatures);
|
|
264
|
-
const unsigned = signers.filter((_signer, slot) => {
|
|
265
|
-
const start = signaturesOffset + slot * SIGNATURE_LENGTH;
|
|
266
|
-
return bytes.subarray(start, start + SIGNATURE_LENGTH).every((byte) => byte === 0);
|
|
267
|
-
});
|
|
268
|
-
return {
|
|
269
|
-
bytes,
|
|
270
|
-
version,
|
|
271
|
-
signers,
|
|
272
|
-
unsigned,
|
|
273
|
-
staticAccounts,
|
|
274
|
-
recentBlockhash: base58Encode(
|
|
275
|
-
bytes.slice(recentBlockhashOffset, recentBlockhashOffset + PUBKEY_LENGTH)
|
|
276
|
-
),
|
|
277
|
-
signaturesOffset,
|
|
278
|
-
messageOffset,
|
|
279
|
-
recentBlockhashOffset
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
function patchSolanaRecentBlockhash(wire, recentBlockhash) {
|
|
283
|
-
const blockhash = base58Decode(recentBlockhash);
|
|
284
|
-
if (blockhash.length !== PUBKEY_LENGTH) {
|
|
285
|
-
throw new Error(
|
|
286
|
-
`recentBlockhash must decode to ${PUBKEY_LENGTH} bytes, got ${blockhash.length} from ${JSON.stringify(recentBlockhash)}`
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
const parsed = parseSolanaWireTransaction(wire);
|
|
290
|
-
const patched = new Uint8Array(parsed.bytes);
|
|
291
|
-
patched.set(blockhash, parsed.recentBlockhashOffset);
|
|
292
|
-
patched.fill(
|
|
293
|
-
0,
|
|
294
|
-
parsed.signaturesOffset,
|
|
295
|
-
parsed.signaturesOffset + parsed.signers.length * SIGNATURE_LENGTH
|
|
296
|
-
);
|
|
297
|
-
return likeInput(wire, patched);
|
|
298
|
-
}
|
|
299
|
-
function signSolanaWireTransaction(wire, signers) {
|
|
300
|
-
const parsed = parseSolanaWireTransaction(wire);
|
|
301
|
-
const signed = new Uint8Array(parsed.bytes);
|
|
302
|
-
const message = signed.subarray(parsed.messageOffset);
|
|
303
|
-
for (const signer of signers) {
|
|
304
|
-
const address = base58Encode(signer.publicKey);
|
|
305
|
-
const slot = parsed.signers.indexOf(address);
|
|
306
|
-
if (slot === -1) {
|
|
307
|
-
throw new Error(
|
|
308
|
-
`${address} is not a required signer of this transaction (slots: ${parsed.signers.join(", ")})`
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
signed.set(
|
|
312
|
-
ed25519.sign(message, signer.privateKey),
|
|
313
|
-
parsed.signaturesOffset + slot * SIGNATURE_LENGTH
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
return likeInput(wire, signed);
|
|
317
|
-
}
|
|
318
|
-
function generateSolanaKeypair() {
|
|
319
|
-
return keypairFromSeed(randomBytes(SEED_LENGTH));
|
|
320
|
-
}
|
|
321
|
-
function solanaKeypair(key) {
|
|
322
|
-
const bytes = typeof key === "string" ? base58Decode(key.trim()) : key;
|
|
323
|
-
if (bytes.length !== SEED_LENGTH && bytes.length !== SECRET_KEY_LENGTH) {
|
|
324
|
-
throw new Error(
|
|
325
|
-
`a Solana secret must be a ${SEED_LENGTH}-byte seed or a ${SECRET_KEY_LENGTH}-byte secret key; got ${bytes.length} bytes`
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
return keypairFromSeed(bytes.slice(0, SEED_LENGTH));
|
|
329
|
-
}
|
|
330
|
-
function keypairFromSeed(seed) {
|
|
331
|
-
const publicKey = new Uint8Array(ed25519.getPublicKey(seed));
|
|
332
|
-
return { privateKey: seed, publicKey, address: base58Encode(publicKey) };
|
|
333
|
-
}
|
|
334
|
-
|
|
335
248
|
// src/jobs/job-event.ts
|
|
336
249
|
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
337
250
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
338
|
-
import { randomBytes
|
|
251
|
+
import { randomBytes } from "@noble/hashes/utils.js";
|
|
339
252
|
function serializeForId(event) {
|
|
340
253
|
return JSON.stringify([
|
|
341
254
|
0,
|
|
@@ -347,7 +260,7 @@ function serializeForId(event) {
|
|
|
347
260
|
]);
|
|
348
261
|
}
|
|
349
262
|
function buildJobEvent(params) {
|
|
350
|
-
const secretKey = params.secretKey ??
|
|
263
|
+
const secretKey = params.secretKey ?? randomBytes(32);
|
|
351
264
|
const pubkey = toHex(new Uint8Array(schnorr.getPublicKey(secretKey)));
|
|
352
265
|
const tags = [];
|
|
353
266
|
for (const [key, value] of Object.entries(params.params)) {
|
|
@@ -683,18 +596,20 @@ export {
|
|
|
683
596
|
ACCUMULATED_COST_PROTOCOL,
|
|
684
597
|
ARNS_KIND,
|
|
685
598
|
BTPMessageType,
|
|
599
|
+
BatchChannelManager,
|
|
600
|
+
BatchSettlementPayer,
|
|
686
601
|
BeforePayRefusedError,
|
|
687
602
|
BtpAuthError,
|
|
688
603
|
BtpConnectionError,
|
|
689
604
|
BtpPaidWriteTransport,
|
|
690
605
|
BtpRuntimeClient,
|
|
606
|
+
CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS,
|
|
691
607
|
CLAIM_ACK_HEADER,
|
|
692
608
|
CLAIM_ACK_PROTOCOL,
|
|
693
|
-
CLAIM_REJECT_CODE,
|
|
694
609
|
CLAIM_REJECT_REASONS,
|
|
610
|
+
CONNECTOR_MAX_TIMEOUT_SECONDS,
|
|
695
611
|
ChainUnavailableError,
|
|
696
612
|
ChannelFundingError,
|
|
697
|
-
ChannelManager,
|
|
698
613
|
ChannelNotOpenError,
|
|
699
614
|
ChannelResumeError,
|
|
700
615
|
ClientChannelFacade,
|
|
@@ -704,15 +619,17 @@ export {
|
|
|
704
619
|
ConnectorEdgeError,
|
|
705
620
|
ConnectorError,
|
|
706
621
|
DEFAULT_DEPOSIT,
|
|
707
|
-
DEFAULT_SETTLEMENT_TIMEOUT,
|
|
708
622
|
DEFAULT_TIMEOUT_MS,
|
|
709
623
|
DEVNET,
|
|
710
|
-
|
|
624
|
+
EIP2612_GAS_SPONSORING,
|
|
625
|
+
ERC20_APPROVAL_GAS_SPONSORING,
|
|
626
|
+
ERC3009_DEPOSIT_COLLECTOR_ADDRESS,
|
|
711
627
|
EnvelopeError,
|
|
712
628
|
EnvelopeErrorKind,
|
|
713
629
|
EvmSigner,
|
|
714
630
|
FULFILLMENT_MISMATCH_CODE,
|
|
715
631
|
FULFILLMENT_MISMATCH_MESSAGE,
|
|
632
|
+
FacilitatorError,
|
|
716
633
|
GIFTWRAP_NONCE_LENGTH,
|
|
717
634
|
GIFTWRAP_PUBLIC_KEY_LENGTH,
|
|
718
635
|
GIFTWRAP_SECRET_LENGTH,
|
|
@@ -732,25 +649,27 @@ export {
|
|
|
732
649
|
IsomorphicBtpClient,
|
|
733
650
|
JsonFileChannelStore,
|
|
734
651
|
KEYSTORE_VERSION,
|
|
735
|
-
|
|
652
|
+
MAX_GRACE_PERIOD_SECONDS,
|
|
653
|
+
MAX_WITHDRAW_DELAY_SECONDS,
|
|
654
|
+
MIN_GRACE_PERIOD_SECONDS,
|
|
655
|
+
MIN_WITHDRAW_DELAY_SECONDS,
|
|
736
656
|
NetworkError,
|
|
737
657
|
OerError,
|
|
738
658
|
OerErrorKind,
|
|
739
|
-
OnChainChannelClient,
|
|
740
659
|
PACKET_EXPIRY_HEADROOM_MS,
|
|
660
|
+
PAYMENT_CHANNELS_PROGRAM_ID,
|
|
741
661
|
PAYMENT_REQUIRED_HEADER,
|
|
742
662
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
663
|
+
PERMIT2_ADDRESS,
|
|
664
|
+
PERMIT2_DEPOSIT_COLLECTOR_ADDRESS,
|
|
743
665
|
PROXIED_RPC_DEFAULTS,
|
|
744
666
|
PaymentRequiredError,
|
|
745
667
|
RouteNotPricedError,
|
|
746
668
|
SOLANA_GAS_KIND,
|
|
747
669
|
SealedResponseError,
|
|
748
670
|
SolanaRpcTransportError,
|
|
749
|
-
|
|
671
|
+
SponsorRefusedError,
|
|
750
672
|
StaleRpcReadError,
|
|
751
|
-
TOKEN_NETWORK_ABI,
|
|
752
|
-
TOKEN_NETWORK_REGISTRY_ABI,
|
|
753
|
-
TokenNetworkClient,
|
|
754
673
|
ToonClient,
|
|
755
674
|
ToonClientError,
|
|
756
675
|
TransactionOutcomeError,
|
|
@@ -759,16 +678,33 @@ export {
|
|
|
759
678
|
TransportRequiredError,
|
|
760
679
|
UnknownChainError,
|
|
761
680
|
ValidationError,
|
|
681
|
+
X402_BATCH_SETTLEMENT_ADDRESS,
|
|
682
|
+
X402_BATCH_SETTLEMENT_DEPOSIT_ABI,
|
|
683
|
+
X402_BATCH_SETTLEMENT_EXIT_ABI,
|
|
684
|
+
X402_BATCH_SETTLEMENT_READ_ABI,
|
|
762
685
|
addressFor,
|
|
686
|
+
approvePermit2,
|
|
763
687
|
assertRoutableHsHostname,
|
|
688
|
+
batchChannelId,
|
|
689
|
+
batchVoucherDigest,
|
|
690
|
+
buildBatchChannelConfig,
|
|
691
|
+
buildEip3009Deposit,
|
|
764
692
|
buildJobEvent,
|
|
693
|
+
buildPermit2Deposit,
|
|
765
694
|
buildResponseMeta,
|
|
695
|
+
buildSponsoredOpen,
|
|
696
|
+
buildSvmBatchChannelConfig,
|
|
697
|
+
buildSvmRequestCloseInstruction,
|
|
698
|
+
buildSvmSealInstruction,
|
|
699
|
+
buildSvmTopUpInstruction,
|
|
700
|
+
buildSvmVoucherMessage,
|
|
701
|
+
buildSvmWithdrawPayerInstruction,
|
|
766
702
|
buyArnsName,
|
|
767
703
|
buyArnsNameWithNewAnt,
|
|
768
704
|
chainUnavailableMessage,
|
|
769
705
|
chargeFor,
|
|
706
|
+
chooseBatchSettlement,
|
|
770
707
|
connectorEdgeBaseUrl,
|
|
771
|
-
counterpartyMatch,
|
|
772
708
|
decodeAccumulatedCost,
|
|
773
709
|
decodeBase64Text,
|
|
774
710
|
decodeClaimAck,
|
|
@@ -776,17 +712,21 @@ export {
|
|
|
776
712
|
decodeEnvelopeRequest,
|
|
777
713
|
decodeEnvelopeResponse,
|
|
778
714
|
decodePaymentRequired,
|
|
715
|
+
decodeSvmBatchChannel,
|
|
779
716
|
decodeVarOctetString,
|
|
780
717
|
decodeVarUint,
|
|
781
718
|
decryptMnemonic,
|
|
782
719
|
defaultDestinationFor,
|
|
720
|
+
defaultFacilitatorFor,
|
|
783
721
|
defaultFaucetTimeout,
|
|
784
722
|
defaultRpcUrl,
|
|
785
|
-
|
|
723
|
+
depositDirectly,
|
|
786
724
|
deriveFulfillment,
|
|
787
725
|
deriveFullIdentity,
|
|
788
726
|
deserializeIlpPacket,
|
|
789
727
|
deserializeIlpPrepare,
|
|
728
|
+
eip2612Nonce,
|
|
729
|
+
eip2612PermitData,
|
|
790
730
|
encodeEnvelope,
|
|
791
731
|
encodeEnvelopeRequest,
|
|
792
732
|
encodeEnvelopeResponse,
|
|
@@ -794,49 +734,65 @@ export {
|
|
|
794
734
|
encodeVarUint,
|
|
795
735
|
encryptMnemonic,
|
|
796
736
|
envelopeHeader,
|
|
737
|
+
erc3009CollectorData,
|
|
738
|
+
evmChainIdOf,
|
|
739
|
+
evmChallengeDigest,
|
|
797
740
|
evmDerivationPath,
|
|
798
741
|
evmIdentityFromKey,
|
|
742
|
+
evmVoucherClaim,
|
|
743
|
+
evmWalletAccess,
|
|
744
|
+
facilitatorExtensions,
|
|
745
|
+
finalizeEvmBatchWithdraw,
|
|
799
746
|
fundWallet,
|
|
800
747
|
generateKeystore,
|
|
801
748
|
generateMnemonic,
|
|
802
749
|
generateRandomIdentity,
|
|
803
750
|
generateSolanaKeypair,
|
|
751
|
+
getSvmBatchChannel,
|
|
804
752
|
giftWrapPublicKey,
|
|
805
753
|
httpEndpointToBtpUrl,
|
|
806
754
|
importKeystore,
|
|
755
|
+
initiateEvmBatchWithdraw,
|
|
807
756
|
isGasStationFailure,
|
|
808
757
|
isHiddenServiceUrl,
|
|
809
758
|
isInsufficientGasError,
|
|
810
759
|
isRoutableHsHostname,
|
|
811
|
-
isUnknownChannelReject,
|
|
812
760
|
jobEventParam,
|
|
813
761
|
keystoreDerivation,
|
|
814
762
|
loadKeystore,
|
|
815
763
|
localGiftWrapEcdh,
|
|
816
764
|
looksLikeSealedResponse,
|
|
817
765
|
mapIlpResponse,
|
|
766
|
+
nextVoucherAmount,
|
|
767
|
+
offerFromTerms,
|
|
818
768
|
openKeystore,
|
|
819
769
|
openRequest,
|
|
820
770
|
openResponse,
|
|
771
|
+
parseBatchSettlementOffer,
|
|
772
|
+
parseBatchSettlementTerms,
|
|
821
773
|
parseBtpMessage,
|
|
822
|
-
parseEvmChainId,
|
|
823
774
|
parsePaymentTerms,
|
|
824
775
|
parseSelfDescription,
|
|
825
|
-
parseSettlementEntry,
|
|
826
776
|
parseSolanaWireTransaction,
|
|
827
777
|
parseX402Body,
|
|
828
778
|
parseX402Challenge,
|
|
829
779
|
patchSolanaRecentBlockhash,
|
|
780
|
+
paymentChannelsEventAuthority,
|
|
781
|
+
permit2Allowance,
|
|
782
|
+
permit2CollectorData,
|
|
830
783
|
readBaseUnits,
|
|
831
784
|
readResponseMeta as readBtpResponseMeta,
|
|
785
|
+
readEvmBatchChannel,
|
|
832
786
|
readEvmNativeBalance,
|
|
833
787
|
readEvmTokenBalance,
|
|
834
788
|
readExchangeOutcome,
|
|
835
789
|
readResponseMeta2 as readResponseMeta,
|
|
836
790
|
readSolanaNativeBalance,
|
|
837
791
|
readSolanaTokenBalance,
|
|
792
|
+
readVoucherRefusal,
|
|
838
793
|
readWalletBalances,
|
|
839
|
-
|
|
794
|
+
requestSponsoredOpen,
|
|
795
|
+
requestSvmBatchClose,
|
|
840
796
|
resolveConfig,
|
|
841
797
|
resolveExpectedFulfillment,
|
|
842
798
|
resolveExpiresAt,
|
|
@@ -844,7 +800,6 @@ export {
|
|
|
844
800
|
routePriceFor,
|
|
845
801
|
rpcFetch,
|
|
846
802
|
rpcTransport,
|
|
847
|
-
sameSettlementAddress,
|
|
848
803
|
sealExchange,
|
|
849
804
|
sealRequest,
|
|
850
805
|
sealRequestWithRandomness,
|
|
@@ -858,16 +813,26 @@ export {
|
|
|
858
813
|
serializeIlpFulfill,
|
|
859
814
|
serializeIlpPrepare,
|
|
860
815
|
serializeIlpReject,
|
|
861
|
-
|
|
816
|
+
settleDeposit,
|
|
817
|
+
signBatchVoucher,
|
|
818
|
+
signEip2612GasSponsoring,
|
|
819
|
+
signErc20ApprovalGasSponsoring,
|
|
820
|
+
signEvmChallenge,
|
|
821
|
+
signSolanaChallenge,
|
|
862
822
|
signSolanaWireTransaction,
|
|
823
|
+
signSvmVoucher,
|
|
824
|
+
singleRecipientDistributionHash,
|
|
825
|
+
solanaChallengeMessage,
|
|
863
826
|
solanaKeypair,
|
|
864
|
-
|
|
827
|
+
solanaVoucherClaim,
|
|
865
828
|
spawnAnt,
|
|
829
|
+
svmBatchChannelAddress,
|
|
866
830
|
toEnvelopeRequest,
|
|
867
831
|
trimTrailingSlashes,
|
|
868
832
|
validateMnemonic,
|
|
869
833
|
validateSocks5hUrl,
|
|
870
834
|
withRetry,
|
|
835
|
+
withdrawSvmBatchChannel,
|
|
871
836
|
writeKeystoreFile
|
|
872
837
|
};
|
|
873
838
|
//# sourceMappingURL=index.js.map
|