@fogo/sessions-sdk 0.1.8 → 0.1.10
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/cjs/connection.d.ts +10 -10
- package/cjs/connection.js +22 -22
- package/cjs/context.d.ts +4 -4
- package/cjs/context.js +4 -4
- package/cjs/crypto.js +1 -1
- package/cjs/index.d.ts +220 -2030
- package/cjs/index.js +186 -75
- package/cjs/instructions.js +9 -9
- package/esm/connection.d.ts +10 -10
- package/esm/connection.js +23 -23
- package/esm/context.d.ts +4 -4
- package/esm/context.js +4 -4
- package/esm/crypto.js +1 -1
- package/esm/index.d.ts +220 -2030
- package/esm/index.js +155 -77
- package/esm/instructions.js +9 -9
- package/package.json +41 -40
package/cjs/index.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -9,7 +42,7 @@ const sessions_idls_1 = require("@fogo/sessions-idls");
|
|
|
9
42
|
const mpl_token_metadata_1 = require("@metaplex-foundation/mpl-token-metadata");
|
|
10
43
|
const umi_1 = require("@metaplex-foundation/umi");
|
|
11
44
|
const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
|
|
12
|
-
const
|
|
45
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
13
46
|
const compat_1 = require("@solana/compat");
|
|
14
47
|
const kit_1 = require("@solana/kit");
|
|
15
48
|
const spl_token_1 = require("@solana/spl-token");
|
|
@@ -17,6 +50,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
17
50
|
const sdk_1 = require("@wormhole-foundation/sdk");
|
|
18
51
|
const solana_1 = __importDefault(require("@wormhole-foundation/sdk/solana"));
|
|
19
52
|
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
|
|
53
|
+
const routes = __importStar(require("@wormhole-foundation/sdk-connect/routes"));
|
|
20
54
|
const sdk_route_ntt_1 = require("@wormhole-foundation/sdk-route-ntt");
|
|
21
55
|
const sdk_solana_core_1 = require("@wormhole-foundation/sdk-solana-core");
|
|
22
56
|
const sdk_solana_ntt_1 = require("@wormhole-foundation/sdk-solana-ntt");
|
|
@@ -29,6 +63,7 @@ const crypto_js_1 = require("./crypto.js");
|
|
|
29
63
|
const instructions_js_1 = require("./instructions.js");
|
|
30
64
|
const mints_js_1 = require("./mints.js");
|
|
31
65
|
const network_js_1 = require("./network.js");
|
|
66
|
+
(0, sdk_solana_ntt_1.register)();
|
|
32
67
|
var connection_js_2 = require("./connection.js");
|
|
33
68
|
Object.defineProperty(exports, "createSessionConnection", { enumerable: true, get: function () { return connection_js_2.createSessionConnection; } });
|
|
34
69
|
Object.defineProperty(exports, "TransactionResultType", { enumerable: true, get: function () { return connection_js_2.TransactionResultType; } });
|
|
@@ -83,9 +118,9 @@ const establishSession = async (options) => {
|
|
|
83
118
|
exports.establishSession = establishSession;
|
|
84
119
|
const sendSessionEstablishTransaction = async (options, sessionKey, instructions, sessionEstablishmentLookupTable) => {
|
|
85
120
|
const result = await options.context.sendTransaction(sessionKey, instructions, options.walletPublicKey, {
|
|
86
|
-
variation: "Session Establishment",
|
|
87
121
|
addressLookupTable: sessionEstablishmentLookupTable ??
|
|
88
122
|
SESSION_ESTABLISHMENT_LOOKUP_TABLE_ADDRESS[options.context.network],
|
|
123
|
+
variation: "Session Establishment",
|
|
89
124
|
});
|
|
90
125
|
switch (result.type) {
|
|
91
126
|
case connection_js_1.TransactionResultType.Success: {
|
|
@@ -109,8 +144,8 @@ const revokeSession = async (options) => {
|
|
|
109
144
|
const instruction = await new sessions_idls_1.SessionManagerProgram(new anchor_1.AnchorProvider(options.context.connection, {}, {})).methods
|
|
110
145
|
.revokeSession()
|
|
111
146
|
.accounts({
|
|
112
|
-
sponsor: options.session.sessionInfo.sponsor,
|
|
113
147
|
session: options.session.sessionPublicKey,
|
|
148
|
+
sponsor: options.session.sessionInfo.sponsor,
|
|
114
149
|
})
|
|
115
150
|
.instruction();
|
|
116
151
|
return options.context.sendTransaction(options.session.sessionKey, [instruction], options.session.walletPublicKey, {
|
|
@@ -163,17 +198,17 @@ const createSession = async (context, walletPublicKey, sessionKey) => {
|
|
|
163
198
|
!authorizedProgramsMatchDomainRegistry(sessionInfo.authorizedPrograms, domainRegistryAuthorizedPrograms)
|
|
164
199
|
? undefined
|
|
165
200
|
: {
|
|
166
|
-
sessionPublicKey,
|
|
167
|
-
walletPublicKey,
|
|
168
|
-
sessionKey,
|
|
169
|
-
payer: context.payer,
|
|
170
|
-
getSystemProgramSessionWrapInstruction: (amount) => (0, instructions_js_1.createSystemProgramSessionWrapInstruction)(sessionPublicKey, walletPublicKey, amount),
|
|
171
|
-
getSessionWrapInstructions: (amount) => (0, instructions_js_1.createSessionWrapInstructions)(sessionPublicKey, walletPublicKey, amount),
|
|
172
201
|
getSessionUnwrapInstructions: () => [
|
|
173
202
|
(0, instructions_js_1.createSessionUnwrapInstruction)(sessionPublicKey, walletPublicKey),
|
|
174
203
|
],
|
|
204
|
+
getSessionWrapInstructions: (amount) => (0, instructions_js_1.createSessionWrapInstructions)(sessionPublicKey, walletPublicKey, amount),
|
|
205
|
+
getSystemProgramSessionWrapInstruction: (amount) => (0, instructions_js_1.createSystemProgramSessionWrapInstruction)(sessionPublicKey, walletPublicKey, amount),
|
|
206
|
+
payer: context.payer,
|
|
175
207
|
sendTransaction: (instructions, extraConfig) => context.sendTransaction(sessionKey, instructions, walletPublicKey, extraConfig),
|
|
176
208
|
sessionInfo,
|
|
209
|
+
sessionKey,
|
|
210
|
+
sessionPublicKey,
|
|
211
|
+
walletPublicKey,
|
|
177
212
|
};
|
|
178
213
|
};
|
|
179
214
|
const authorizedTokensSchema = zod_1.z.union([
|
|
@@ -185,9 +220,9 @@ const authorizedTokensSchema = zod_1.z.union([
|
|
|
185
220
|
zod_1.z.object({ All: zod_1.z.object({}) }),
|
|
186
221
|
]);
|
|
187
222
|
const revokedSessionInfoSchema = zod_1.z.object({
|
|
188
|
-
user: zod_1.z.instanceof(web3_js_1.PublicKey),
|
|
189
|
-
expiration: zod_1.z.instanceof(bn_js_1.default),
|
|
190
223
|
authorized_tokens_with_mints: authorizedTokensSchema,
|
|
224
|
+
expiration: zod_1.z.instanceof(bn_js_1.default),
|
|
225
|
+
user: zod_1.z.instanceof(web3_js_1.PublicKey),
|
|
191
226
|
});
|
|
192
227
|
const activeSessionInfoSchema = zod_1.z.object({
|
|
193
228
|
authorized_programs: zod_1.z.union([
|
|
@@ -219,6 +254,7 @@ const activeSessionInfoSchema = zod_1.z.object({
|
|
|
219
254
|
});
|
|
220
255
|
const sessionInfoSchema = zod_1.z
|
|
221
256
|
.object({
|
|
257
|
+
major: zod_1.z.number(),
|
|
222
258
|
session_info: zod_1.z.union([
|
|
223
259
|
zod_1.z.object({
|
|
224
260
|
V1: zod_1.z.object({
|
|
@@ -312,8 +348,8 @@ const sessionInfoSchema = zod_1.z
|
|
|
312
348
|
zod_1.z.object({
|
|
313
349
|
Active: zod_1.z.object({
|
|
314
350
|
"0": zod_1.z.object({
|
|
315
|
-
domain_hash: zod_1.z.array(zod_1.z.number()).length(32),
|
|
316
351
|
active_session_info: activeSessionInfoSchema,
|
|
352
|
+
domain_hash: zod_1.z.array(zod_1.z.number()).length(32),
|
|
317
353
|
}),
|
|
318
354
|
}),
|
|
319
355
|
}),
|
|
@@ -321,7 +357,6 @@ const sessionInfoSchema = zod_1.z
|
|
|
321
357
|
}),
|
|
322
358
|
}),
|
|
323
359
|
]),
|
|
324
|
-
major: zod_1.z.number(),
|
|
325
360
|
sponsor: zod_1.z.instanceof(web3_js_1.PublicKey),
|
|
326
361
|
})
|
|
327
362
|
.transform(({ session_info, major, sponsor }) => {
|
|
@@ -360,8 +395,8 @@ const sessionInfoSchema = zod_1.z
|
|
|
360
395
|
extra: activeSessionInfo.extra[0],
|
|
361
396
|
major: major,
|
|
362
397
|
minor: minor,
|
|
363
|
-
user: activeSessionInfo.user,
|
|
364
398
|
sponsor,
|
|
399
|
+
user: activeSessionInfo.user,
|
|
365
400
|
};
|
|
366
401
|
});
|
|
367
402
|
var AuthorizedProgramsType;
|
|
@@ -372,8 +407,8 @@ var AuthorizedProgramsType;
|
|
|
372
407
|
const AuthorizedPrograms = {
|
|
373
408
|
All: () => ({ type: AuthorizedProgramsType.All }),
|
|
374
409
|
Specific: (programs) => ({
|
|
375
|
-
type: AuthorizedProgramsType.Specific,
|
|
376
410
|
programs,
|
|
411
|
+
type: AuthorizedProgramsType.Specific,
|
|
377
412
|
}),
|
|
378
413
|
};
|
|
379
414
|
var AuthorizedTokens;
|
|
@@ -387,13 +422,13 @@ var SymbolOrMintType;
|
|
|
387
422
|
SymbolOrMintType[SymbolOrMintType["Mint"] = 1] = "Mint";
|
|
388
423
|
})(SymbolOrMintType || (SymbolOrMintType = {}));
|
|
389
424
|
const SymbolOrMint = {
|
|
390
|
-
Symbol: (symbol) => ({
|
|
391
|
-
type: SymbolOrMintType.Symbol,
|
|
392
|
-
symbol,
|
|
393
|
-
}),
|
|
394
425
|
Mint: (mint) => ({
|
|
395
|
-
type: SymbolOrMintType.Mint,
|
|
396
426
|
mint,
|
|
427
|
+
type: SymbolOrMintType.Mint,
|
|
428
|
+
}),
|
|
429
|
+
Symbol: (symbol) => ({
|
|
430
|
+
symbol,
|
|
431
|
+
type: SymbolOrMintType.Symbol,
|
|
397
432
|
}),
|
|
398
433
|
};
|
|
399
434
|
const getTokenInfo = (context, limits) => {
|
|
@@ -406,17 +441,19 @@ const getTokenInfo = (context, limits) => {
|
|
|
406
441
|
(0, mpl_token_metadata_1.safeFetchMetadata)(umi, metadataAddress),
|
|
407
442
|
]);
|
|
408
443
|
return {
|
|
444
|
+
amount,
|
|
445
|
+
decimals: mintInfo.decimals,
|
|
446
|
+
metadataAddress: new web3_js_1.PublicKey(metadataAddress),
|
|
447
|
+
mint,
|
|
409
448
|
symbolOrMint: metadata?.symbol
|
|
410
449
|
? SymbolOrMint.Symbol(metadata.symbol)
|
|
411
450
|
: SymbolOrMint.Mint(mint),
|
|
412
|
-
metadataAddress: new web3_js_1.PublicKey(metadataAddress),
|
|
413
|
-
amount,
|
|
414
|
-
mint,
|
|
415
|
-
decimals: mintInfo.decimals,
|
|
416
451
|
};
|
|
417
452
|
}));
|
|
418
453
|
};
|
|
419
|
-
const buildStartSessionIntentInstruction = async (options, sessionKey, tokens) => buildIntentInstruction(options, MESSAGE_HEADER,
|
|
454
|
+
const buildStartSessionIntentInstruction = async (options, sessionKey, tokens) => buildIntentInstruction(options, MESSAGE_HEADER,
|
|
455
|
+
// biome-ignore assist/source/useSortedKeys: The sort order is important here
|
|
456
|
+
{
|
|
420
457
|
version: `${CURRENT_MAJOR}.${CURRENT_MINOR}`,
|
|
421
458
|
chain_id: options.context.chainId,
|
|
422
459
|
domain: options.context.domain,
|
|
@@ -427,12 +464,80 @@ const buildStartSessionIntentInstruction = async (options, sessionKey, tokens) =
|
|
|
427
464
|
const buildIntentInstruction = async (options, header, body, extra) => {
|
|
428
465
|
const message = new TextEncoder().encode([header, serializeKV(body), extra && serializeExtra(extra)].join("\n"));
|
|
429
466
|
const { signature, signedMessage } = await options.signMessage(message);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
467
|
+
const publicKey = options.walletPublicKey.toBytes();
|
|
468
|
+
const publicKeyOffsetInMessage = getOffchainMessagePublicKeyOffset(signedMessage, options.walletPublicKey);
|
|
469
|
+
if (publicKeyOffsetInMessage !== undefined) {
|
|
470
|
+
return buildEd25519InstructionWithOffsets({
|
|
471
|
+
message: signedMessage,
|
|
472
|
+
publicKeyOffsetInMessage,
|
|
473
|
+
signature,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
return web3_js_1.Ed25519Program.createInstructionWithPublicKey({
|
|
478
|
+
message: signedMessage,
|
|
479
|
+
publicKey,
|
|
480
|
+
signature,
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const ED25519_HEADER_LEN = 16;
|
|
485
|
+
const ED25519_PUBLIC_KEY_LEN = 32;
|
|
486
|
+
const ED25519_SIGNATURE_LEN = 64;
|
|
487
|
+
const ED25519_CURRENT_INSTRUCTION_INDEX = 0xff_ff;
|
|
488
|
+
const buildEd25519InstructionWithOffsets = (params) => {
|
|
489
|
+
const { signature, message, publicKeyOffsetInMessage } = params;
|
|
490
|
+
if (signature.length !== ED25519_SIGNATURE_LEN) {
|
|
491
|
+
throw new Error(`Signature must be ${ED25519_SIGNATURE_LEN} bytes but received ${signature.length} bytes`);
|
|
492
|
+
}
|
|
493
|
+
if (publicKeyOffsetInMessage < 0 ||
|
|
494
|
+
publicKeyOffsetInMessage + ED25519_PUBLIC_KEY_LEN > message.length) {
|
|
495
|
+
throw new Error("Public key offset is out of bounds of signed message");
|
|
496
|
+
}
|
|
497
|
+
const signatureOffset = ED25519_HEADER_LEN;
|
|
498
|
+
const messageDataOffset = signatureOffset + signature.length;
|
|
499
|
+
const publicKeyOffsetInInstruction = messageDataOffset + publicKeyOffsetInMessage;
|
|
500
|
+
const instructionData = new Uint8Array(ED25519_HEADER_LEN + ED25519_SIGNATURE_LEN + message.length);
|
|
501
|
+
const view = new DataView(instructionData.buffer);
|
|
502
|
+
view.setUint8(0, 1); // num_signatures
|
|
503
|
+
view.setUint8(1, 0); // padding
|
|
504
|
+
view.setUint16(2, signatureOffset, true);
|
|
505
|
+
view.setUint16(4, ED25519_CURRENT_INSTRUCTION_INDEX, true);
|
|
506
|
+
view.setUint16(6, publicKeyOffsetInInstruction, true);
|
|
507
|
+
view.setUint16(8, ED25519_CURRENT_INSTRUCTION_INDEX, true);
|
|
508
|
+
view.setUint16(10, messageDataOffset, true);
|
|
509
|
+
view.setUint16(12, message.length, true);
|
|
510
|
+
view.setUint16(14, ED25519_CURRENT_INSTRUCTION_INDEX, true);
|
|
511
|
+
instructionData.set(signature, signatureOffset);
|
|
512
|
+
instructionData.set(message, messageDataOffset);
|
|
513
|
+
return new web3_js_1.TransactionInstruction({
|
|
514
|
+
data: Buffer.from(instructionData),
|
|
515
|
+
keys: [],
|
|
516
|
+
programId: web3_js_1.Ed25519Program.programId,
|
|
434
517
|
});
|
|
435
518
|
};
|
|
519
|
+
const OFFCHAIN_SIGNING_DOMAIN_LEN = 16;
|
|
520
|
+
const OFFCHAIN_V0_SIGNER_LIST_OFFSET = OFFCHAIN_SIGNING_DOMAIN_LEN + 1 + 32 + 1 + 1;
|
|
521
|
+
const OFFCHAIN_V1_SIGNER_LIST_OFFSET = OFFCHAIN_SIGNING_DOMAIN_LEN + 1 + 1;
|
|
522
|
+
const getOffchainMessagePublicKeyOffset = (signedMessage, publicKey) => {
|
|
523
|
+
const address = publicKey.toBase58();
|
|
524
|
+
try {
|
|
525
|
+
const message = (0, kit_1.getOffchainMessageDecoder)().decode(signedMessage);
|
|
526
|
+
const index = message.requiredSignatories.findIndex((signer) => signer.address === address);
|
|
527
|
+
if (index !== -1) {
|
|
528
|
+
const baseOffset = message.version === 1
|
|
529
|
+
? OFFCHAIN_V1_SIGNER_LIST_OFFSET
|
|
530
|
+
: OFFCHAIN_V0_SIGNER_LIST_OFFSET;
|
|
531
|
+
return baseOffset + index * ED25519_PUBLIC_KEY_LEN;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
return undefined;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
catch {
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
436
541
|
const serializeExtra = (extra) => {
|
|
437
542
|
for (const [key, value] of Object.entries(extra)) {
|
|
438
543
|
if (!/^[a-z]+(_[a-z0-9]+)*$/.test(key)) {
|
|
@@ -474,7 +579,7 @@ const amountToString = (amount, decimals) => {
|
|
|
474
579
|
].join("");
|
|
475
580
|
};
|
|
476
581
|
const getDomainRecordAddress = (domain) => {
|
|
477
|
-
const hash = (0,
|
|
582
|
+
const hash = (0, sha2_js_1.sha256)(new TextEncoder().encode(domain));
|
|
478
583
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("domain-record"), hash], new web3_js_1.PublicKey(sessions_idls_1.DomainRegistryIdl.address))[0];
|
|
479
584
|
};
|
|
480
585
|
exports.getDomainRecordAddress = getDomainRecordAddress;
|
|
@@ -492,30 +597,30 @@ const buildStartSessionInstruction = async (options, sessionKey, tokens) => {
|
|
|
492
597
|
const instruction = new sessions_idls_1.SessionManagerProgram(new anchor_1.AnchorProvider(options.context.connection, {}, {})).methods
|
|
493
598
|
.startSession()
|
|
494
599
|
.accounts({
|
|
495
|
-
sponsor: options.context.payer,
|
|
496
|
-
session: await (0, kit_1.getAddressFromPublicKey)(sessionKey.publicKey),
|
|
497
600
|
domainRegistry: (0, exports.getDomainRecordAddress)(options.context.domain),
|
|
601
|
+
session: await (0, kit_1.getAddressFromPublicKey)(sessionKey.publicKey),
|
|
602
|
+
sponsor: options.context.payer,
|
|
498
603
|
});
|
|
499
604
|
return tokens === undefined
|
|
500
605
|
? instruction.instruction()
|
|
501
606
|
: instruction
|
|
502
607
|
.remainingAccounts(tokens.flatMap(({ symbolOrMint, mint, metadataAddress }) => [
|
|
503
608
|
{
|
|
504
|
-
pubkey: (0, spl_token_1.getAssociatedTokenAddressSync)(mint, options.walletPublicKey),
|
|
505
|
-
isWritable: true,
|
|
506
609
|
isSigner: false,
|
|
610
|
+
isWritable: true,
|
|
611
|
+
pubkey: (0, spl_token_1.getAssociatedTokenAddressSync)(mint, options.walletPublicKey),
|
|
507
612
|
},
|
|
508
613
|
{
|
|
509
|
-
pubkey: mint,
|
|
510
|
-
isWritable: false,
|
|
511
614
|
isSigner: false,
|
|
615
|
+
isWritable: false,
|
|
616
|
+
pubkey: mint,
|
|
512
617
|
},
|
|
513
618
|
...(symbolOrMint.type === SymbolOrMintType.Symbol
|
|
514
619
|
? [
|
|
515
620
|
{
|
|
516
|
-
pubkey: metadataAddress,
|
|
517
|
-
isWritable: false,
|
|
518
621
|
isSigner: false,
|
|
622
|
+
isWritable: false,
|
|
623
|
+
pubkey: metadataAddress,
|
|
519
624
|
},
|
|
520
625
|
]
|
|
521
626
|
: []),
|
|
@@ -528,15 +633,15 @@ var SessionResultType;
|
|
|
528
633
|
SessionResultType[SessionResultType["Failed"] = 1] = "Failed";
|
|
529
634
|
})(SessionResultType || (exports.SessionResultType = SessionResultType = {}));
|
|
530
635
|
const EstablishSessionResult = {
|
|
531
|
-
Success: (signature, session) => ({
|
|
532
|
-
type: SessionResultType.Success,
|
|
533
|
-
signature,
|
|
534
|
-
session,
|
|
535
|
-
}),
|
|
536
636
|
Failed: (signature, error) => ({
|
|
637
|
+
error,
|
|
638
|
+
signature,
|
|
537
639
|
type: SessionResultType.Failed,
|
|
640
|
+
}),
|
|
641
|
+
Success: (signature, session) => ({
|
|
642
|
+
session,
|
|
538
643
|
signature,
|
|
539
|
-
|
|
644
|
+
type: SessionResultType.Success,
|
|
540
645
|
}),
|
|
541
646
|
};
|
|
542
647
|
const getTransferFee = async (context) => {
|
|
@@ -563,16 +668,16 @@ const getFee = async (context) => {
|
|
|
563
668
|
const [feeConfigPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("fee_config"), usdcMint.toBytes()], program.programId);
|
|
564
669
|
const feeConfig = await program.account.feeConfig.fetch(feeConfigPda);
|
|
565
670
|
return {
|
|
671
|
+
decimals: mints_js_1.USDC_DECIMALS,
|
|
672
|
+
fee: {
|
|
673
|
+
bridgeTransfer: BigInt(feeConfig.bridgeTransferFee.toString()),
|
|
674
|
+
intrachainTransfer: BigInt(feeConfig.intrachainTransferFee.toString()),
|
|
675
|
+
},
|
|
566
676
|
metadata: (0, mpl_token_metadata_1.findMetadataPda)(umi, {
|
|
567
677
|
mint: (0, umi_1.publicKey)(usdcMintAddress),
|
|
568
678
|
})[0],
|
|
569
679
|
mint: usdcMint,
|
|
570
680
|
symbolOrMint: "USDC.s",
|
|
571
|
-
decimals: mints_js_1.USDC_DECIMALS,
|
|
572
|
-
fee: {
|
|
573
|
-
intrachainTransfer: BigInt(feeConfig.intrachainTransferFee.toString()),
|
|
574
|
-
bridgeTransfer: BigInt(feeConfig.bridgeTransferFee.toString()),
|
|
575
|
-
},
|
|
576
681
|
};
|
|
577
682
|
};
|
|
578
683
|
const TRANSFER_MESSAGE_HEADER = `Fogo Transfer:
|
|
@@ -595,17 +700,17 @@ const sendTransfer = async (options) => {
|
|
|
595
700
|
feeMetadata: options.feeConfig.metadata,
|
|
596
701
|
feeMint: options.feeConfig.mint,
|
|
597
702
|
feeSource: (0, spl_token_1.getAssociatedTokenAddressSync)(options.feeConfig.mint, options.walletPublicKey),
|
|
598
|
-
mint: options.mint,
|
|
599
|
-
source: sourceAta,
|
|
600
|
-
sponsor: options.context.internalPayer,
|
|
601
703
|
metadata:
|
|
602
704
|
// eslint-disable-next-line unicorn/no-null
|
|
603
705
|
symbol === undefined ? null : new web3_js_1.PublicKey(metadataAddress),
|
|
706
|
+
mint: options.mint,
|
|
707
|
+
source: sourceAta,
|
|
708
|
+
sponsor: options.context.internalPayer,
|
|
604
709
|
})
|
|
605
710
|
.instruction(),
|
|
606
711
|
], options.walletPublicKey, {
|
|
607
|
-
variation: "Intent Transfer",
|
|
608
712
|
paymasterDomain: context_js_1.SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
|
|
713
|
+
variation: "Intent Transfer",
|
|
609
714
|
});
|
|
610
715
|
};
|
|
611
716
|
exports.sendTransfer = sendTransfer;
|
|
@@ -614,7 +719,9 @@ const buildTransferIntentInstruction = async (program, options, symbol, feeToken
|
|
|
614
719
|
getNonce(program, options.walletPublicKey, NonceType.Transfer),
|
|
615
720
|
(0, spl_token_1.getMint)(options.context.connection, options.mint),
|
|
616
721
|
]);
|
|
617
|
-
return buildIntentInstruction(options, TRANSFER_MESSAGE_HEADER,
|
|
722
|
+
return buildIntentInstruction(options, TRANSFER_MESSAGE_HEADER,
|
|
723
|
+
// biome-ignore assist/source/useSortedKeys: The sort order is important here
|
|
724
|
+
{
|
|
618
725
|
version: `${CURRENT_INTENT_TRANSFER_MAJOR}.${CURRENT_INTENT_TRANSFER_MINOR}`,
|
|
619
726
|
chain_id: options.context.chainId,
|
|
620
727
|
token: symbol ?? options.mint.toBase58(),
|
|
@@ -632,25 +739,27 @@ const sendNativeTransfer = async (options) => {
|
|
|
632
739
|
await program.methods
|
|
633
740
|
.sendNative()
|
|
634
741
|
.accounts({
|
|
742
|
+
destination: options.recipient,
|
|
743
|
+
feeDestination: sessions_idls_1.IntentTransferIdl.address,
|
|
635
744
|
feeMetadata: options.feeConfig.metadata,
|
|
636
745
|
feeMint: options.feeConfig.mint,
|
|
637
746
|
feeSource: (0, spl_token_1.getAssociatedTokenAddressSync)(options.feeConfig.mint, options.walletPublicKey),
|
|
638
|
-
feeDestination: sessions_idls_1.IntentTransferIdl.address,
|
|
639
747
|
source: options.walletPublicKey,
|
|
640
|
-
destination: options.recipient,
|
|
641
748
|
sponsor: options.context.internalPayer,
|
|
642
749
|
})
|
|
643
750
|
.instruction(),
|
|
644
751
|
], options.walletPublicKey, {
|
|
645
|
-
variation: "Intent Transfer",
|
|
646
752
|
paymasterDomain: context_js_1.SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
|
|
753
|
+
variation: "Intent Transfer",
|
|
647
754
|
});
|
|
648
755
|
};
|
|
649
756
|
exports.sendNativeTransfer = sendNativeTransfer;
|
|
650
757
|
const FOGO_DECIMALS = 9;
|
|
651
758
|
const buildNativeTransferIntentInstruction = async (program, options, feeToken, feeAmount) => {
|
|
652
759
|
const nonce = await getNonce(program, options.walletPublicKey, NonceType.Transfer);
|
|
653
|
-
return buildIntentInstruction(options, TRANSFER_MESSAGE_HEADER,
|
|
760
|
+
return buildIntentInstruction(options, TRANSFER_MESSAGE_HEADER,
|
|
761
|
+
// biome-ignore assist/source/useSortedKeys: The sort order is important here
|
|
762
|
+
{
|
|
654
763
|
version: `${CURRENT_INTENT_TRANSFER_MAJOR}.${CURRENT_INTENT_TRANSFER_MINOR}`,
|
|
655
764
|
chain_id: options.context.chainId,
|
|
656
765
|
token: "FOGO",
|
|
@@ -688,17 +797,17 @@ const bridgeOut = async (options) => {
|
|
|
688
797
|
signedQuoteBytes: [...quote.signedQuote],
|
|
689
798
|
})
|
|
690
799
|
.accounts({
|
|
691
|
-
|
|
692
|
-
|
|
800
|
+
feeMetadata: options.feeConfig.metadata,
|
|
801
|
+
feeMint: options.feeConfig.mint,
|
|
802
|
+
feeSource: (0, spl_token_1.getAssociatedTokenAddressSync)(options.feeConfig.mint, options.walletPublicKey),
|
|
693
803
|
metadata: metadata?.symbol === undefined
|
|
694
804
|
? // eslint-disable-next-line unicorn/no-null
|
|
695
805
|
null
|
|
696
806
|
: new web3_js_1.PublicKey(metadataAddress),
|
|
697
|
-
|
|
807
|
+
mint: options.fromToken.mint,
|
|
698
808
|
ntt: nttPdas,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
feeSource: (0, spl_token_1.getAssociatedTokenAddressSync)(options.feeConfig.mint, options.walletPublicKey),
|
|
809
|
+
source: (0, spl_token_1.getAssociatedTokenAddressSync)(options.fromToken.mint, options.walletPublicKey),
|
|
810
|
+
sponsor: options.context.internalPayer,
|
|
702
811
|
})
|
|
703
812
|
.instruction(),
|
|
704
813
|
]);
|
|
@@ -706,10 +815,10 @@ const bridgeOut = async (options) => {
|
|
|
706
815
|
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: BRIDGE_OUT_CUS }),
|
|
707
816
|
...instructions,
|
|
708
817
|
], options.walletPublicKey, {
|
|
709
|
-
variation: "Intent NTT Bridge",
|
|
710
|
-
paymasterDomain: context_js_1.SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
|
|
711
|
-
extraSigners: [outboxItem],
|
|
712
818
|
addressLookupTable: BRIDGING_ADDRESS_LOOKUP_TABLE[options.context.network]?.[options.fromToken.mint.toBase58()],
|
|
819
|
+
extraSigners: [outboxItem],
|
|
820
|
+
paymasterDomain: context_js_1.SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
|
|
821
|
+
variation: "Intent NTT Bridge",
|
|
713
822
|
});
|
|
714
823
|
};
|
|
715
824
|
exports.bridgeOut = bridgeOut;
|
|
@@ -752,16 +861,18 @@ const getNttPdas = async (options, wh, program, outboxItemPublicKey, quotePayeeA
|
|
|
752
861
|
nttTokenAuthority: pdas.tokenAuthority(),
|
|
753
862
|
payeeNttWithExecutor: quotePayeeAddress,
|
|
754
863
|
transceiver: registeredTransceiverPda,
|
|
755
|
-
wormholeProgram: coreBridgeContract,
|
|
756
864
|
wormholeBridge: wormholePdas.wormholeBridge,
|
|
757
865
|
wormholeFeeCollector: wormholePdas.wormholeFeeCollector,
|
|
758
866
|
wormholeMessage: transceiverPdas.wormholeMessageAccount(outboxItemPublicKey),
|
|
867
|
+
wormholeProgram: coreBridgeContract,
|
|
759
868
|
wormholeSequence: wormholePdas.wormholeSequence,
|
|
760
869
|
};
|
|
761
870
|
};
|
|
762
871
|
const buildBridgeOutIntent = async (program, options, decimals, symbol, feeToken, feeAmount) => {
|
|
763
872
|
const nonce = await getNonce(program, options.walletPublicKey, NonceType.Bridge);
|
|
764
|
-
return buildIntentInstruction(options, BRIDGE_OUT_MESSAGE_HEADER,
|
|
873
|
+
return buildIntentInstruction(options, BRIDGE_OUT_MESSAGE_HEADER,
|
|
874
|
+
// biome-ignore assist/source/useSortedKeys: The sort order is important here
|
|
875
|
+
{
|
|
765
876
|
version: `${CURRENT_BRIDGE_OUT_MAJOR}.${CURRENT_BRIDGE_OUT_MINOR}`,
|
|
766
877
|
from_chain_id: options.context.chainId,
|
|
767
878
|
to_chain_id: "solana",
|
|
@@ -780,7 +891,7 @@ const bridgeIn = async (options) => {
|
|
|
780
891
|
// properly represent the runtime representation.
|
|
781
892
|
const quote = await route.quote(transferRequest, transferParams);
|
|
782
893
|
if (quote.success) {
|
|
783
|
-
return await
|
|
894
|
+
return await routes.checkAndCompleteTransfer(route, await route.initiate(transferRequest, {
|
|
784
895
|
address: () => options.walletPublicKey.toBase58(),
|
|
785
896
|
chain: () => "Solana",
|
|
786
897
|
sign: (transactions) => Promise.all(transactions.map(async ({ transaction }) => {
|
|
@@ -839,10 +950,10 @@ const buildWormholeTransfer = async (options, connection) => {
|
|
|
839
950
|
},
|
|
840
951
|
});
|
|
841
952
|
const route = new Route(wh);
|
|
842
|
-
const transferRequest = await
|
|
953
|
+
const transferRequest = await routes.RouteTransferRequest.create(wh, {
|
|
954
|
+
destination: sdk_1.Wormhole.tokenId(options.toToken.chain, options.toToken.mint.toBase58()),
|
|
843
955
|
recipient: sdk_1.Wormhole.chainAddress(options.toToken.chain, options.walletPublicKey.toBase58()),
|
|
844
956
|
source: sdk_1.Wormhole.tokenId(options.fromToken.chain, options.fromToken.mint.toBase58()),
|
|
845
|
-
destination: sdk_1.Wormhole.tokenId(options.toToken.chain, options.toToken.mint.toBase58()),
|
|
846
957
|
});
|
|
847
958
|
const validated = await route.validate(transferRequest, {
|
|
848
959
|
amount: amountToString(options.amount, decimals),
|
|
@@ -850,11 +961,11 @@ const buildWormholeTransfer = async (options, connection) => {
|
|
|
850
961
|
});
|
|
851
962
|
if (validated.valid) {
|
|
852
963
|
return {
|
|
853
|
-
|
|
964
|
+
decimals,
|
|
854
965
|
route,
|
|
855
|
-
transferRequest,
|
|
856
966
|
transferParams: validated.params,
|
|
857
|
-
|
|
967
|
+
transferRequest,
|
|
968
|
+
wh,
|
|
858
969
|
};
|
|
859
970
|
}
|
|
860
971
|
else {
|
package/cjs/instructions.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.createSessionWrapInstructions = createSessionWrapInstructions;
|
|
|
6
6
|
exports.createSessionUnwrapInstruction = createSessionUnwrapInstruction;
|
|
7
7
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
8
8
|
const sessions_idls_1 = require("@fogo/sessions-idls");
|
|
9
|
-
const
|
|
9
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
10
10
|
const spl_token_1 = require("@solana/spl-token");
|
|
11
11
|
const web3_js_1 = require("@solana/web3.js");
|
|
12
12
|
const SESSION_WRAP_DISCRIMINATOR = 4_000_000;
|
|
@@ -23,17 +23,17 @@ function createSystemProgramSessionWrapInstruction(sessionKey, walletPublicKey,
|
|
|
23
23
|
view.setUint32(0, SESSION_WRAP_DISCRIMINATOR, true);
|
|
24
24
|
view.setBigUint64(4, amount, true);
|
|
25
25
|
return new web3_js_1.TransactionInstruction({
|
|
26
|
-
|
|
26
|
+
data: Buffer.from(data),
|
|
27
27
|
keys: [
|
|
28
|
-
{
|
|
28
|
+
{ isSigner: false, isWritable: true, pubkey: walletPublicKey },
|
|
29
29
|
{
|
|
30
|
-
pubkey: getNativeMintAssociatedTokenAddressSync(walletPublicKey),
|
|
31
30
|
isSigner: false,
|
|
32
31
|
isWritable: true,
|
|
32
|
+
pubkey: getNativeMintAssociatedTokenAddressSync(walletPublicKey),
|
|
33
33
|
},
|
|
34
|
-
{
|
|
34
|
+
{ isSigner: true, isWritable: false, pubkey: sessionKey },
|
|
35
35
|
],
|
|
36
|
-
|
|
36
|
+
programId: web3_js_1.SystemProgram.programId,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -59,7 +59,7 @@ function createSessionUnwrapInstruction(sessionKey, walletPublicKey) {
|
|
|
59
59
|
return (0, spl_token_1.createCloseAccountInstruction)(getNativeMintAssociatedTokenAddressSync(walletPublicKey), walletPublicKey, sessionKey);
|
|
60
60
|
}
|
|
61
61
|
const getDomainTollRecipientAddress = (domain) => {
|
|
62
|
-
const hash = (0,
|
|
62
|
+
const hash = (0, sha2_js_1.sha256)(new TextEncoder().encode(domain));
|
|
63
63
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("toll_recipient"), Buffer.from([0]), hash], new web3_js_1.PublicKey(sessions_idls_1.TollboothIdl.address))[0];
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
@@ -72,10 +72,10 @@ const createPaymasterFeeInstruction = ({ sessionKey, walletPublicKey, domain, fe
|
|
|
72
72
|
return new sessions_idls_1.TollboothProgram(new anchor_1.AnchorProvider({}, {})).methods
|
|
73
73
|
.payToll(feeAmount, 0)
|
|
74
74
|
.accounts({
|
|
75
|
-
session: sessionKey,
|
|
76
|
-
source: (0, spl_token_1.getAssociatedTokenAddressSync)(feeMint, walletPublicKey),
|
|
77
75
|
destination: (0, spl_token_1.getAssociatedTokenAddressSync)(feeMint, recipient, true),
|
|
78
76
|
mint: feeMint,
|
|
77
|
+
session: sessionKey,
|
|
78
|
+
source: (0, spl_token_1.getAssociatedTokenAddressSync)(feeMint, walletPublicKey),
|
|
79
79
|
})
|
|
80
80
|
.instruction();
|
|
81
81
|
};
|
package/esm/connection.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { Address, GetLatestBlockhashApi, Instruction, Rpc, Transaction, TransactionWithLifetime } from "@solana/kit";
|
|
2
|
-
import type { TransactionError } from "@solana/web3.js";
|
|
3
|
-
import { Keypair, PublicKey,
|
|
2
|
+
import type { TransactionError, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
import { Keypair, PublicKey, VersionedTransaction, Connection as Web3Connection } from "@solana/web3.js";
|
|
4
4
|
import { Network } from "./network.js";
|
|
5
5
|
export declare enum TransactionResultType {
|
|
6
6
|
Success = 0,
|
|
7
7
|
Failed = 1
|
|
8
8
|
}
|
|
9
9
|
declare const TransactionResult: {
|
|
10
|
-
Success: (signature: string) => {
|
|
11
|
-
type: TransactionResultType.Success;
|
|
12
|
-
signature: string;
|
|
13
|
-
};
|
|
14
10
|
Failed: (signature: string, error: TransactionError) => {
|
|
11
|
+
error: TransactionError;
|
|
12
|
+
signature: string;
|
|
15
13
|
type: TransactionResultType.Failed;
|
|
14
|
+
};
|
|
15
|
+
Success: (signature: string) => {
|
|
16
16
|
signature: string;
|
|
17
|
-
|
|
17
|
+
type: TransactionResultType.Success;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export type TransactionResult = ReturnType<(typeof TransactionResult)[keyof typeof TransactionResult]>;
|
|
@@ -30,12 +30,12 @@ export declare const createSessionConnection: (options: {
|
|
|
30
30
|
sendToPaymaster: (transaction: Transaction) => Promise<TransactionResult>;
|
|
31
31
|
sponsor: PublicKey;
|
|
32
32
|
})) => {
|
|
33
|
-
rpc: Rpc<import("@solana/kit").RequestAirdropApi & import("@solana/kit").GetAccountInfoApi & import("@solana/kit").GetBalanceApi & import("@solana/kit").GetBlockApi & import("@solana/kit").GetBlockCommitmentApi & import("@solana/kit").GetBlockHeightApi & import("@solana/kit").GetBlockProductionApi & import("@solana/kit").GetBlocksApi & import("@solana/kit").GetBlocksWithLimitApi & import("@solana/kit").GetBlockTimeApi & import("@solana/kit").GetClusterNodesApi & import("@solana/kit").GetEpochInfoApi & import("@solana/kit").GetEpochScheduleApi & import("@solana/kit").GetFeeForMessageApi & import("@solana/kit").GetFirstAvailableBlockApi & import("@solana/kit").GetGenesisHashApi & import("@solana/kit").GetHealthApi & import("@solana/kit").GetHighestSnapshotSlotApi & import("@solana/kit").GetIdentityApi & import("@solana/kit").GetInflationGovernorApi & import("@solana/kit").GetInflationRateApi & import("@solana/kit").GetInflationRewardApi & import("@solana/kit").GetLargestAccountsApi & GetLatestBlockhashApi & import("@solana/kit").GetLeaderScheduleApi & import("@solana/kit").GetMaxRetransmitSlotApi & import("@solana/kit").GetMaxShredInsertSlotApi & import("@solana/kit").GetMinimumBalanceForRentExemptionApi & import("@solana/kit").GetMultipleAccountsApi & import("@solana/kit").GetProgramAccountsApi & import("@solana/kit").GetRecentPerformanceSamplesApi & import("@solana/kit").GetRecentPrioritizationFeesApi & import("@solana/kit").GetSignaturesForAddressApi & import("@solana/kit").GetSignatureStatusesApi & import("@solana/kit").GetSlotApi & import("@solana/kit").GetSlotLeaderApi & import("@solana/kit").GetSlotLeadersApi & import("@solana/kit").GetStakeMinimumDelegationApi & import("@solana/kit").GetSupplyApi & import("@solana/kit").GetTokenAccountBalanceApi & import("@solana/kit").GetTokenAccountsByDelegateApi & import("@solana/kit").GetTokenAccountsByOwnerApi & import("@solana/kit").GetTokenLargestAccountsApi & import("@solana/kit").GetTokenSupplyApi & import("@solana/kit").GetTransactionApi & import("@solana/kit").GetTransactionCountApi & import("@solana/kit").GetVersionApi & import("@solana/kit").GetVoteAccountsApi & import("@solana/kit").IsBlockhashValidApi & import("@solana/kit").MinimumLedgerSlotApi & import("@solana/kit").SendTransactionApi & import("@solana/kit").SimulateTransactionApi>;
|
|
34
33
|
connection: Web3Connection;
|
|
35
|
-
network: Network;
|
|
36
34
|
getSolanaConnection: () => Promise<Web3Connection>;
|
|
37
|
-
sendToPaymaster: (domain: string, sessionKey: CryptoKeyPair | undefined, instructions: TransactionOrInstructions, walletPublicKey: PublicKey, extraConfig?: SendTransactionOptions) => Promise<TransactionResult>;
|
|
38
35
|
getSponsor: (domain: string) => Promise<PublicKey>;
|
|
36
|
+
network: Network;
|
|
37
|
+
rpc: Rpc<import("@solana/kit").RequestAirdropApi & import("@solana/kit").GetAccountInfoApi & import("@solana/kit").GetBalanceApi & import("@solana/kit").GetBlockApi & import("@solana/kit").GetBlockCommitmentApi & import("@solana/kit").GetBlockHeightApi & import("@solana/kit").GetBlockProductionApi & import("@solana/kit").GetBlocksApi & import("@solana/kit").GetBlocksWithLimitApi & import("@solana/kit").GetBlockTimeApi & import("@solana/kit").GetClusterNodesApi & import("@solana/kit").GetEpochInfoApi & import("@solana/kit").GetEpochScheduleApi & import("@solana/kit").GetFeeForMessageApi & import("@solana/kit").GetFirstAvailableBlockApi & import("@solana/kit").GetGenesisHashApi & import("@solana/kit").GetHealthApi & import("@solana/kit").GetHighestSnapshotSlotApi & import("@solana/kit").GetIdentityApi & import("@solana/kit").GetInflationGovernorApi & import("@solana/kit").GetInflationRateApi & import("@solana/kit").GetInflationRewardApi & import("@solana/kit").GetLargestAccountsApi & GetLatestBlockhashApi & import("@solana/kit").GetLeaderScheduleApi & import("@solana/kit").GetMaxRetransmitSlotApi & import("@solana/kit").GetMaxShredInsertSlotApi & import("@solana/kit").GetMinimumBalanceForRentExemptionApi & import("@solana/kit").GetMultipleAccountsApi & import("@solana/kit").GetProgramAccountsApi & import("@solana/kit").GetRecentPerformanceSamplesApi & import("@solana/kit").GetRecentPrioritizationFeesApi & import("@solana/kit").GetSignaturesForAddressApi & import("@solana/kit").GetSignatureStatusesApi & import("@solana/kit").GetSlotApi & import("@solana/kit").GetSlotLeaderApi & import("@solana/kit").GetSlotLeadersApi & import("@solana/kit").GetStakeMinimumDelegationApi & import("@solana/kit").GetSupplyApi & import("@solana/kit").GetTokenAccountBalanceApi & import("@solana/kit").GetTokenAccountsByDelegateApi & import("@solana/kit").GetTokenAccountsByOwnerApi & import("@solana/kit").GetTokenLargestAccountsApi & import("@solana/kit").GetTokenSupplyApi & import("@solana/kit").GetTransactionApi & import("@solana/kit").GetTransactionCountApi & import("@solana/kit").GetVersionApi & import("@solana/kit").GetVoteAccountsApi & import("@solana/kit").IsBlockhashValidApi & import("@solana/kit").MinimumLedgerSlotApi & import("@solana/kit").SendTransactionApi & import("@solana/kit").SimulateTransactionApi>;
|
|
38
|
+
sendToPaymaster: (domain: string, sessionKey: CryptoKeyPair | undefined, instructions: TransactionOrInstructions, walletPublicKey: PublicKey, extraConfig?: SendTransactionOptions) => Promise<TransactionResult>;
|
|
39
39
|
};
|
|
40
40
|
export type TransactionOrInstructions = (TransactionInstruction | Instruction)[] | VersionedTransaction | (Transaction & TransactionWithLifetime);
|
|
41
41
|
export type SendTransactionOptions = {
|