@rozoai/checkout 0.1.20 → 0.1.21
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/README.md +37 -9
- package/docs/QUICKSTART.es.md +14 -6
- package/docs/QUICKSTART.ja.md +8 -3
- package/docs/QUICKSTART.md +13 -5
- package/docs/QUICKSTART.zh.md +6 -4
- package/docs/README.es.md +19 -4
- package/docs/README.ja.md +18 -4
- package/docs/README.zh.md +18 -4
- package/llms.txt +23 -8
- package/package.json +7 -2
- package/scripts/dist/cli.js +1294 -553
- package/scripts/dist/create-order.js +209 -22
- package/scripts/dist/quote.js +107 -5
- package/scripts/dist/receipt.js +84 -13
- package/scripts/dist/resume.js +103 -18
- package/scripts/dist/send-evm.js +31852 -211
- package/scripts/dist/send-sol.js +468 -248
- package/scripts/dist/status.js +87 -13
package/scripts/dist/send-sol.js
CHANGED
|
@@ -23089,7 +23089,7 @@ var require_index_cjs = __commonJS({
|
|
|
23089
23089
|
return value._bn !== void 0;
|
|
23090
23090
|
}
|
|
23091
23091
|
var uniquePublicKeyCounter = 1;
|
|
23092
|
-
var
|
|
23092
|
+
var PublicKey4 = class _PublicKey2 extends Struct {
|
|
23093
23093
|
/**
|
|
23094
23094
|
* Create a new PublicKey object
|
|
23095
23095
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
@@ -23251,9 +23251,9 @@ var require_index_cjs = __commonJS({
|
|
|
23251
23251
|
return isOnCurve(pubkey.toBytes());
|
|
23252
23252
|
}
|
|
23253
23253
|
};
|
|
23254
|
-
_PublicKey =
|
|
23255
|
-
|
|
23256
|
-
SOLANA_SCHEMA.set(
|
|
23254
|
+
_PublicKey = PublicKey4;
|
|
23255
|
+
PublicKey4.default = new _PublicKey("11111111111111111111111111111111");
|
|
23256
|
+
SOLANA_SCHEMA.set(PublicKey4, {
|
|
23257
23257
|
kind: "struct",
|
|
23258
23258
|
fields: [["_bn", "u256"]]
|
|
23259
23259
|
});
|
|
@@ -23285,7 +23285,7 @@ var require_index_cjs = __commonJS({
|
|
|
23285
23285
|
* The public key for this account
|
|
23286
23286
|
*/
|
|
23287
23287
|
get publicKey() {
|
|
23288
|
-
return new
|
|
23288
|
+
return new PublicKey4(this._publicKey);
|
|
23289
23289
|
}
|
|
23290
23290
|
/**
|
|
23291
23291
|
* The **unencrypted** secret key for this account. The first 32 bytes
|
|
@@ -23296,7 +23296,7 @@ var require_index_cjs = __commonJS({
|
|
|
23296
23296
|
return buffer.Buffer.concat([this._secretKey, this._publicKey], 64);
|
|
23297
23297
|
}
|
|
23298
23298
|
};
|
|
23299
|
-
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new
|
|
23299
|
+
var BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey4("BPFLoader1111111111111111111111111111111111");
|
|
23300
23300
|
var PACKET_DATA_SIZE = 1280 - 40 - 8;
|
|
23301
23301
|
var VERSION_PREFIX_MASK = 127;
|
|
23302
23302
|
var SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
@@ -23527,7 +23527,7 @@ var require_index_cjs = __commonJS({
|
|
|
23527
23527
|
const [payerAddress] = writableSigners[0];
|
|
23528
23528
|
assert(payerAddress === this.payer.toBase58(), "Expected first writable signer key to be the fee payer");
|
|
23529
23529
|
}
|
|
23530
|
-
const staticAccountKeys = [...writableSigners.map(([address]) => new
|
|
23530
|
+
const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey4(address)), ...readonlySigners.map(([address]) => new PublicKey4(address)), ...writableNonSigners.map(([address]) => new PublicKey4(address)), ...readonlyNonSigners.map(([address]) => new PublicKey4(address))];
|
|
23531
23531
|
return [header, staticAccountKeys];
|
|
23532
23532
|
}
|
|
23533
23533
|
extractTableLookup(lookupTable) {
|
|
@@ -23551,7 +23551,7 @@ var require_index_cjs = __commonJS({
|
|
|
23551
23551
|
const drainedKeys = new Array();
|
|
23552
23552
|
for (const [address, keyMeta] of this.keyMetaMap.entries()) {
|
|
23553
23553
|
if (keyMetaFilter(keyMeta)) {
|
|
23554
|
-
const key = new
|
|
23554
|
+
const key = new PublicKey4(address);
|
|
23555
23555
|
const lookupTableIndex = lookupTableEntries.findIndex((entry) => entry.equals(key));
|
|
23556
23556
|
if (lookupTableIndex >= 0) {
|
|
23557
23557
|
assert(lookupTableIndex < 256, "Max lookup table index exceeded");
|
|
@@ -23586,7 +23586,7 @@ var require_index_cjs = __commonJS({
|
|
|
23586
23586
|
this.instructions = void 0;
|
|
23587
23587
|
this.indexToProgramIds = /* @__PURE__ */ new Map();
|
|
23588
23588
|
this.header = args.header;
|
|
23589
|
-
this.accountKeys = args.accountKeys.map((account) => new
|
|
23589
|
+
this.accountKeys = args.accountKeys.map((account) => new PublicKey4(account));
|
|
23590
23590
|
this.recentBlockhash = args.recentBlockhash;
|
|
23591
23591
|
this.instructions = args.instructions;
|
|
23592
23592
|
this.instructions.forEach((ix) => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
@@ -23712,7 +23712,7 @@ var require_index_cjs = __commonJS({
|
|
|
23712
23712
|
let accountKeys = [];
|
|
23713
23713
|
for (let i = 0; i < accountCount; i++) {
|
|
23714
23714
|
const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
23715
|
-
accountKeys.push(new
|
|
23715
|
+
accountKeys.push(new PublicKey4(buffer.Buffer.from(account)));
|
|
23716
23716
|
}
|
|
23717
23717
|
const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
|
|
23718
23718
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -23936,7 +23936,7 @@ var require_index_cjs = __commonJS({
|
|
|
23936
23936
|
const staticAccountKeys = [];
|
|
23937
23937
|
const staticAccountKeysLength = decodeLength(byteArray);
|
|
23938
23938
|
for (let i = 0; i < staticAccountKeysLength; i++) {
|
|
23939
|
-
staticAccountKeys.push(new
|
|
23939
|
+
staticAccountKeys.push(new PublicKey4(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));
|
|
23940
23940
|
}
|
|
23941
23941
|
const recentBlockhash = bs58__default.default.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
23942
23942
|
const instructionCount = decodeLength(byteArray);
|
|
@@ -23956,7 +23956,7 @@ var require_index_cjs = __commonJS({
|
|
|
23956
23956
|
const addressTableLookupsCount = decodeLength(byteArray);
|
|
23957
23957
|
const addressTableLookups = [];
|
|
23958
23958
|
for (let i = 0; i < addressTableLookupsCount; i++) {
|
|
23959
|
-
const accountKey = new
|
|
23959
|
+
const accountKey = new PublicKey4(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
23960
23960
|
const writableIndexesLength = decodeLength(byteArray);
|
|
23961
23961
|
const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);
|
|
23962
23962
|
const readonlyIndexesLength = decodeLength(byteArray);
|
|
@@ -24005,7 +24005,7 @@ var require_index_cjs = __commonJS({
|
|
|
24005
24005
|
return TransactionStatus2;
|
|
24006
24006
|
})({});
|
|
24007
24007
|
var DEFAULT_SIGNATURE = buffer.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);
|
|
24008
|
-
var
|
|
24008
|
+
var TransactionInstruction4 = class {
|
|
24009
24009
|
constructor(opts) {
|
|
24010
24010
|
this.keys = void 0;
|
|
24011
24011
|
this.programId = void 0;
|
|
@@ -24035,7 +24035,7 @@ var require_index_cjs = __commonJS({
|
|
|
24035
24035
|
};
|
|
24036
24036
|
}
|
|
24037
24037
|
};
|
|
24038
|
-
var
|
|
24038
|
+
var Transaction3 = class _Transaction {
|
|
24039
24039
|
/**
|
|
24040
24040
|
* The first (payer) Transaction signature
|
|
24041
24041
|
*
|
|
@@ -24137,7 +24137,7 @@ var require_index_cjs = __commonJS({
|
|
|
24137
24137
|
} else if ("data" in item && "programId" in item && "keys" in item) {
|
|
24138
24138
|
this.instructions.push(item);
|
|
24139
24139
|
} else {
|
|
24140
|
-
this.instructions.push(new
|
|
24140
|
+
this.instructions.push(new TransactionInstruction4(item));
|
|
24141
24141
|
}
|
|
24142
24142
|
});
|
|
24143
24143
|
return this;
|
|
@@ -24196,7 +24196,7 @@ var require_index_cjs = __commonJS({
|
|
|
24196
24196
|
});
|
|
24197
24197
|
programIds.forEach((programId) => {
|
|
24198
24198
|
accountMetas.push({
|
|
24199
|
-
pubkey: new
|
|
24199
|
+
pubkey: new PublicKey4(programId),
|
|
24200
24200
|
isSigner: false,
|
|
24201
24201
|
isWritable: false
|
|
24202
24202
|
});
|
|
@@ -24630,7 +24630,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
24630
24630
|
isWritable: message.isAccountWritable(account)
|
|
24631
24631
|
};
|
|
24632
24632
|
});
|
|
24633
|
-
transaction.instructions.push(new
|
|
24633
|
+
transaction.instructions.push(new TransactionInstruction4({
|
|
24634
24634
|
keys,
|
|
24635
24635
|
programId: message.accountKeys[instruction.programIdIndex],
|
|
24636
24636
|
data: bs58__default.default.decode(instruction.data)
|
|
@@ -24698,7 +24698,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
24698
24698
|
if (programId === void 0) {
|
|
24699
24699
|
throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
|
|
24700
24700
|
}
|
|
24701
|
-
instructions.push(new
|
|
24701
|
+
instructions.push(new TransactionInstruction4({
|
|
24702
24702
|
programId,
|
|
24703
24703
|
data: toBuffer(compiledIx.data),
|
|
24704
24704
|
keys
|
|
@@ -24789,15 +24789,15 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
|
|
|
24789
24789
|
var DEFAULT_TICKS_PER_SLOT = 64;
|
|
24790
24790
|
var NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
|
|
24791
24791
|
var MS_PER_SLOT = 1e3 / NUM_SLOTS_PER_SECOND;
|
|
24792
|
-
var SYSVAR_CLOCK_PUBKEY = new
|
|
24793
|
-
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new
|
|
24794
|
-
var SYSVAR_INSTRUCTIONS_PUBKEY = new
|
|
24795
|
-
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new
|
|
24796
|
-
var SYSVAR_RENT_PUBKEY = new
|
|
24797
|
-
var SYSVAR_REWARDS_PUBKEY = new
|
|
24798
|
-
var SYSVAR_SLOT_HASHES_PUBKEY = new
|
|
24799
|
-
var SYSVAR_SLOT_HISTORY_PUBKEY = new
|
|
24800
|
-
var SYSVAR_STAKE_HISTORY_PUBKEY = new
|
|
24792
|
+
var SYSVAR_CLOCK_PUBKEY = new PublicKey4("SysvarC1ock11111111111111111111111111111111");
|
|
24793
|
+
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey4("SysvarEpochSchedu1e111111111111111111111111");
|
|
24794
|
+
var SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey4("Sysvar1nstructions1111111111111111111111111");
|
|
24795
|
+
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey4("SysvarRecentB1ockHashes11111111111111111111");
|
|
24796
|
+
var SYSVAR_RENT_PUBKEY = new PublicKey4("SysvarRent111111111111111111111111111111111");
|
|
24797
|
+
var SYSVAR_REWARDS_PUBKEY = new PublicKey4("SysvarRewards111111111111111111111111111111");
|
|
24798
|
+
var SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey4("SysvarS1otHashes111111111111111111111111111");
|
|
24799
|
+
var SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey4("SysvarS1otHistory11111111111111111111111111");
|
|
24800
|
+
var SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey4("SysvarStakeHistory1111111111111111111111111");
|
|
24801
24801
|
var SendTransactionError = class extends Error {
|
|
24802
24802
|
constructor({
|
|
24803
24803
|
action,
|
|
@@ -24988,8 +24988,8 @@ Message: ${transactionMessage}.
|
|
|
24988
24988
|
static fromAccountData(buffer2) {
|
|
24989
24989
|
const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer2), 0);
|
|
24990
24990
|
return new _NonceAccount({
|
|
24991
|
-
authorizedPubkey: new
|
|
24992
|
-
nonce: new
|
|
24991
|
+
authorizedPubkey: new PublicKey4(nonceAccount.authorizedPubkey),
|
|
24992
|
+
nonce: new PublicKey4(nonceAccount.nonce).toString(),
|
|
24993
24993
|
feeCalculator: nonceAccount.feeCalculator
|
|
24994
24994
|
});
|
|
24995
24995
|
}
|
|
@@ -25051,7 +25051,7 @@ Message: ${transactionMessage}.
|
|
|
25051
25051
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
25052
25052
|
lamports,
|
|
25053
25053
|
space,
|
|
25054
|
-
programId: new
|
|
25054
|
+
programId: new PublicKey4(programId)
|
|
25055
25055
|
};
|
|
25056
25056
|
}
|
|
25057
25057
|
/**
|
|
@@ -25086,7 +25086,7 @@ Message: ${transactionMessage}.
|
|
|
25086
25086
|
toPubkey: instruction.keys[2].pubkey,
|
|
25087
25087
|
lamports,
|
|
25088
25088
|
seed,
|
|
25089
|
-
programId: new
|
|
25089
|
+
programId: new PublicKey4(programId)
|
|
25090
25090
|
};
|
|
25091
25091
|
}
|
|
25092
25092
|
/**
|
|
@@ -25117,10 +25117,10 @@ Message: ${transactionMessage}.
|
|
|
25117
25117
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);
|
|
25118
25118
|
return {
|
|
25119
25119
|
accountPubkey: instruction.keys[0].pubkey,
|
|
25120
|
-
basePubkey: new
|
|
25120
|
+
basePubkey: new PublicKey4(base),
|
|
25121
25121
|
seed,
|
|
25122
25122
|
space,
|
|
25123
|
-
programId: new
|
|
25123
|
+
programId: new PublicKey4(programId)
|
|
25124
25124
|
};
|
|
25125
25125
|
}
|
|
25126
25126
|
/**
|
|
@@ -25134,7 +25134,7 @@ Message: ${transactionMessage}.
|
|
|
25134
25134
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);
|
|
25135
25135
|
return {
|
|
25136
25136
|
accountPubkey: instruction.keys[0].pubkey,
|
|
25137
|
-
programId: new
|
|
25137
|
+
programId: new PublicKey4(programId)
|
|
25138
25138
|
};
|
|
25139
25139
|
}
|
|
25140
25140
|
/**
|
|
@@ -25150,9 +25150,9 @@ Message: ${transactionMessage}.
|
|
|
25150
25150
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);
|
|
25151
25151
|
return {
|
|
25152
25152
|
accountPubkey: instruction.keys[0].pubkey,
|
|
25153
|
-
basePubkey: new
|
|
25153
|
+
basePubkey: new PublicKey4(base),
|
|
25154
25154
|
seed,
|
|
25155
|
-
programId: new
|
|
25155
|
+
programId: new PublicKey4(programId)
|
|
25156
25156
|
};
|
|
25157
25157
|
}
|
|
25158
25158
|
/**
|
|
@@ -25171,11 +25171,11 @@ Message: ${transactionMessage}.
|
|
|
25171
25171
|
return {
|
|
25172
25172
|
fromPubkey: instruction.keys[0].pubkey,
|
|
25173
25173
|
newAccountPubkey: instruction.keys[1].pubkey,
|
|
25174
|
-
basePubkey: new
|
|
25174
|
+
basePubkey: new PublicKey4(base),
|
|
25175
25175
|
seed,
|
|
25176
25176
|
lamports,
|
|
25177
25177
|
space,
|
|
25178
|
-
programId: new
|
|
25178
|
+
programId: new PublicKey4(programId)
|
|
25179
25179
|
};
|
|
25180
25180
|
}
|
|
25181
25181
|
/**
|
|
@@ -25189,7 +25189,7 @@ Message: ${transactionMessage}.
|
|
|
25189
25189
|
} = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);
|
|
25190
25190
|
return {
|
|
25191
25191
|
noncePubkey: instruction.keys[0].pubkey,
|
|
25192
|
-
authorizedPubkey: new
|
|
25192
|
+
authorizedPubkey: new PublicKey4(authorized2)
|
|
25193
25193
|
};
|
|
25194
25194
|
}
|
|
25195
25195
|
/**
|
|
@@ -25232,14 +25232,14 @@ Message: ${transactionMessage}.
|
|
|
25232
25232
|
return {
|
|
25233
25233
|
noncePubkey: instruction.keys[0].pubkey,
|
|
25234
25234
|
authorizedPubkey: instruction.keys[1].pubkey,
|
|
25235
|
-
newAuthorizedPubkey: new
|
|
25235
|
+
newAuthorizedPubkey: new PublicKey4(authorized2)
|
|
25236
25236
|
};
|
|
25237
25237
|
}
|
|
25238
25238
|
/**
|
|
25239
25239
|
* @internal
|
|
25240
25240
|
*/
|
|
25241
25241
|
static checkProgramId(programId) {
|
|
25242
|
-
if (!programId.equals(
|
|
25242
|
+
if (!programId.equals(SystemProgram2.programId)) {
|
|
25243
25243
|
throw new Error("invalid instruction; programId is not SystemProgram");
|
|
25244
25244
|
}
|
|
25245
25245
|
}
|
|
@@ -25306,7 +25306,7 @@ Message: ${transactionMessage}.
|
|
|
25306
25306
|
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32("instruction")])
|
|
25307
25307
|
}
|
|
25308
25308
|
});
|
|
25309
|
-
var
|
|
25309
|
+
var SystemProgram2 = class _SystemProgram {
|
|
25310
25310
|
/**
|
|
25311
25311
|
* @internal
|
|
25312
25312
|
*/
|
|
@@ -25325,7 +25325,7 @@ Message: ${transactionMessage}.
|
|
|
25325
25325
|
space: params.space,
|
|
25326
25326
|
programId: toBuffer(params.programId.toBuffer())
|
|
25327
25327
|
});
|
|
25328
|
-
return new
|
|
25328
|
+
return new TransactionInstruction4({
|
|
25329
25329
|
keys: [{
|
|
25330
25330
|
pubkey: params.fromPubkey,
|
|
25331
25331
|
isSigner: true,
|
|
@@ -25380,7 +25380,7 @@ Message: ${transactionMessage}.
|
|
|
25380
25380
|
isWritable: true
|
|
25381
25381
|
}];
|
|
25382
25382
|
}
|
|
25383
|
-
return new
|
|
25383
|
+
return new TransactionInstruction4({
|
|
25384
25384
|
keys,
|
|
25385
25385
|
programId: this.programId,
|
|
25386
25386
|
data
|
|
@@ -25419,7 +25419,7 @@ Message: ${transactionMessage}.
|
|
|
25419
25419
|
isWritable: true
|
|
25420
25420
|
}];
|
|
25421
25421
|
}
|
|
25422
|
-
return new
|
|
25422
|
+
return new TransactionInstruction4({
|
|
25423
25423
|
keys,
|
|
25424
25424
|
programId: this.programId,
|
|
25425
25425
|
data
|
|
@@ -25454,7 +25454,7 @@ Message: ${transactionMessage}.
|
|
|
25454
25454
|
isWritable: false
|
|
25455
25455
|
});
|
|
25456
25456
|
}
|
|
25457
|
-
return new
|
|
25457
|
+
return new TransactionInstruction4({
|
|
25458
25458
|
keys,
|
|
25459
25459
|
programId: this.programId,
|
|
25460
25460
|
data
|
|
@@ -25464,7 +25464,7 @@ Message: ${transactionMessage}.
|
|
|
25464
25464
|
* Generate a transaction that creates a new Nonce account
|
|
25465
25465
|
*/
|
|
25466
25466
|
static createNonceAccount(params) {
|
|
25467
|
-
const transaction = new
|
|
25467
|
+
const transaction = new Transaction3();
|
|
25468
25468
|
if ("basePubkey" in params && "seed" in params) {
|
|
25469
25469
|
transaction.add(_SystemProgram.createAccountWithSeed({
|
|
25470
25470
|
fromPubkey: params.fromPubkey,
|
|
@@ -25516,7 +25516,7 @@ Message: ${transactionMessage}.
|
|
|
25516
25516
|
programId: this.programId,
|
|
25517
25517
|
data
|
|
25518
25518
|
};
|
|
25519
|
-
return new
|
|
25519
|
+
return new TransactionInstruction4(instructionData);
|
|
25520
25520
|
}
|
|
25521
25521
|
/**
|
|
25522
25522
|
* Generate an instruction to advance the nonce in a Nonce account
|
|
@@ -25541,7 +25541,7 @@ Message: ${transactionMessage}.
|
|
|
25541
25541
|
programId: this.programId,
|
|
25542
25542
|
data
|
|
25543
25543
|
};
|
|
25544
|
-
return new
|
|
25544
|
+
return new TransactionInstruction4(instructionData);
|
|
25545
25545
|
}
|
|
25546
25546
|
/**
|
|
25547
25547
|
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
@@ -25551,7 +25551,7 @@ Message: ${transactionMessage}.
|
|
|
25551
25551
|
const data = encodeData(type, {
|
|
25552
25552
|
lamports: params.lamports
|
|
25553
25553
|
});
|
|
25554
|
-
return new
|
|
25554
|
+
return new TransactionInstruction4({
|
|
25555
25555
|
keys: [{
|
|
25556
25556
|
pubkey: params.noncePubkey,
|
|
25557
25557
|
isSigner: false,
|
|
@@ -25586,7 +25586,7 @@ Message: ${transactionMessage}.
|
|
|
25586
25586
|
const data = encodeData(type, {
|
|
25587
25587
|
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())
|
|
25588
25588
|
});
|
|
25589
|
-
return new
|
|
25589
|
+
return new TransactionInstruction4({
|
|
25590
25590
|
keys: [{
|
|
25591
25591
|
pubkey: params.noncePubkey,
|
|
25592
25592
|
isSigner: false,
|
|
@@ -25634,14 +25634,14 @@ Message: ${transactionMessage}.
|
|
|
25634
25634
|
isWritable: true
|
|
25635
25635
|
}];
|
|
25636
25636
|
}
|
|
25637
|
-
return new
|
|
25637
|
+
return new TransactionInstruction4({
|
|
25638
25638
|
keys,
|
|
25639
25639
|
programId: this.programId,
|
|
25640
25640
|
data
|
|
25641
25641
|
});
|
|
25642
25642
|
}
|
|
25643
25643
|
};
|
|
25644
|
-
|
|
25644
|
+
SystemProgram2.programId = new PublicKey4("11111111111111111111111111111111");
|
|
25645
25645
|
var CHUNK_SIZE = PACKET_DATA_SIZE - 300;
|
|
25646
25646
|
var Loader = class _Loader {
|
|
25647
25647
|
/**
|
|
@@ -25684,29 +25684,29 @@ Message: ${transactionMessage}.
|
|
|
25684
25684
|
return false;
|
|
25685
25685
|
}
|
|
25686
25686
|
if (programInfo.data.length !== data.length) {
|
|
25687
|
-
transaction = transaction || new
|
|
25688
|
-
transaction.add(
|
|
25687
|
+
transaction = transaction || new Transaction3();
|
|
25688
|
+
transaction.add(SystemProgram2.allocate({
|
|
25689
25689
|
accountPubkey: program.publicKey,
|
|
25690
25690
|
space: data.length
|
|
25691
25691
|
}));
|
|
25692
25692
|
}
|
|
25693
25693
|
if (!programInfo.owner.equals(programId)) {
|
|
25694
|
-
transaction = transaction || new
|
|
25695
|
-
transaction.add(
|
|
25694
|
+
transaction = transaction || new Transaction3();
|
|
25695
|
+
transaction.add(SystemProgram2.assign({
|
|
25696
25696
|
accountPubkey: program.publicKey,
|
|
25697
25697
|
programId
|
|
25698
25698
|
}));
|
|
25699
25699
|
}
|
|
25700
25700
|
if (programInfo.lamports < balanceNeeded) {
|
|
25701
|
-
transaction = transaction || new
|
|
25702
|
-
transaction.add(
|
|
25701
|
+
transaction = transaction || new Transaction3();
|
|
25702
|
+
transaction.add(SystemProgram2.transfer({
|
|
25703
25703
|
fromPubkey: payer.publicKey,
|
|
25704
25704
|
toPubkey: program.publicKey,
|
|
25705
25705
|
lamports: balanceNeeded - programInfo.lamports
|
|
25706
25706
|
}));
|
|
25707
25707
|
}
|
|
25708
25708
|
} else {
|
|
25709
|
-
transaction = new
|
|
25709
|
+
transaction = new Transaction3().add(SystemProgram2.createAccount({
|
|
25710
25710
|
fromPubkey: payer.publicKey,
|
|
25711
25711
|
newAccountPubkey: program.publicKey,
|
|
25712
25712
|
lamports: balanceNeeded > 0 ? balanceNeeded : 1,
|
|
@@ -25736,7 +25736,7 @@ Message: ${transactionMessage}.
|
|
|
25736
25736
|
bytesLength: 0,
|
|
25737
25737
|
bytesLengthPadding: 0
|
|
25738
25738
|
}, data2);
|
|
25739
|
-
const transaction = new
|
|
25739
|
+
const transaction = new Transaction3().add({
|
|
25740
25740
|
keys: [{
|
|
25741
25741
|
pubkey: program.publicKey,
|
|
25742
25742
|
isSigner: true,
|
|
@@ -25763,7 +25763,7 @@ Message: ${transactionMessage}.
|
|
|
25763
25763
|
instruction: 1
|
|
25764
25764
|
// Finalize instruction
|
|
25765
25765
|
}, data2);
|
|
25766
|
-
const transaction = new
|
|
25766
|
+
const transaction = new Transaction3().add({
|
|
25767
25767
|
keys: [{
|
|
25768
25768
|
pubkey: program.publicKey,
|
|
25769
25769
|
isSigner: true,
|
|
@@ -25808,7 +25808,7 @@ Message: ${transactionMessage}.
|
|
|
25808
25808
|
}
|
|
25809
25809
|
};
|
|
25810
25810
|
Loader.chunkSize = CHUNK_SIZE;
|
|
25811
|
-
var BPF_LOADER_PROGRAM_ID = new
|
|
25811
|
+
var BPF_LOADER_PROGRAM_ID = new PublicKey4("BPFLoader2111111111111111111111111111111111");
|
|
25812
25812
|
var BpfLoader = class {
|
|
25813
25813
|
/**
|
|
25814
25814
|
* Minimum number of signatures required to load a program not including
|
|
@@ -26604,8 +26604,8 @@ Message: ${transactionMessage}.
|
|
|
26604
26604
|
deactivationSlot: meta.deactivationSlot,
|
|
26605
26605
|
lastExtendedSlot: meta.lastExtendedSlot,
|
|
26606
26606
|
lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,
|
|
26607
|
-
authority: meta.authority.length !== 0 ? new
|
|
26608
|
-
addresses: addresses.map((address) => new
|
|
26607
|
+
authority: meta.authority.length !== 0 ? new PublicKey4(meta.authority[0]) : void 0,
|
|
26608
|
+
addresses: addresses.map((address) => new PublicKey4(address))
|
|
26609
26609
|
};
|
|
26610
26610
|
}
|
|
26611
26611
|
};
|
|
@@ -26647,7 +26647,7 @@ Message: ${transactionMessage}.
|
|
|
26647
26647
|
);
|
|
26648
26648
|
return `${protocol}//${hostish}${websocketPort}${rest}`;
|
|
26649
26649
|
}
|
|
26650
|
-
var PublicKeyFromString = superstruct.coerce(superstruct.instance(
|
|
26650
|
+
var PublicKeyFromString = superstruct.coerce(superstruct.instance(PublicKey4), superstruct.string(), (value) => new PublicKey4(value));
|
|
26651
26651
|
var RawAccountDataResult = superstruct.tuple([superstruct.string(), superstruct.literal("base64")]);
|
|
26652
26652
|
var BufferFromRawAccountData = superstruct.coerce(superstruct.instance(buffer.Buffer), RawAccountDataResult, (value) => buffer.Buffer.from(value[0], "base64"));
|
|
26653
26653
|
var BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1e3;
|
|
@@ -26732,7 +26732,7 @@ Message: ${transactionMessage}.
|
|
|
26732
26732
|
if (version3 === 0) {
|
|
26733
26733
|
return new MessageV0({
|
|
26734
26734
|
header: response.header,
|
|
26735
|
-
staticAccountKeys: response.accountKeys.map((accountKey) => new
|
|
26735
|
+
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey4(accountKey)),
|
|
26736
26736
|
recentBlockhash: response.recentBlockhash,
|
|
26737
26737
|
compiledInstructions: response.instructions.map((ix) => ({
|
|
26738
26738
|
programIdIndex: ix.programIdIndex,
|
|
@@ -28922,7 +28922,7 @@ Message: ${transactionMessage}.
|
|
|
28922
28922
|
}) => {
|
|
28923
28923
|
return {
|
|
28924
28924
|
meta,
|
|
28925
|
-
transaction:
|
|
28925
|
+
transaction: Transaction3.populate(transaction.message, transaction.signatures)
|
|
28926
28926
|
};
|
|
28927
28927
|
})
|
|
28928
28928
|
};
|
|
@@ -28997,7 +28997,7 @@ Message: ${transactionMessage}.
|
|
|
28997
28997
|
const signatures = result.transaction.signatures;
|
|
28998
28998
|
return {
|
|
28999
28999
|
...result,
|
|
29000
|
-
transaction:
|
|
29000
|
+
transaction: Transaction3.populate(message, signatures)
|
|
29001
29001
|
};
|
|
29002
29002
|
}
|
|
29003
29003
|
/**
|
|
@@ -29284,15 +29284,15 @@ Message: ${transactionMessage}.
|
|
|
29284
29284
|
return res2.result;
|
|
29285
29285
|
}
|
|
29286
29286
|
let transaction;
|
|
29287
|
-
if (transactionOrMessage instanceof
|
|
29287
|
+
if (transactionOrMessage instanceof Transaction3) {
|
|
29288
29288
|
let originalTx = transactionOrMessage;
|
|
29289
|
-
transaction = new
|
|
29289
|
+
transaction = new Transaction3();
|
|
29290
29290
|
transaction.feePayer = originalTx.feePayer;
|
|
29291
29291
|
transaction.instructions = transactionOrMessage.instructions;
|
|
29292
29292
|
transaction.nonceInfo = originalTx.nonceInfo;
|
|
29293
29293
|
transaction.signatures = originalTx.signatures;
|
|
29294
29294
|
} else {
|
|
29295
|
-
transaction =
|
|
29295
|
+
transaction = Transaction3.populate(transactionOrMessage);
|
|
29296
29296
|
transaction._message = transaction._json = void 0;
|
|
29297
29297
|
}
|
|
29298
29298
|
if (configOrSigners !== void 0 && !Array.isArray(configOrSigners)) {
|
|
@@ -30172,7 +30172,7 @@ Message: ${transactionMessage}.
|
|
|
30172
30172
|
* @returns {PublicKey} PublicKey
|
|
30173
30173
|
*/
|
|
30174
30174
|
get publicKey() {
|
|
30175
|
-
return new
|
|
30175
|
+
return new PublicKey4(this._keypair.publicKey);
|
|
30176
30176
|
}
|
|
30177
30177
|
/**
|
|
30178
30178
|
* The raw secret key for this keypair
|
|
@@ -30250,7 +30250,7 @@ Message: ${transactionMessage}.
|
|
|
30250
30250
|
lookupTable: instruction.keys[0].pubkey,
|
|
30251
30251
|
authority: instruction.keys[1].pubkey,
|
|
30252
30252
|
payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : void 0,
|
|
30253
|
-
addresses: addresses.map((buffer2) => new
|
|
30253
|
+
addresses: addresses.map((buffer2) => new PublicKey4(buffer2))
|
|
30254
30254
|
};
|
|
30255
30255
|
}
|
|
30256
30256
|
static decodeCloseLookupTable(instruction) {
|
|
@@ -30302,7 +30302,7 @@ Message: ${transactionMessage}.
|
|
|
30302
30302
|
constructor() {
|
|
30303
30303
|
}
|
|
30304
30304
|
static createLookupTable(params) {
|
|
30305
|
-
const [lookupTableAddress, bumpSeed] =
|
|
30305
|
+
const [lookupTableAddress, bumpSeed] = PublicKey4.findProgramAddressSync([params.authority.toBuffer(), codecsNumbers.getU64Encoder().encode(params.recentSlot)], this.programId);
|
|
30306
30306
|
const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;
|
|
30307
30307
|
const data = encodeData(type, {
|
|
30308
30308
|
recentSlot: BigInt(params.recentSlot),
|
|
@@ -30321,11 +30321,11 @@ Message: ${transactionMessage}.
|
|
|
30321
30321
|
isSigner: true,
|
|
30322
30322
|
isWritable: true
|
|
30323
30323
|
}, {
|
|
30324
|
-
pubkey:
|
|
30324
|
+
pubkey: SystemProgram2.programId,
|
|
30325
30325
|
isSigner: false,
|
|
30326
30326
|
isWritable: false
|
|
30327
30327
|
}];
|
|
30328
|
-
return [new
|
|
30328
|
+
return [new TransactionInstruction4({
|
|
30329
30329
|
programId: this.programId,
|
|
30330
30330
|
keys,
|
|
30331
30331
|
data
|
|
@@ -30343,7 +30343,7 @@ Message: ${transactionMessage}.
|
|
|
30343
30343
|
isSigner: true,
|
|
30344
30344
|
isWritable: false
|
|
30345
30345
|
}];
|
|
30346
|
-
return new
|
|
30346
|
+
return new TransactionInstruction4({
|
|
30347
30347
|
programId: this.programId,
|
|
30348
30348
|
keys,
|
|
30349
30349
|
data
|
|
@@ -30369,12 +30369,12 @@ Message: ${transactionMessage}.
|
|
|
30369
30369
|
isSigner: true,
|
|
30370
30370
|
isWritable: true
|
|
30371
30371
|
}, {
|
|
30372
|
-
pubkey:
|
|
30372
|
+
pubkey: SystemProgram2.programId,
|
|
30373
30373
|
isSigner: false,
|
|
30374
30374
|
isWritable: false
|
|
30375
30375
|
});
|
|
30376
30376
|
}
|
|
30377
|
-
return new
|
|
30377
|
+
return new TransactionInstruction4({
|
|
30378
30378
|
programId: this.programId,
|
|
30379
30379
|
keys,
|
|
30380
30380
|
data
|
|
@@ -30392,7 +30392,7 @@ Message: ${transactionMessage}.
|
|
|
30392
30392
|
isSigner: true,
|
|
30393
30393
|
isWritable: false
|
|
30394
30394
|
}];
|
|
30395
|
-
return new
|
|
30395
|
+
return new TransactionInstruction4({
|
|
30396
30396
|
programId: this.programId,
|
|
30397
30397
|
keys,
|
|
30398
30398
|
data
|
|
@@ -30414,14 +30414,14 @@ Message: ${transactionMessage}.
|
|
|
30414
30414
|
isSigner: false,
|
|
30415
30415
|
isWritable: true
|
|
30416
30416
|
}];
|
|
30417
|
-
return new
|
|
30417
|
+
return new TransactionInstruction4({
|
|
30418
30418
|
programId: this.programId,
|
|
30419
30419
|
keys,
|
|
30420
30420
|
data
|
|
30421
30421
|
});
|
|
30422
30422
|
}
|
|
30423
30423
|
};
|
|
30424
|
-
AddressLookupTableProgram.programId = new
|
|
30424
|
+
AddressLookupTableProgram.programId = new PublicKey4("AddressLookupTab1e1111111111111111111111111");
|
|
30425
30425
|
var ComputeBudgetInstruction = class {
|
|
30426
30426
|
/**
|
|
30427
30427
|
* @internal
|
|
@@ -30539,7 +30539,7 @@ Message: ${transactionMessage}.
|
|
|
30539
30539
|
static requestUnits(params) {
|
|
30540
30540
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;
|
|
30541
30541
|
const data = encodeData(type, params);
|
|
30542
|
-
return new
|
|
30542
|
+
return new TransactionInstruction4({
|
|
30543
30543
|
keys: [],
|
|
30544
30544
|
programId: this.programId,
|
|
30545
30545
|
data
|
|
@@ -30548,7 +30548,7 @@ Message: ${transactionMessage}.
|
|
|
30548
30548
|
static requestHeapFrame(params) {
|
|
30549
30549
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;
|
|
30550
30550
|
const data = encodeData(type, params);
|
|
30551
|
-
return new
|
|
30551
|
+
return new TransactionInstruction4({
|
|
30552
30552
|
keys: [],
|
|
30553
30553
|
programId: this.programId,
|
|
30554
30554
|
data
|
|
@@ -30557,7 +30557,7 @@ Message: ${transactionMessage}.
|
|
|
30557
30557
|
static setComputeUnitLimit(params) {
|
|
30558
30558
|
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
30559
30559
|
const data = encodeData(type, params);
|
|
30560
|
-
return new
|
|
30560
|
+
return new TransactionInstruction4({
|
|
30561
30561
|
keys: [],
|
|
30562
30562
|
programId: this.programId,
|
|
30563
30563
|
data
|
|
@@ -30568,14 +30568,14 @@ Message: ${transactionMessage}.
|
|
|
30568
30568
|
const data = encodeData(type, {
|
|
30569
30569
|
microLamports: BigInt(params.microLamports)
|
|
30570
30570
|
});
|
|
30571
|
-
return new
|
|
30571
|
+
return new TransactionInstruction4({
|
|
30572
30572
|
keys: [],
|
|
30573
30573
|
programId: this.programId,
|
|
30574
30574
|
data
|
|
30575
30575
|
});
|
|
30576
30576
|
}
|
|
30577
30577
|
};
|
|
30578
|
-
ComputeBudgetProgram.programId = new
|
|
30578
|
+
ComputeBudgetProgram.programId = new PublicKey4("ComputeBudget111111111111111111111111111111");
|
|
30579
30579
|
var PRIVATE_KEY_BYTES$1 = 64;
|
|
30580
30580
|
var PUBLIC_KEY_BYTES$1 = 32;
|
|
30581
30581
|
var SIGNATURE_BYTES = 64;
|
|
@@ -30623,7 +30623,7 @@ Message: ${transactionMessage}.
|
|
|
30623
30623
|
instructionData.fill(publicKey2, publicKeyOffset);
|
|
30624
30624
|
instructionData.fill(signature2, signatureOffset);
|
|
30625
30625
|
instructionData.fill(message, messageDataOffset);
|
|
30626
|
-
return new
|
|
30626
|
+
return new TransactionInstruction4({
|
|
30627
30627
|
keys: [],
|
|
30628
30628
|
programId: _Ed25519Program.programId,
|
|
30629
30629
|
data: instructionData
|
|
@@ -30655,7 +30655,7 @@ Message: ${transactionMessage}.
|
|
|
30655
30655
|
}
|
|
30656
30656
|
}
|
|
30657
30657
|
};
|
|
30658
|
-
Ed25519Program.programId = new
|
|
30658
|
+
Ed25519Program.programId = new PublicKey4("Ed25519SigVerify111111111111111111111111111");
|
|
30659
30659
|
var ecdsaSign = (msgHash, privKey) => {
|
|
30660
30660
|
const signature2 = secp256k1.secp256k1.sign(msgHash, privKey);
|
|
30661
30661
|
return [signature2.toCompactRawBytes(), signature2.recovery];
|
|
@@ -30751,7 +30751,7 @@ Message: ${transactionMessage}.
|
|
|
30751
30751
|
recoveryId
|
|
30752
30752
|
}, instructionData);
|
|
30753
30753
|
instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
|
|
30754
|
-
return new
|
|
30754
|
+
return new TransactionInstruction4({
|
|
30755
30755
|
keys: [],
|
|
30756
30756
|
programId: _Secp256k1Program.programId,
|
|
30757
30757
|
data: instructionData
|
|
@@ -30789,9 +30789,9 @@ Message: ${transactionMessage}.
|
|
|
30789
30789
|
}
|
|
30790
30790
|
}
|
|
30791
30791
|
};
|
|
30792
|
-
Secp256k1Program.programId = new
|
|
30792
|
+
Secp256k1Program.programId = new PublicKey4("KeccakSecp256k11111111111111111111111111111");
|
|
30793
30793
|
var _Lockup;
|
|
30794
|
-
var STAKE_CONFIG_ID = new
|
|
30794
|
+
var STAKE_CONFIG_ID = new PublicKey4("StakeConfig11111111111111111111111111111111");
|
|
30795
30795
|
var Authorized = class {
|
|
30796
30796
|
/**
|
|
30797
30797
|
* Create a new Authorized object
|
|
@@ -30822,7 +30822,7 @@ Message: ${transactionMessage}.
|
|
|
30822
30822
|
*/
|
|
30823
30823
|
};
|
|
30824
30824
|
_Lockup = Lockup;
|
|
30825
|
-
Lockup.default = new _Lockup(0, 0,
|
|
30825
|
+
Lockup.default = new _Lockup(0, 0, PublicKey4.default);
|
|
30826
30826
|
var StakeInstruction = class {
|
|
30827
30827
|
/**
|
|
30828
30828
|
* @internal
|
|
@@ -30860,8 +30860,8 @@ Message: ${transactionMessage}.
|
|
|
30860
30860
|
} = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);
|
|
30861
30861
|
return {
|
|
30862
30862
|
stakePubkey: instruction.keys[0].pubkey,
|
|
30863
|
-
authorized: new Authorized(new
|
|
30864
|
-
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new
|
|
30863
|
+
authorized: new Authorized(new PublicKey4(authorized2.staker), new PublicKey4(authorized2.withdrawer)),
|
|
30864
|
+
lockup: new Lockup(lockup2.unixTimestamp, lockup2.epoch, new PublicKey4(lockup2.custodian))
|
|
30865
30865
|
};
|
|
30866
30866
|
}
|
|
30867
30867
|
/**
|
|
@@ -30890,7 +30890,7 @@ Message: ${transactionMessage}.
|
|
|
30890
30890
|
const o = {
|
|
30891
30891
|
stakePubkey: instruction.keys[0].pubkey,
|
|
30892
30892
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
30893
|
-
newAuthorizedPubkey: new
|
|
30893
|
+
newAuthorizedPubkey: new PublicKey4(newAuthorized),
|
|
30894
30894
|
stakeAuthorizationType: {
|
|
30895
30895
|
index: stakeAuthorizationType
|
|
30896
30896
|
}
|
|
@@ -30916,8 +30916,8 @@ Message: ${transactionMessage}.
|
|
|
30916
30916
|
stakePubkey: instruction.keys[0].pubkey,
|
|
30917
30917
|
authorityBase: instruction.keys[1].pubkey,
|
|
30918
30918
|
authoritySeed,
|
|
30919
|
-
authorityOwner: new
|
|
30920
|
-
newAuthorizedPubkey: new
|
|
30919
|
+
authorityOwner: new PublicKey4(authorityOwner),
|
|
30920
|
+
newAuthorizedPubkey: new PublicKey4(newAuthorized),
|
|
30921
30921
|
stakeAuthorizationType: {
|
|
30922
30922
|
index: stakeAuthorizationType
|
|
30923
30923
|
}
|
|
@@ -31091,15 +31091,15 @@ Message: ${transactionMessage}.
|
|
|
31091
31091
|
programId: this.programId,
|
|
31092
31092
|
data
|
|
31093
31093
|
};
|
|
31094
|
-
return new
|
|
31094
|
+
return new TransactionInstruction4(instructionData);
|
|
31095
31095
|
}
|
|
31096
31096
|
/**
|
|
31097
31097
|
* Generate a Transaction that creates a new Stake account at
|
|
31098
31098
|
* an address generated with `from`, a seed, and the Stake programId
|
|
31099
31099
|
*/
|
|
31100
31100
|
static createAccountWithSeed(params) {
|
|
31101
|
-
const transaction = new
|
|
31102
|
-
transaction.add(
|
|
31101
|
+
const transaction = new Transaction3();
|
|
31102
|
+
transaction.add(SystemProgram2.createAccountWithSeed({
|
|
31103
31103
|
fromPubkey: params.fromPubkey,
|
|
31104
31104
|
newAccountPubkey: params.stakePubkey,
|
|
31105
31105
|
basePubkey: params.basePubkey,
|
|
@@ -31123,8 +31123,8 @@ Message: ${transactionMessage}.
|
|
|
31123
31123
|
* Generate a Transaction that creates a new Stake account
|
|
31124
31124
|
*/
|
|
31125
31125
|
static createAccount(params) {
|
|
31126
|
-
const transaction = new
|
|
31127
|
-
transaction.add(
|
|
31126
|
+
const transaction = new Transaction3();
|
|
31127
|
+
transaction.add(SystemProgram2.createAccount({
|
|
31128
31128
|
fromPubkey: params.fromPubkey,
|
|
31129
31129
|
newAccountPubkey: params.stakePubkey,
|
|
31130
31130
|
lamports: params.lamports,
|
|
@@ -31155,7 +31155,7 @@ Message: ${transactionMessage}.
|
|
|
31155
31155
|
} = params;
|
|
31156
31156
|
const type = STAKE_INSTRUCTION_LAYOUTS.Delegate;
|
|
31157
31157
|
const data = encodeData(type);
|
|
31158
|
-
return new
|
|
31158
|
+
return new Transaction3().add({
|
|
31159
31159
|
keys: [{
|
|
31160
31160
|
pubkey: stakePubkey,
|
|
31161
31161
|
isSigner: false,
|
|
@@ -31222,7 +31222,7 @@ Message: ${transactionMessage}.
|
|
|
31222
31222
|
isWritable: false
|
|
31223
31223
|
});
|
|
31224
31224
|
}
|
|
31225
|
-
return new
|
|
31225
|
+
return new Transaction3().add({
|
|
31226
31226
|
keys,
|
|
31227
31227
|
programId: this.programId,
|
|
31228
31228
|
data
|
|
@@ -31269,7 +31269,7 @@ Message: ${transactionMessage}.
|
|
|
31269
31269
|
isWritable: false
|
|
31270
31270
|
});
|
|
31271
31271
|
}
|
|
31272
|
-
return new
|
|
31272
|
+
return new Transaction3().add({
|
|
31273
31273
|
keys,
|
|
31274
31274
|
programId: this.programId,
|
|
31275
31275
|
data
|
|
@@ -31289,7 +31289,7 @@ Message: ${transactionMessage}.
|
|
|
31289
31289
|
const data = encodeData(type, {
|
|
31290
31290
|
lamports
|
|
31291
31291
|
});
|
|
31292
|
-
return new
|
|
31292
|
+
return new TransactionInstruction4({
|
|
31293
31293
|
keys: [{
|
|
31294
31294
|
pubkey: stakePubkey,
|
|
31295
31295
|
isSigner: false,
|
|
@@ -31311,8 +31311,8 @@ Message: ${transactionMessage}.
|
|
|
31311
31311
|
* Generate a Transaction that splits Stake tokens into another stake account
|
|
31312
31312
|
*/
|
|
31313
31313
|
static split(params, rentExemptReserve) {
|
|
31314
|
-
const transaction = new
|
|
31315
|
-
transaction.add(
|
|
31314
|
+
const transaction = new Transaction3();
|
|
31315
|
+
transaction.add(SystemProgram2.createAccount({
|
|
31316
31316
|
fromPubkey: params.authorizedPubkey,
|
|
31317
31317
|
newAccountPubkey: params.splitStakePubkey,
|
|
31318
31318
|
lamports: rentExemptReserve,
|
|
@@ -31334,8 +31334,8 @@ Message: ${transactionMessage}.
|
|
|
31334
31334
|
seed,
|
|
31335
31335
|
lamports
|
|
31336
31336
|
} = params;
|
|
31337
|
-
const transaction = new
|
|
31338
|
-
transaction.add(
|
|
31337
|
+
const transaction = new Transaction3();
|
|
31338
|
+
transaction.add(SystemProgram2.allocate({
|
|
31339
31339
|
accountPubkey: splitStakePubkey,
|
|
31340
31340
|
basePubkey,
|
|
31341
31341
|
seed,
|
|
@@ -31343,7 +31343,7 @@ Message: ${transactionMessage}.
|
|
|
31343
31343
|
programId: this.programId
|
|
31344
31344
|
}));
|
|
31345
31345
|
if (rentExemptReserve && rentExemptReserve > 0) {
|
|
31346
|
-
transaction.add(
|
|
31346
|
+
transaction.add(SystemProgram2.transfer({
|
|
31347
31347
|
fromPubkey: params.authorizedPubkey,
|
|
31348
31348
|
toPubkey: splitStakePubkey,
|
|
31349
31349
|
lamports: rentExemptReserve
|
|
@@ -31367,7 +31367,7 @@ Message: ${transactionMessage}.
|
|
|
31367
31367
|
} = params;
|
|
31368
31368
|
const type = STAKE_INSTRUCTION_LAYOUTS.Merge;
|
|
31369
31369
|
const data = encodeData(type);
|
|
31370
|
-
return new
|
|
31370
|
+
return new Transaction3().add({
|
|
31371
31371
|
keys: [{
|
|
31372
31372
|
pubkey: stakePubkey,
|
|
31373
31373
|
isSigner: false,
|
|
@@ -31436,7 +31436,7 @@ Message: ${transactionMessage}.
|
|
|
31436
31436
|
isWritable: false
|
|
31437
31437
|
});
|
|
31438
31438
|
}
|
|
31439
|
-
return new
|
|
31439
|
+
return new Transaction3().add({
|
|
31440
31440
|
keys,
|
|
31441
31441
|
programId: this.programId,
|
|
31442
31442
|
data
|
|
@@ -31452,7 +31452,7 @@ Message: ${transactionMessage}.
|
|
|
31452
31452
|
} = params;
|
|
31453
31453
|
const type = STAKE_INSTRUCTION_LAYOUTS.Deactivate;
|
|
31454
31454
|
const data = encodeData(type);
|
|
31455
|
-
return new
|
|
31455
|
+
return new Transaction3().add({
|
|
31456
31456
|
keys: [{
|
|
31457
31457
|
pubkey: stakePubkey,
|
|
31458
31458
|
isSigner: false,
|
|
@@ -31471,7 +31471,7 @@ Message: ${transactionMessage}.
|
|
|
31471
31471
|
});
|
|
31472
31472
|
}
|
|
31473
31473
|
};
|
|
31474
|
-
StakeProgram.programId = new
|
|
31474
|
+
StakeProgram.programId = new PublicKey4("Stake11111111111111111111111111111111111111");
|
|
31475
31475
|
StakeProgram.space = 200;
|
|
31476
31476
|
var VoteInit = class {
|
|
31477
31477
|
/** [0, 100] */
|
|
@@ -31523,7 +31523,7 @@ Message: ${transactionMessage}.
|
|
|
31523
31523
|
return {
|
|
31524
31524
|
votePubkey: instruction.keys[0].pubkey,
|
|
31525
31525
|
nodePubkey: instruction.keys[3].pubkey,
|
|
31526
|
-
voteInit: new VoteInit(new
|
|
31526
|
+
voteInit: new VoteInit(new PublicKey4(voteInit2.nodePubkey), new PublicKey4(voteInit2.authorizedVoter), new PublicKey4(voteInit2.authorizedWithdrawer), voteInit2.commission)
|
|
31527
31527
|
};
|
|
31528
31528
|
}
|
|
31529
31529
|
/**
|
|
@@ -31539,7 +31539,7 @@ Message: ${transactionMessage}.
|
|
|
31539
31539
|
return {
|
|
31540
31540
|
votePubkey: instruction.keys[0].pubkey,
|
|
31541
31541
|
authorizedPubkey: instruction.keys[2].pubkey,
|
|
31542
|
-
newAuthorizedPubkey: new
|
|
31542
|
+
newAuthorizedPubkey: new PublicKey4(newAuthorized),
|
|
31543
31543
|
voteAuthorizationType: {
|
|
31544
31544
|
index: voteAuthorizationType
|
|
31545
31545
|
}
|
|
@@ -31561,9 +31561,9 @@ Message: ${transactionMessage}.
|
|
|
31561
31561
|
} = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);
|
|
31562
31562
|
return {
|
|
31563
31563
|
currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,
|
|
31564
|
-
currentAuthorityDerivedKeyOwnerPubkey: new
|
|
31564
|
+
currentAuthorityDerivedKeyOwnerPubkey: new PublicKey4(currentAuthorityDerivedKeyOwnerPubkey),
|
|
31565
31565
|
currentAuthorityDerivedKeySeed,
|
|
31566
|
-
newAuthorizedPubkey: new
|
|
31566
|
+
newAuthorizedPubkey: new PublicKey4(newAuthorized),
|
|
31567
31567
|
voteAuthorizationType: {
|
|
31568
31568
|
index: voteAuthorizationType
|
|
31569
31569
|
},
|
|
@@ -31681,14 +31681,14 @@ Message: ${transactionMessage}.
|
|
|
31681
31681
|
programId: this.programId,
|
|
31682
31682
|
data
|
|
31683
31683
|
};
|
|
31684
|
-
return new
|
|
31684
|
+
return new TransactionInstruction4(instructionData);
|
|
31685
31685
|
}
|
|
31686
31686
|
/**
|
|
31687
31687
|
* Generate a transaction that creates a new Vote account.
|
|
31688
31688
|
*/
|
|
31689
31689
|
static createAccount(params) {
|
|
31690
|
-
const transaction = new
|
|
31691
|
-
transaction.add(
|
|
31690
|
+
const transaction = new Transaction3();
|
|
31691
|
+
transaction.add(SystemProgram2.createAccount({
|
|
31692
31692
|
fromPubkey: params.fromPubkey,
|
|
31693
31693
|
newAccountPubkey: params.votePubkey,
|
|
31694
31694
|
lamports: params.lamports,
|
|
@@ -31729,7 +31729,7 @@ Message: ${transactionMessage}.
|
|
|
31729
31729
|
isSigner: true,
|
|
31730
31730
|
isWritable: false
|
|
31731
31731
|
}];
|
|
31732
|
-
return new
|
|
31732
|
+
return new Transaction3().add({
|
|
31733
31733
|
keys,
|
|
31734
31734
|
programId: this.programId,
|
|
31735
31735
|
data
|
|
@@ -31770,7 +31770,7 @@ Message: ${transactionMessage}.
|
|
|
31770
31770
|
isSigner: true,
|
|
31771
31771
|
isWritable: false
|
|
31772
31772
|
}];
|
|
31773
|
-
return new
|
|
31773
|
+
return new Transaction3().add({
|
|
31774
31774
|
keys,
|
|
31775
31775
|
programId: this.programId,
|
|
31776
31776
|
data
|
|
@@ -31803,7 +31803,7 @@ Message: ${transactionMessage}.
|
|
|
31803
31803
|
isSigner: true,
|
|
31804
31804
|
isWritable: false
|
|
31805
31805
|
}];
|
|
31806
|
-
return new
|
|
31806
|
+
return new Transaction3().add({
|
|
31807
31807
|
keys,
|
|
31808
31808
|
programId: this.programId,
|
|
31809
31809
|
data
|
|
@@ -31847,16 +31847,16 @@ Message: ${transactionMessage}.
|
|
|
31847
31847
|
isSigner: true,
|
|
31848
31848
|
isWritable: false
|
|
31849
31849
|
}];
|
|
31850
|
-
return new
|
|
31850
|
+
return new Transaction3().add({
|
|
31851
31851
|
keys,
|
|
31852
31852
|
programId: this.programId,
|
|
31853
31853
|
data
|
|
31854
31854
|
});
|
|
31855
31855
|
}
|
|
31856
31856
|
};
|
|
31857
|
-
VoteProgram.programId = new
|
|
31857
|
+
VoteProgram.programId = new PublicKey4("Vote111111111111111111111111111111111111111");
|
|
31858
31858
|
VoteProgram.space = 3762;
|
|
31859
|
-
var VALIDATOR_INFO_KEY = new
|
|
31859
|
+
var VALIDATOR_INFO_KEY = new PublicKey4("Va1idator1nfo111111111111111111111111111111");
|
|
31860
31860
|
var InfoString = superstruct.type({
|
|
31861
31861
|
name: superstruct.string(),
|
|
31862
31862
|
website: superstruct.optional(superstruct.string()),
|
|
@@ -31890,7 +31890,7 @@ Message: ${transactionMessage}.
|
|
|
31890
31890
|
if (configKeyCount !== 2) return null;
|
|
31891
31891
|
const configKeys = [];
|
|
31892
31892
|
for (let i = 0; i < 2; i++) {
|
|
31893
|
-
const publicKey2 = new
|
|
31893
|
+
const publicKey2 = new PublicKey4(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));
|
|
31894
31894
|
const isSigner = guardedShift(byteArray) === 1;
|
|
31895
31895
|
configKeys.push({
|
|
31896
31896
|
publicKey: publicKey2,
|
|
@@ -31908,7 +31908,7 @@ Message: ${transactionMessage}.
|
|
|
31908
31908
|
return null;
|
|
31909
31909
|
}
|
|
31910
31910
|
};
|
|
31911
|
-
var VOTE_PROGRAM_ID = new
|
|
31911
|
+
var VOTE_PROGRAM_ID = new PublicKey4("Vote111111111111111111111111111111111111111");
|
|
31912
31912
|
var VoteAccountLayout = BufferLayout__namespace.struct([
|
|
31913
31913
|
publicKey("nodePubkey"),
|
|
31914
31914
|
publicKey("authorizedWithdrawer"),
|
|
@@ -31965,8 +31965,8 @@ Message: ${transactionMessage}.
|
|
|
31965
31965
|
rootSlot = null;
|
|
31966
31966
|
}
|
|
31967
31967
|
return new _VoteAccount({
|
|
31968
|
-
nodePubkey: new
|
|
31969
|
-
authorizedWithdrawer: new
|
|
31968
|
+
nodePubkey: new PublicKey4(va.nodePubkey),
|
|
31969
|
+
authorizedWithdrawer: new PublicKey4(va.authorizedWithdrawer),
|
|
31970
31970
|
commission: va.commission,
|
|
31971
31971
|
votes: va.votes,
|
|
31972
31972
|
rootSlot,
|
|
@@ -31983,7 +31983,7 @@ Message: ${transactionMessage}.
|
|
|
31983
31983
|
}) {
|
|
31984
31984
|
return {
|
|
31985
31985
|
epoch,
|
|
31986
|
-
authorizedVoter: new
|
|
31986
|
+
authorizedVoter: new PublicKey4(authorizedVoter)
|
|
31987
31987
|
};
|
|
31988
31988
|
}
|
|
31989
31989
|
function parsePriorVoters({
|
|
@@ -31992,7 +31992,7 @@ Message: ${transactionMessage}.
|
|
|
31992
31992
|
targetEpoch
|
|
31993
31993
|
}) {
|
|
31994
31994
|
return {
|
|
31995
|
-
authorizedPubkey: new
|
|
31995
|
+
authorizedPubkey: new PublicKey4(authorizedPubkey),
|
|
31996
31996
|
epochOfLastAuthorizedSwitch,
|
|
31997
31997
|
targetEpoch
|
|
31998
31998
|
};
|
|
@@ -32094,7 +32094,7 @@ Message: ${transactionMessage}.
|
|
|
32094
32094
|
exports.NonceAccount = NonceAccount;
|
|
32095
32095
|
exports.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
|
|
32096
32096
|
exports.PUBLIC_KEY_LENGTH = PUBLIC_KEY_LENGTH;
|
|
32097
|
-
exports.PublicKey =
|
|
32097
|
+
exports.PublicKey = PublicKey4;
|
|
32098
32098
|
exports.SIGNATURE_LENGTH_IN_BYTES = SIGNATURE_LENGTH_IN_BYTES;
|
|
32099
32099
|
exports.SOLANA_SCHEMA = SOLANA_SCHEMA;
|
|
32100
32100
|
exports.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
|
|
@@ -32118,12 +32118,12 @@ Message: ${transactionMessage}.
|
|
|
32118
32118
|
exports.StakeProgram = StakeProgram;
|
|
32119
32119
|
exports.Struct = Struct;
|
|
32120
32120
|
exports.SystemInstruction = SystemInstruction;
|
|
32121
|
-
exports.SystemProgram =
|
|
32122
|
-
exports.Transaction =
|
|
32121
|
+
exports.SystemProgram = SystemProgram2;
|
|
32122
|
+
exports.Transaction = Transaction3;
|
|
32123
32123
|
exports.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
|
|
32124
32124
|
exports.TransactionExpiredNonceInvalidError = TransactionExpiredNonceInvalidError;
|
|
32125
32125
|
exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
|
|
32126
|
-
exports.TransactionInstruction =
|
|
32126
|
+
exports.TransactionInstruction = TransactionInstruction4;
|
|
32127
32127
|
exports.TransactionMessage = TransactionMessage;
|
|
32128
32128
|
exports.TransactionStatus = TransactionStatus;
|
|
32129
32129
|
exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
|
|
@@ -32291,6 +32291,7 @@ var CHAIN_NAMES = {
|
|
|
32291
32291
|
56: "BNB Chain",
|
|
32292
32292
|
137: "Polygon",
|
|
32293
32293
|
8453: "Base",
|
|
32294
|
+
42161: "Arbitrum",
|
|
32294
32295
|
900: "Solana",
|
|
32295
32296
|
1500: "Stellar",
|
|
32296
32297
|
lightning: "Bitcoin Lightning"
|
|
@@ -32300,10 +32301,20 @@ var CHAIN_FAMILY = {
|
|
|
32300
32301
|
56: "evm",
|
|
32301
32302
|
137: "evm",
|
|
32302
32303
|
8453: "evm",
|
|
32304
|
+
42161: "evm",
|
|
32303
32305
|
900: "solana",
|
|
32304
32306
|
1500: "stellar",
|
|
32305
32307
|
lightning: "lightning"
|
|
32306
32308
|
};
|
|
32309
|
+
var NATIVE_COINS = Object.freeze({
|
|
32310
|
+
"1:ETH": { chainId: "1", symbol: "ETH", decimals: 18 },
|
|
32311
|
+
"8453:ETH": { chainId: "8453", symbol: "ETH", decimals: 18 },
|
|
32312
|
+
"42161:ETH": { chainId: "42161", symbol: "ETH", decimals: 18 },
|
|
32313
|
+
"56:BNB": { chainId: "56", symbol: "BNB", decimals: 18 },
|
|
32314
|
+
"137:POL": { chainId: "137", symbol: "POL", decimals: 18 },
|
|
32315
|
+
"900:SOL": { chainId: "900", symbol: "SOL", decimals: 9 }
|
|
32316
|
+
});
|
|
32317
|
+
var NATIVE_MIN_USD_FALLBACK = Object.freeze({ "1:ETH": 1 });
|
|
32307
32318
|
var DECIMALS = {
|
|
32308
32319
|
"1:USDC": 6,
|
|
32309
32320
|
"1:USDT": 6,
|
|
@@ -32313,10 +32324,20 @@ var DECIMALS = {
|
|
|
32313
32324
|
"137:USDC": 6,
|
|
32314
32325
|
"137:USDT": 6,
|
|
32315
32326
|
"8453:USDC": 6,
|
|
32327
|
+
// Arbitrum One: native USDC and USDT0 are both 6-decimals.
|
|
32328
|
+
"42161:USDC": 6,
|
|
32329
|
+
"42161:USDT": 6,
|
|
32316
32330
|
"900:USDC": 6,
|
|
32317
32331
|
"900:USDT": 6,
|
|
32318
32332
|
// Stellar classic assets carry 7 decimal places.
|
|
32319
|
-
"1500:USDC": 7
|
|
32333
|
+
"1500:USDC": 7,
|
|
32334
|
+
// Native coins: wei (18) on every EVM chain, lamports (9) on Solana.
|
|
32335
|
+
"1:ETH": 18,
|
|
32336
|
+
"8453:ETH": 18,
|
|
32337
|
+
"42161:ETH": 18,
|
|
32338
|
+
"56:BNB": 18,
|
|
32339
|
+
"137:POL": 18,
|
|
32340
|
+
"900:SOL": 9
|
|
32320
32341
|
};
|
|
32321
32342
|
var AmountError = class extends Error {
|
|
32322
32343
|
constructor(code, message) {
|
|
@@ -32407,6 +32428,20 @@ function chainName(chainId) {
|
|
|
32407
32428
|
function chainFamily(chainId) {
|
|
32408
32429
|
return CHAIN_FAMILY[String(chainId)] || CHAIN_FAMILY[chainId] || null;
|
|
32409
32430
|
}
|
|
32431
|
+
function isNativeSource(chainId, tokenSymbol) {
|
|
32432
|
+
return Object.prototype.hasOwnProperty.call(NATIVE_COINS, decimalsKey(chainId, tokenSymbol));
|
|
32433
|
+
}
|
|
32434
|
+
var NATIVE_TOKEN_ADDRESSES = /* @__PURE__ */ new Set([
|
|
32435
|
+
"",
|
|
32436
|
+
"0x0000000000000000000000000000000000000000",
|
|
32437
|
+
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
32438
|
+
"native",
|
|
32439
|
+
"11111111111111111111111111111111"
|
|
32440
|
+
]);
|
|
32441
|
+
function isNativeTokenAddress(tokenAddress) {
|
|
32442
|
+
if (tokenAddress === null || tokenAddress === void 0) return true;
|
|
32443
|
+
return NATIVE_TOKEN_ADDRESSES.has(String(tokenAddress).trim().toLowerCase());
|
|
32444
|
+
}
|
|
32410
32445
|
|
|
32411
32446
|
// scripts/src/lib/keys.mjs
|
|
32412
32447
|
import fs from "node:fs";
|
|
@@ -33311,6 +33346,7 @@ function claimSend(rozoPaymentId, intent, { skipCaps = false } = {}) {
|
|
|
33311
33346
|
claimedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33312
33347
|
chainId: intent.chainId,
|
|
33313
33348
|
tokenSymbol: intent.tokenSymbol,
|
|
33349
|
+
native: Boolean(intent.native),
|
|
33314
33350
|
from: intent.from,
|
|
33315
33351
|
to: intent.to,
|
|
33316
33352
|
amountAtomic: intent.amountAtomic,
|
|
@@ -33595,6 +33631,7 @@ var MARGINS_MS = {
|
|
|
33595
33631
|
56: 10 * MINUTE,
|
|
33596
33632
|
137: 10 * MINUTE,
|
|
33597
33633
|
8453: 10 * MINUTE,
|
|
33634
|
+
42161: 10 * MINUTE,
|
|
33598
33635
|
900: 5 * MINUTE,
|
|
33599
33636
|
1500: 10 * MINUTE,
|
|
33600
33637
|
lightning: 10 * MINUTE
|
|
@@ -33625,13 +33662,16 @@ function checkExpiry({
|
|
|
33625
33662
|
chainId,
|
|
33626
33663
|
intentExpiresAt,
|
|
33627
33664
|
coinbaseExpiry,
|
|
33628
|
-
bolt11ExpiresAt = void 0
|
|
33665
|
+
bolt11ExpiresAt = void 0,
|
|
33666
|
+
quoteExpiresAt = void 0
|
|
33629
33667
|
}) {
|
|
33630
33668
|
const marginMs = marginFor(chainId);
|
|
33631
33669
|
const intentMs = parseDeadline(intentExpiresAt);
|
|
33632
33670
|
const coinbaseMs = parseDeadline(coinbaseExpiry);
|
|
33633
33671
|
const bolt11Ms = bolt11ExpiresAt === void 0 ? void 0 : parseDeadline(bolt11ExpiresAt);
|
|
33634
|
-
const
|
|
33672
|
+
const native = quoteExpiresAt !== void 0;
|
|
33673
|
+
const quoteMs = native ? parseDeadline(quoteExpiresAt) : null;
|
|
33674
|
+
const deadlines = { intentMs, coinbaseMs, bolt11Ms: bolt11Ms ?? null, quoteMs };
|
|
33635
33675
|
const base = {
|
|
33636
33676
|
marginMs,
|
|
33637
33677
|
effectiveDeadlineMs: null,
|
|
@@ -33655,7 +33695,16 @@ function checkExpiry({
|
|
|
33655
33695
|
reason: "Coinbase preApprovalExpiry is missing or unparsable."
|
|
33656
33696
|
};
|
|
33657
33697
|
}
|
|
33658
|
-
|
|
33698
|
+
if (native && quoteMs === null) {
|
|
33699
|
+
return {
|
|
33700
|
+
...base,
|
|
33701
|
+
ok: false,
|
|
33702
|
+
code: "EXPIRY_UNPARSABLE",
|
|
33703
|
+
reason: "This native coin order carries no price lock (quoteExpiresAt), so the coin amount cannot be trusted to be honoured. Refusing to treat it as payable."
|
|
33704
|
+
};
|
|
33705
|
+
}
|
|
33706
|
+
const effective = native ? Math.min(intentMs, coinbaseMs, quoteMs) : Math.min(intentMs, coinbaseMs);
|
|
33707
|
+
const lockBinds = native && quoteMs <= Math.min(intentMs, coinbaseMs);
|
|
33659
33708
|
const msRemaining = effective - now;
|
|
33660
33709
|
const msOfSlack = msRemaining - marginMs;
|
|
33661
33710
|
const withDeadline = {
|
|
@@ -33668,16 +33717,16 @@ function checkExpiry({
|
|
|
33668
33717
|
return {
|
|
33669
33718
|
...withDeadline,
|
|
33670
33719
|
ok: false,
|
|
33671
|
-
code: "EXPIRED",
|
|
33672
|
-
reason: "The order or the Coinbase link has already expired."
|
|
33720
|
+
code: lockBinds ? "QUOTE_EXPIRED" : "EXPIRED",
|
|
33721
|
+
reason: lockBinds ? "The coin price for this order was locked until quoteExpiresAt, and that has passed. A payment now would be valued at the price when it arrives and may fall short. Do not send it; let the order expire unfunded and start a new one." : "The order or the Coinbase link has already expired."
|
|
33673
33722
|
};
|
|
33674
33723
|
}
|
|
33675
33724
|
if (msOfSlack <= 0) {
|
|
33676
33725
|
return {
|
|
33677
33726
|
...withDeadline,
|
|
33678
33727
|
ok: false,
|
|
33679
|
-
code: "EXPIRY_MARGIN",
|
|
33680
|
-
reason: `Only ${Math.floor(msRemaining / 1e3)}s left before the earliest deadline; this chain needs a ${Math.floor(marginMs / 6e4)} min safety margin.`
|
|
33728
|
+
code: lockBinds ? "QUOTE_EXPIRY_MARGIN" : "EXPIRY_MARGIN",
|
|
33729
|
+
reason: `Only ${Math.floor(msRemaining / 1e3)}s left before the earliest deadline${lockBinds ? " (the coin price lock)" : ""}; this chain needs a ${Math.floor(marginMs / 6e4)} min safety margin.`
|
|
33681
33730
|
};
|
|
33682
33731
|
}
|
|
33683
33732
|
if (bolt11ExpiresAt !== void 0) {
|
|
@@ -33701,6 +33750,12 @@ function checkExpiry({
|
|
|
33701
33750
|
}
|
|
33702
33751
|
return { ...withDeadline, ok: true, code: null, reason: null };
|
|
33703
33752
|
}
|
|
33753
|
+
function priceLockFor({ native, payment = null, others = [] }) {
|
|
33754
|
+
if (!native) return void 0;
|
|
33755
|
+
const candidates = [payment?.quoteExpiresAt, payment?.source?.quoteExpiresAt, ...others].map(parseDeadline).filter((ms) => ms !== null);
|
|
33756
|
+
if (!candidates.length) return null;
|
|
33757
|
+
return new Date(Math.min(...candidates)).toISOString();
|
|
33758
|
+
}
|
|
33704
33759
|
|
|
33705
33760
|
// scripts/src/lib/blacklist.mjs
|
|
33706
33761
|
import fs5 from "node:fs";
|
|
@@ -33886,6 +33941,14 @@ function assertBitrefillLive(state, payment) {
|
|
|
33886
33941
|
if (!expiry.ok) throw new SkillError(expiry.code, expiry.reason, expiry);
|
|
33887
33942
|
return expiry;
|
|
33888
33943
|
}
|
|
33944
|
+
function sendPriceLock(payment, state) {
|
|
33945
|
+
const source = payment?.source || {};
|
|
33946
|
+
return priceLockFor({
|
|
33947
|
+
native: isNativeSource(source.chainId, source.tokenSymbol),
|
|
33948
|
+
payment,
|
|
33949
|
+
others: [state?.confirmation?.quoteExpiresAt, state?.quoteExpiresAt]
|
|
33950
|
+
});
|
|
33951
|
+
}
|
|
33889
33952
|
async function preflight({
|
|
33890
33953
|
rozoPaymentId,
|
|
33891
33954
|
expectFamily,
|
|
@@ -33974,14 +34037,19 @@ async function preflight({
|
|
|
33974
34037
|
let statusNow = null;
|
|
33975
34038
|
let expiry;
|
|
33976
34039
|
if (state.provider === "bitrefill") {
|
|
34040
|
+
if (isNativeSource(source.chainId, source.tokenSymbol)) {
|
|
34041
|
+
throw new SkillError("NATIVE_NOT_AVAILABLE", "Native coins are not available for Bitrefill invoices.");
|
|
34042
|
+
}
|
|
33977
34043
|
expiry = assertBitrefillLive(state, payment);
|
|
33978
34044
|
} else {
|
|
33979
34045
|
statusNow = await invoiceStatus({ linkId: state.linkId });
|
|
34046
|
+
const quoteExpiresAt = sendPriceLock(payment, state);
|
|
33980
34047
|
expiry = checkExpiry({
|
|
33981
34048
|
now: Date.now(),
|
|
33982
34049
|
chainId: source.chainId,
|
|
33983
34050
|
intentExpiresAt: payment?.expiresAt,
|
|
33984
|
-
coinbaseExpiry: statusNow?.coinbase?.preApprovalExpiry
|
|
34051
|
+
coinbaseExpiry: statusNow?.coinbase?.preApprovalExpiry,
|
|
34052
|
+
...quoteExpiresAt !== void 0 ? { quoteExpiresAt } : {}
|
|
33985
34053
|
});
|
|
33986
34054
|
if (!expiry.ok) throw new SkillError(expiry.code, expiry.reason, expiry);
|
|
33987
34055
|
const payable = checkPayable(statusNow, Date.now());
|
|
@@ -34002,11 +34070,22 @@ async function preflight({
|
|
|
34002
34070
|
blacklist,
|
|
34003
34071
|
amountAtomic: deposit.amountAtomic,
|
|
34004
34072
|
deposit,
|
|
34005
|
-
statusNow
|
|
34073
|
+
statusNow,
|
|
34074
|
+
quoteExpiresAt: sendPriceLock(payment, state)
|
|
34006
34075
|
};
|
|
34007
34076
|
}
|
|
34008
|
-
async function finalPayabilityCheck({
|
|
34077
|
+
async function finalPayabilityCheck({
|
|
34078
|
+
linkId,
|
|
34079
|
+
chainId,
|
|
34080
|
+
intentExpiresAt,
|
|
34081
|
+
quoteExpiresAt = void 0,
|
|
34082
|
+
state = null,
|
|
34083
|
+
rozoPaymentId = null
|
|
34084
|
+
}) {
|
|
34009
34085
|
if (state?.provider === "bitrefill") {
|
|
34086
|
+
if (isNativeSource(state?.source?.chainId, state?.source?.tokenSymbol)) {
|
|
34087
|
+
throw new SkillError("NATIVE_NOT_AVAILABLE", "Native coins are not available for Bitrefill invoices.");
|
|
34088
|
+
}
|
|
34010
34089
|
const id = rozoPaymentId ?? state.rozoPaymentId;
|
|
34011
34090
|
const payment = await getPayment(id);
|
|
34012
34091
|
const guard = reuseGuard({ payment, requested: state.source });
|
|
@@ -34023,7 +34102,9 @@ async function finalPayabilityCheck({ linkId, chainId, intentExpiresAt, state =
|
|
|
34023
34102
|
now: Date.now(),
|
|
34024
34103
|
chainId,
|
|
34025
34104
|
intentExpiresAt,
|
|
34026
|
-
coinbaseExpiry: statusNow?.coinbase?.preApprovalExpiry
|
|
34105
|
+
coinbaseExpiry: statusNow?.coinbase?.preApprovalExpiry,
|
|
34106
|
+
// Native orders: the price lock, re-checked as the very last gate too.
|
|
34107
|
+
...quoteExpiresAt !== void 0 ? { quoteExpiresAt } : {}
|
|
34027
34108
|
});
|
|
34028
34109
|
if (!expiry.ok) throw new SkillError(expiry.code, expiry.reason, expiry);
|
|
34029
34110
|
return { statusNow, payable, expiry };
|
|
@@ -34073,7 +34154,8 @@ var EVM_FEE_COIN = Object.freeze({
|
|
|
34073
34154
|
1: { symbol: "ETH", network: "Ethereum" },
|
|
34074
34155
|
56: { symbol: "BNB", network: "BNB Chain" },
|
|
34075
34156
|
137: { symbol: "POL", network: "Polygon" },
|
|
34076
|
-
8453: { symbol: "ETH", network: "Base" }
|
|
34157
|
+
8453: { symbol: "ETH", network: "Base" },
|
|
34158
|
+
42161: { symbol: "ETH", network: "Arbitrum" }
|
|
34077
34159
|
});
|
|
34078
34160
|
function formatAtomic(atomic, decimals) {
|
|
34079
34161
|
const neg = atomic < 0n;
|
|
@@ -34096,9 +34178,10 @@ function assessFee({ balance, required, decimals, symbol, network }) {
|
|
|
34096
34178
|
}
|
|
34097
34179
|
function insufficient(details, extra) {
|
|
34098
34180
|
const need = details.required ? `about ${details.required} ${details.feeCoin}` : `some ${details.feeCoin}`;
|
|
34181
|
+
const forWhat = details.payment ? `for the payment of ${details.payment} ${details.feeCoin} plus the network fee` : "for the network fee";
|
|
34099
34182
|
return new SkillError(
|
|
34100
34183
|
"INSUFFICIENT_GAS",
|
|
34101
|
-
`This wallet holds ${details.balance} ${details.feeCoin} on ${details.network} but needs ${need}
|
|
34184
|
+
`This wallet holds ${details.balance} ${details.feeCoin} on ${details.network} but needs ${need} ${forWhat}${details.shortfall ? ` (short by ${details.shortfall} ${details.feeCoin})` : ""}. Nothing was signed. Add ${details.feeCoin} on ${details.network} to this wallet and re-run, or pay with a different coin.` + (extra ? ` ${extra}` : ""),
|
|
34102
34185
|
details
|
|
34103
34186
|
);
|
|
34104
34187
|
}
|
|
@@ -34110,7 +34193,7 @@ function unavailable(network, err) {
|
|
|
34110
34193
|
);
|
|
34111
34194
|
}
|
|
34112
34195
|
var LAMPORTS_DECIMALS = 9;
|
|
34113
|
-
async function solFeePrecheck({ connection, payer, message }) {
|
|
34196
|
+
async function solFeePrecheck({ connection, payer, message, value = 0n }) {
|
|
34114
34197
|
const network = "Solana";
|
|
34115
34198
|
let balance;
|
|
34116
34199
|
let fee;
|
|
@@ -34131,32 +34214,148 @@ async function solFeePrecheck({ connection, payer, message }) {
|
|
|
34131
34214
|
}
|
|
34132
34215
|
throw unavailable(network, err);
|
|
34133
34216
|
}
|
|
34134
|
-
const remaining = balance - fee;
|
|
34135
|
-
const required = remaining === 0n ? fee : fee + rentMin;
|
|
34217
|
+
const remaining = balance - fee - value;
|
|
34218
|
+
const required = remaining === 0n ? fee + value : fee + value + rentMin;
|
|
34136
34219
|
const { ok, details } = assessFee({ balance, required, decimals: LAMPORTS_DECIMALS, symbol: "SOL", network });
|
|
34137
|
-
const full = {
|
|
34220
|
+
const full = {
|
|
34221
|
+
...details,
|
|
34222
|
+
payment: value > 0n ? formatAtomic(value, LAMPORTS_DECIMALS) : null,
|
|
34223
|
+
fee: formatAtomic(fee, LAMPORTS_DECIMALS),
|
|
34224
|
+
rentExemptMinimum: formatAtomic(rentMin, LAMPORTS_DECIMALS)
|
|
34225
|
+
};
|
|
34138
34226
|
if (!ok) {
|
|
34139
34227
|
throw insufficient(
|
|
34140
34228
|
full,
|
|
34141
|
-
balance >= fee ? "Solana also requires a wallet to keep a small minimum balance after paying the fee." : null
|
|
34229
|
+
balance >= fee + value ? "Solana also requires a wallet to keep a small minimum balance after paying the fee." : null
|
|
34142
34230
|
);
|
|
34143
34231
|
}
|
|
34144
34232
|
return full;
|
|
34145
34233
|
}
|
|
34146
34234
|
|
|
34235
|
+
// scripts/src/lib/rpc.mjs
|
|
34236
|
+
var DEFAULT_RPC = Object.freeze({
|
|
34237
|
+
// eth.llamarpc.com and polygon-rpc.com stopped answering (checked
|
|
34238
|
+
// 2026-10-12: HTTP 525, and "API key disabled"); publicnode serves both.
|
|
34239
|
+
1: "https://ethereum-rpc.publicnode.com",
|
|
34240
|
+
56: "https://bsc-dataseed.binance.org",
|
|
34241
|
+
137: "https://polygon-bor-rpc.publicnode.com",
|
|
34242
|
+
8453: "https://mainnet.base.org",
|
|
34243
|
+
42161: "https://arb1.arbitrum.io/rpc",
|
|
34244
|
+
900: "https://api.mainnet-beta.solana.com"
|
|
34245
|
+
});
|
|
34246
|
+
function rpcFor(chainId, override, env = process.env) {
|
|
34247
|
+
if (override && override !== true) return String(override);
|
|
34248
|
+
const fromEnv = env?.[`ROZO_CHECKOUT_RPC_${chainId}`];
|
|
34249
|
+
if (fromEnv) return fromEnv;
|
|
34250
|
+
const fallback = DEFAULT_RPC[String(chainId)];
|
|
34251
|
+
if (!fallback) {
|
|
34252
|
+
throw new SkillError(
|
|
34253
|
+
"NO_RPC",
|
|
34254
|
+
`No RPC known for chain ${chainId}. Pass --rpc <url> or set ROZO_CHECKOUT_RPC_${chainId}.`
|
|
34255
|
+
);
|
|
34256
|
+
}
|
|
34257
|
+
return fallback;
|
|
34258
|
+
}
|
|
34259
|
+
|
|
34260
|
+
// scripts/src/lib/native-send.mjs
|
|
34261
|
+
var import_web3 = __toESM(require_index_cjs(), 1);
|
|
34262
|
+
var MEMO_PROGRAM_ID = new import_web3.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
|
|
34263
|
+
function assertNativeTokenAddress(tokenAddress) {
|
|
34264
|
+
if (!isNativeTokenAddress(tokenAddress)) {
|
|
34265
|
+
throw new SkillError(
|
|
34266
|
+
"NATIVE_TOKEN_ADDRESS_UNEXPECTED",
|
|
34267
|
+
"This native coin order names a token contract or mint, which a native payment never uses. Refusing to guess which asset to send."
|
|
34268
|
+
);
|
|
34269
|
+
}
|
|
34270
|
+
}
|
|
34271
|
+
function assertPositive(amountAtomic) {
|
|
34272
|
+
if (typeof amountAtomic !== "bigint" || amountAtomic <= 0n) {
|
|
34273
|
+
throw new SkillError("DEPOSIT_INCOMPLETE", "The order carries no positive native amount.");
|
|
34274
|
+
}
|
|
34275
|
+
}
|
|
34276
|
+
async function prepareSolNativeSend({
|
|
34277
|
+
connection,
|
|
34278
|
+
payer,
|
|
34279
|
+
recipientAddress,
|
|
34280
|
+
amountAtomic,
|
|
34281
|
+
memo = null,
|
|
34282
|
+
tokenAddress
|
|
34283
|
+
}) {
|
|
34284
|
+
assertNativeTokenAddress(tokenAddress);
|
|
34285
|
+
assertPositive(amountAtomic);
|
|
34286
|
+
let recipient;
|
|
34287
|
+
try {
|
|
34288
|
+
recipient = new import_web3.PublicKey(recipientAddress);
|
|
34289
|
+
} catch {
|
|
34290
|
+
throw new SkillError("BAD_DEPOSIT_ADDRESS", "The deposit address is not a valid Solana address.");
|
|
34291
|
+
}
|
|
34292
|
+
let info;
|
|
34293
|
+
let rentMin;
|
|
34294
|
+
let balance;
|
|
34295
|
+
try {
|
|
34296
|
+
info = await connection.getAccountInfo(recipient, "confirmed");
|
|
34297
|
+
rentMin = BigInt(await connection.getMinimumBalanceForRentExemption(0));
|
|
34298
|
+
balance = BigInt(await connection.getBalance(payer, "confirmed"));
|
|
34299
|
+
} catch (err) {
|
|
34300
|
+
throw new SkillError(
|
|
34301
|
+
"RPC_READ_FAILED",
|
|
34302
|
+
`Could not read the Solana accounts: ${redact(err?.message || "unknown error")}. Nothing was signed.`
|
|
34303
|
+
);
|
|
34304
|
+
}
|
|
34305
|
+
if (info && (info.executable || !info.owner?.equals?.(import_web3.SystemProgram.programId))) {
|
|
34306
|
+
throw new SkillError(
|
|
34307
|
+
"DEPOSIT_ACCOUNT_NOT_WALLET",
|
|
34308
|
+
"The deposit address is not a plain Solana wallet (it is a token account or a program). Refusing to send SOL to it."
|
|
34309
|
+
);
|
|
34310
|
+
}
|
|
34311
|
+
if (!info && amountAtomic < rentMin) {
|
|
34312
|
+
throw new SkillError(
|
|
34313
|
+
"DEPOSIT_BELOW_RENT",
|
|
34314
|
+
`The deposit address does not exist yet and ${formatAtomic(amountAtomic, 9)} SOL is below the ${formatAtomic(rentMin, 9)} SOL needed to open it. Pay this order another way.`
|
|
34315
|
+
);
|
|
34316
|
+
}
|
|
34317
|
+
if (balance < amountAtomic) {
|
|
34318
|
+
throw new SkillError(
|
|
34319
|
+
"INSUFFICIENT_BALANCE",
|
|
34320
|
+
`This wallet holds ${formatAtomic(balance, 9)} SOL; the order needs exactly ${formatAtomic(amountAtomic, 9)} SOL plus the network fee. Nothing was signed.`
|
|
34321
|
+
);
|
|
34322
|
+
}
|
|
34323
|
+
const tx = new import_web3.Transaction();
|
|
34324
|
+
tx.add(import_web3.SystemProgram.transfer({ fromPubkey: payer, toPubkey: recipient, lamports: amountAtomic }));
|
|
34325
|
+
if (memo) {
|
|
34326
|
+
tx.add(
|
|
34327
|
+
new import_web3.TransactionInstruction({
|
|
34328
|
+
keys: [],
|
|
34329
|
+
programId: MEMO_PROGRAM_ID,
|
|
34330
|
+
data: Buffer.from(String(memo), "utf8")
|
|
34331
|
+
})
|
|
34332
|
+
);
|
|
34333
|
+
}
|
|
34334
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
34335
|
+
tx.recentBlockhash = blockhash;
|
|
34336
|
+
tx.feePayer = payer;
|
|
34337
|
+
const networkFee = await solFeePrecheck({
|
|
34338
|
+
connection,
|
|
34339
|
+
payer,
|
|
34340
|
+
message: tx.compileMessage(),
|
|
34341
|
+
value: amountAtomic
|
|
34342
|
+
});
|
|
34343
|
+
return { tx, recipient, blockhash, lastValidBlockHeight, networkFee, recipientExists: Boolean(info) };
|
|
34344
|
+
}
|
|
34345
|
+
|
|
34147
34346
|
// scripts/src/send-sol.mjs
|
|
34148
|
-
var
|
|
34347
|
+
var import_web33 = __toESM(require_index_cjs(), 1);
|
|
34149
34348
|
|
|
34150
34349
|
// scripts/src/spl-lite.mjs
|
|
34151
|
-
var
|
|
34152
|
-
var TOKEN_PROGRAM_ID = new
|
|
34153
|
-
var ASSOCIATED_TOKEN_PROGRAM_ID = new
|
|
34350
|
+
var import_web32 = __toESM(require_index_cjs(), 1);
|
|
34351
|
+
var TOKEN_PROGRAM_ID = new import_web32.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
34352
|
+
var ASSOCIATED_TOKEN_PROGRAM_ID = new import_web32.PublicKey(
|
|
34154
34353
|
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
34155
34354
|
);
|
|
34156
34355
|
var TOKEN_ACCOUNT_LEN = 165;
|
|
34157
34356
|
var MINT_LEN = 82;
|
|
34158
34357
|
async function getAssociatedTokenAddress(mint, owner) {
|
|
34159
|
-
const [address] =
|
|
34358
|
+
const [address] = import_web32.PublicKey.findProgramAddressSync(
|
|
34160
34359
|
[owner.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()],
|
|
34161
34360
|
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
34162
34361
|
);
|
|
@@ -34177,8 +34376,8 @@ async function getAccount(connection, address) {
|
|
|
34177
34376
|
const data = await fetchOwnedAccount(connection, address, TOKEN_ACCOUNT_LEN, "Token account");
|
|
34178
34377
|
return {
|
|
34179
34378
|
address,
|
|
34180
|
-
mint: new
|
|
34181
|
-
owner: new
|
|
34379
|
+
mint: new import_web32.PublicKey(data.subarray(0, 32)),
|
|
34380
|
+
owner: new import_web32.PublicKey(data.subarray(32, 64)),
|
|
34182
34381
|
amount: data.readBigUInt64LE(64)
|
|
34183
34382
|
};
|
|
34184
34383
|
}
|
|
@@ -34195,7 +34394,7 @@ function createTransferCheckedInstruction(source, mint, destination, owner, amou
|
|
|
34195
34394
|
data.writeUInt8(12, 0);
|
|
34196
34395
|
data.writeBigUInt64LE(BigInt(amount), 1);
|
|
34197
34396
|
data.writeUInt8(decimals, 9);
|
|
34198
|
-
return new
|
|
34397
|
+
return new import_web32.TransactionInstruction({
|
|
34199
34398
|
programId: TOKEN_PROGRAM_ID,
|
|
34200
34399
|
keys: [
|
|
34201
34400
|
{ pubkey: source, isSigner: false, isWritable: true },
|
|
@@ -34208,7 +34407,6 @@ function createTransferCheckedInstruction(source, mint, destination, owner, amou
|
|
|
34208
34407
|
}
|
|
34209
34408
|
|
|
34210
34409
|
// scripts/src/send-sol.mjs
|
|
34211
|
-
var MEMO_PROGRAM_ID = new import_web32.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
|
|
34212
34410
|
var MAINNET_GENESIS = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
|
|
34213
34411
|
var B58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
34214
34412
|
async function main(argv) {
|
|
@@ -34223,19 +34421,19 @@ async function main(argv) {
|
|
|
34223
34421
|
});
|
|
34224
34422
|
const loaded = await loadKeySource(plan, { family: "solana", askPassphrase: promptPassphrase });
|
|
34225
34423
|
const secret = loaded.secretKey;
|
|
34226
|
-
const keypair = secret.length === 64 ?
|
|
34424
|
+
const keypair = secret.length === 64 ? import_web33.Keypair.fromSecretKey(secret) : import_web33.Keypair.fromSeed(secret);
|
|
34227
34425
|
const sender = keypair.publicKey.toBase58();
|
|
34228
34426
|
const keySource = loaded.label;
|
|
34229
34427
|
const dryRun = Boolean(args["dry-run"]);
|
|
34230
|
-
const { source, state, expiry, amountAtomic, payment } = await preflight({
|
|
34428
|
+
const { source, state, expiry, amountAtomic, payment, quoteExpiresAt } = await preflight({
|
|
34231
34429
|
rozoPaymentId,
|
|
34232
34430
|
expectFamily: "solana",
|
|
34233
34431
|
senderAddress: sender,
|
|
34234
34432
|
send: Boolean(args.send),
|
|
34235
34433
|
dryRun
|
|
34236
34434
|
});
|
|
34237
|
-
const rpcUrl =
|
|
34238
|
-
const connection = new
|
|
34435
|
+
const rpcUrl = rpcFor("900", args.rpc);
|
|
34436
|
+
const connection = new import_web33.Connection(rpcUrl, "confirmed");
|
|
34239
34437
|
let genesis;
|
|
34240
34438
|
try {
|
|
34241
34439
|
genesis = await connection.getGenesisHash();
|
|
@@ -34248,94 +34446,111 @@ async function main(argv) {
|
|
|
34248
34446
|
"The configured Solana RPC is not mainnet-beta. Refusing to sign."
|
|
34249
34447
|
);
|
|
34250
34448
|
}
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
}
|
|
34257
|
-
let recipient;
|
|
34258
|
-
try {
|
|
34259
|
-
recipient = new import_web32.PublicKey(source.receiverAddress);
|
|
34260
|
-
} catch {
|
|
34261
|
-
throw new SkillError("BAD_DEPOSIT_ADDRESS", "The deposit address is not a valid Solana address.");
|
|
34262
|
-
}
|
|
34263
|
-
const mintInfo = await getMint(connection, mint);
|
|
34264
|
-
const expectedDecimals = decimalsFor(source.chainId, source.tokenSymbol);
|
|
34265
|
-
if (mintInfo.decimals !== expectedDecimals) {
|
|
34266
|
-
throw new SkillError(
|
|
34267
|
-
"DECIMALS_MISMATCH",
|
|
34268
|
-
`Mint reports ${mintInfo.decimals} decimals, expected ${expectedDecimals} for ${source.tokenSymbol} on Solana. Refusing to sign.`
|
|
34269
|
-
);
|
|
34270
|
-
}
|
|
34271
|
-
const fromAta = await getAssociatedTokenAddress(mint, keypair.publicKey);
|
|
34272
|
-
let fromAccount;
|
|
34273
|
-
try {
|
|
34274
|
-
fromAccount = await getAccount(connection, fromAta);
|
|
34275
|
-
} catch {
|
|
34276
|
-
throw new SkillError(
|
|
34277
|
-
"NO_TOKEN_ACCOUNT",
|
|
34278
|
-
`The sender has no ${source.tokenSymbol} token account on Solana.`
|
|
34279
|
-
);
|
|
34280
|
-
}
|
|
34281
|
-
if (fromAccount.amount < amountAtomic) {
|
|
34282
|
-
throw new SkillError(
|
|
34283
|
-
"INSUFFICIENT_BALANCE",
|
|
34284
|
-
`Sender holds ${fromAccount.amount} atomic units; ${amountAtomic} are required.`
|
|
34285
|
-
);
|
|
34286
|
-
}
|
|
34287
|
-
let toAta;
|
|
34449
|
+
const native = isNativeSource(source.chainId, source.tokenSymbol);
|
|
34450
|
+
let tx;
|
|
34451
|
+
let blockhash;
|
|
34452
|
+
let lastValidBlockHeight;
|
|
34453
|
+
let networkFee;
|
|
34288
34454
|
let toIsTokenAccount = false;
|
|
34289
|
-
|
|
34290
|
-
const
|
|
34291
|
-
|
|
34455
|
+
if (native) {
|
|
34456
|
+
const prepared = await prepareSolNativeSend({
|
|
34457
|
+
connection,
|
|
34458
|
+
payer: keypair.publicKey,
|
|
34459
|
+
recipientAddress: source.receiverAddress,
|
|
34460
|
+
amountAtomic,
|
|
34461
|
+
memo: source.receiverMemo ?? null,
|
|
34462
|
+
tokenAddress: source.tokenAddress
|
|
34463
|
+
});
|
|
34464
|
+
({ tx, blockhash, lastValidBlockHeight, networkFee } = prepared);
|
|
34465
|
+
} else {
|
|
34466
|
+
let mint;
|
|
34467
|
+
try {
|
|
34468
|
+
mint = new import_web33.PublicKey(source.tokenAddress);
|
|
34469
|
+
} catch {
|
|
34470
|
+
throw new SkillError("NO_TOKEN_ADDRESS", "The order did not carry a usable SPL mint address.");
|
|
34471
|
+
}
|
|
34472
|
+
let recipient;
|
|
34473
|
+
try {
|
|
34474
|
+
recipient = new import_web33.PublicKey(source.receiverAddress);
|
|
34475
|
+
} catch {
|
|
34476
|
+
throw new SkillError("BAD_DEPOSIT_ADDRESS", "The deposit address is not a valid Solana address.");
|
|
34477
|
+
}
|
|
34478
|
+
const mintInfo = await getMint(connection, mint);
|
|
34479
|
+
const expectedDecimals = decimalsFor(source.chainId, source.tokenSymbol);
|
|
34480
|
+
if (mintInfo.decimals !== expectedDecimals) {
|
|
34292
34481
|
throw new SkillError(
|
|
34293
|
-
"
|
|
34294
|
-
|
|
34482
|
+
"DECIMALS_MISMATCH",
|
|
34483
|
+
`Mint reports ${mintInfo.decimals} decimals, expected ${expectedDecimals} for ${source.tokenSymbol} on Solana. Refusing to sign.`
|
|
34295
34484
|
);
|
|
34296
34485
|
}
|
|
34297
|
-
|
|
34298
|
-
|
|
34299
|
-
} catch (err) {
|
|
34300
|
-
if (err instanceof SkillError) throw err;
|
|
34301
|
-
toAta = await getAssociatedTokenAddress(mint, recipient);
|
|
34486
|
+
const fromAta = await getAssociatedTokenAddress(mint, keypair.publicKey);
|
|
34487
|
+
let fromAccount;
|
|
34302
34488
|
try {
|
|
34303
|
-
await getAccount(connection,
|
|
34489
|
+
fromAccount = await getAccount(connection, fromAta);
|
|
34304
34490
|
} catch {
|
|
34305
34491
|
throw new SkillError(
|
|
34306
|
-
"
|
|
34307
|
-
|
|
34492
|
+
"NO_TOKEN_ACCOUNT",
|
|
34493
|
+
`The sender has no ${source.tokenSymbol} token account on Solana.`
|
|
34308
34494
|
);
|
|
34309
34495
|
}
|
|
34310
|
-
|
|
34311
|
-
|
|
34312
|
-
|
|
34313
|
-
|
|
34314
|
-
|
|
34315
|
-
|
|
34316
|
-
|
|
34317
|
-
|
|
34318
|
-
|
|
34319
|
-
|
|
34320
|
-
|
|
34321
|
-
|
|
34322
|
-
|
|
34496
|
+
if (fromAccount.amount < amountAtomic) {
|
|
34497
|
+
throw new SkillError(
|
|
34498
|
+
"INSUFFICIENT_BALANCE",
|
|
34499
|
+
`Sender holds ${fromAccount.amount} atomic units; ${amountAtomic} are required.`
|
|
34500
|
+
);
|
|
34501
|
+
}
|
|
34502
|
+
let toAta;
|
|
34503
|
+
try {
|
|
34504
|
+
const acc = await getAccount(connection, recipient);
|
|
34505
|
+
if (acc.mint.toBase58() !== mint.toBase58()) {
|
|
34506
|
+
throw new SkillError(
|
|
34507
|
+
"DEPOSIT_ACCOUNT_MISMATCH",
|
|
34508
|
+
"The deposit token account is for a different mint. Refusing to send."
|
|
34509
|
+
);
|
|
34510
|
+
}
|
|
34511
|
+
toAta = recipient;
|
|
34512
|
+
toIsTokenAccount = true;
|
|
34513
|
+
} catch (err) {
|
|
34514
|
+
if (err instanceof SkillError) throw err;
|
|
34515
|
+
toAta = await getAssociatedTokenAddress(mint, recipient);
|
|
34516
|
+
try {
|
|
34517
|
+
await getAccount(connection, toAta);
|
|
34518
|
+
} catch {
|
|
34519
|
+
throw new SkillError(
|
|
34520
|
+
"DEPOSIT_ACCOUNT_MISSING",
|
|
34521
|
+
"The deposit address has no token account for this mint. Refusing to create one on its behalf \u2014 re-run create-order.js for fresh instructions."
|
|
34522
|
+
);
|
|
34523
|
+
}
|
|
34524
|
+
}
|
|
34525
|
+
tx = new import_web33.Transaction();
|
|
34323
34526
|
tx.add(
|
|
34324
|
-
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34527
|
+
createTransferCheckedInstruction(
|
|
34528
|
+
fromAta,
|
|
34529
|
+
mint,
|
|
34530
|
+
toAta,
|
|
34531
|
+
keypair.publicKey,
|
|
34532
|
+
amountAtomic,
|
|
34533
|
+
mintInfo.decimals
|
|
34534
|
+
)
|
|
34329
34535
|
);
|
|
34536
|
+
if (source.receiverMemo) {
|
|
34537
|
+
tx.add(
|
|
34538
|
+
new import_web33.TransactionInstruction({
|
|
34539
|
+
keys: [],
|
|
34540
|
+
programId: MEMO_PROGRAM_ID,
|
|
34541
|
+
data: Buffer.from(String(source.receiverMemo), "utf8")
|
|
34542
|
+
})
|
|
34543
|
+
);
|
|
34544
|
+
}
|
|
34545
|
+
({ blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed"));
|
|
34546
|
+
tx.recentBlockhash = blockhash;
|
|
34547
|
+
tx.feePayer = keypair.publicKey;
|
|
34548
|
+
networkFee = await solFeePrecheck({
|
|
34549
|
+
connection,
|
|
34550
|
+
payer: keypair.publicKey,
|
|
34551
|
+
message: tx.compileMessage()
|
|
34552
|
+
});
|
|
34330
34553
|
}
|
|
34331
|
-
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
34332
|
-
tx.recentBlockhash = blockhash;
|
|
34333
|
-
tx.feePayer = keypair.publicKey;
|
|
34334
|
-
const networkFee = await solFeePrecheck({
|
|
34335
|
-
connection,
|
|
34336
|
-
payer: keypair.publicKey,
|
|
34337
|
-
message: tx.compileMessage()
|
|
34338
|
-
});
|
|
34339
34554
|
if (dryRun) {
|
|
34340
34555
|
emit({
|
|
34341
34556
|
success: true,
|
|
@@ -34345,6 +34560,9 @@ async function main(argv) {
|
|
|
34345
34560
|
wouldSend: {
|
|
34346
34561
|
chain: chainName(900),
|
|
34347
34562
|
tokenSymbol: source.tokenSymbol,
|
|
34563
|
+
native,
|
|
34564
|
+
kind: native ? "native SOL transfer" : "SPL transfer",
|
|
34565
|
+
priceLockedUntil: native ? quoteExpiresAt : null,
|
|
34348
34566
|
amountAtomic: amountAtomic.toString(),
|
|
34349
34567
|
amount: source.amount,
|
|
34350
34568
|
toMasked: maskAddress(source.receiverAddress),
|
|
@@ -34367,6 +34585,7 @@ async function main(argv) {
|
|
|
34367
34585
|
linkId: state.linkId,
|
|
34368
34586
|
chainId: source.chainId,
|
|
34369
34587
|
intentExpiresAt: payment?.expiresAt,
|
|
34588
|
+
quoteExpiresAt,
|
|
34370
34589
|
state,
|
|
34371
34590
|
rozoPaymentId
|
|
34372
34591
|
});
|
|
@@ -34375,6 +34594,7 @@ async function main(argv) {
|
|
|
34375
34594
|
{
|
|
34376
34595
|
chainId: "900",
|
|
34377
34596
|
tokenSymbol: source.tokenSymbol,
|
|
34597
|
+
native,
|
|
34378
34598
|
from: sender,
|
|
34379
34599
|
to: source.receiverAddress,
|
|
34380
34600
|
amountAtomic: amountAtomic.toString(),
|