@solana-program/system 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.js +99 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +93 -2
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts +53 -0
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts.map +1 -0
- package/dist/types/generated/instructions/index.d.ts +1 -0
- package/dist/types/generated/instructions/index.d.ts.map +1 -1
- package/dist/types/generated/programs/system.d.ts +7 -3
- package/dist/types/generated/programs/system.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/generated/instructions/createAccountAllowPrefund.ts +212 -0
- package/src/generated/instructions/index.ts +1 -0
- package/src/generated/programs/system.ts +24 -1
package/dist/src/index.js
CHANGED
|
@@ -495,6 +495,85 @@ function parseCreateAccountInstruction(instruction) {
|
|
|
495
495
|
data: getCreateAccountInstructionDataDecoder().decode(instruction.data)
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
|
+
var CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR = 13;
|
|
499
|
+
function getCreateAccountAllowPrefundDiscriminatorBytes() {
|
|
500
|
+
return kit.getU32Encoder().encode(CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR);
|
|
501
|
+
}
|
|
502
|
+
function getCreateAccountAllowPrefundInstructionDataEncoder() {
|
|
503
|
+
return kit.transformEncoder(
|
|
504
|
+
kit.getStructEncoder([
|
|
505
|
+
["discriminator", kit.getU32Encoder()],
|
|
506
|
+
["lamports", kit.getU64Encoder()],
|
|
507
|
+
["space", kit.getU64Encoder()],
|
|
508
|
+
["programAddress", kit.getAddressEncoder()]
|
|
509
|
+
]),
|
|
510
|
+
(value) => ({
|
|
511
|
+
...value,
|
|
512
|
+
discriminator: CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR,
|
|
513
|
+
lamports: value.lamports ?? 0
|
|
514
|
+
})
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function getCreateAccountAllowPrefundInstructionDataDecoder() {
|
|
518
|
+
return kit.getStructDecoder([
|
|
519
|
+
["discriminator", kit.getU32Decoder()],
|
|
520
|
+
["lamports", kit.getU64Decoder()],
|
|
521
|
+
["space", kit.getU64Decoder()],
|
|
522
|
+
["programAddress", kit.getAddressDecoder()]
|
|
523
|
+
]);
|
|
524
|
+
}
|
|
525
|
+
function getCreateAccountAllowPrefundInstructionDataCodec() {
|
|
526
|
+
return kit.combineCodec(
|
|
527
|
+
getCreateAccountAllowPrefundInstructionDataEncoder(),
|
|
528
|
+
getCreateAccountAllowPrefundInstructionDataDecoder()
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
function getCreateAccountAllowPrefundInstruction(input, config) {
|
|
532
|
+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
533
|
+
const originalAccounts = {
|
|
534
|
+
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
535
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
536
|
+
};
|
|
537
|
+
const accounts = originalAccounts;
|
|
538
|
+
const args = { ...input };
|
|
539
|
+
const byteDelta = [Number(args.space) + kit.BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
|
|
540
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
|
|
541
|
+
return Object.freeze({
|
|
542
|
+
accounts: [getAccountMeta("newAccount", accounts.newAccount), getAccountMeta("payer", accounts.payer)].filter(
|
|
543
|
+
(x) => x !== void 0
|
|
544
|
+
),
|
|
545
|
+
byteDelta,
|
|
546
|
+
data: getCreateAccountAllowPrefundInstructionDataEncoder().encode(
|
|
547
|
+
args
|
|
548
|
+
),
|
|
549
|
+
programAddress
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function parseCreateAccountAllowPrefundInstruction(instruction) {
|
|
553
|
+
if (instruction.accounts.length < 1) {
|
|
554
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
555
|
+
actualAccountMetas: instruction.accounts.length,
|
|
556
|
+
expectedAccountMetas: 1
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
let accountIndex = 0;
|
|
560
|
+
const getNextAccount = () => {
|
|
561
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
562
|
+
accountIndex += 1;
|
|
563
|
+
return accountMeta;
|
|
564
|
+
};
|
|
565
|
+
let optionalAccountsRemaining = instruction.accounts.length - 1;
|
|
566
|
+
const getNextOptionalAccount = () => {
|
|
567
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
568
|
+
optionalAccountsRemaining -= 1;
|
|
569
|
+
return getNextAccount();
|
|
570
|
+
};
|
|
571
|
+
return {
|
|
572
|
+
programAddress: instruction.programAddress,
|
|
573
|
+
accounts: { newAccount: getNextAccount(), payer: getNextOptionalAccount() },
|
|
574
|
+
data: getCreateAccountAllowPrefundInstructionDataDecoder().decode(instruction.data)
|
|
575
|
+
};
|
|
576
|
+
}
|
|
498
577
|
var CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR = 3;
|
|
499
578
|
function getCreateAccountWithSeedDiscriminatorBytes() {
|
|
500
579
|
return kit.getU32Encoder().encode(CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR);
|
|
@@ -917,6 +996,7 @@ var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
|
|
|
917
996
|
SystemInstruction2[SystemInstruction2["AssignWithSeed"] = 10] = "AssignWithSeed";
|
|
918
997
|
SystemInstruction2[SystemInstruction2["TransferSolWithSeed"] = 11] = "TransferSolWithSeed";
|
|
919
998
|
SystemInstruction2[SystemInstruction2["UpgradeNonceAccount"] = 12] = "UpgradeNonceAccount";
|
|
999
|
+
SystemInstruction2[SystemInstruction2["CreateAccountAllowPrefund"] = 13] = "CreateAccountAllowPrefund";
|
|
920
1000
|
return SystemInstruction2;
|
|
921
1001
|
})(SystemInstruction || {});
|
|
922
1002
|
function identifySystemInstruction(instruction) {
|
|
@@ -960,6 +1040,9 @@ function identifySystemInstruction(instruction) {
|
|
|
960
1040
|
if (kit.containsBytes(data, kit.getU32Encoder().encode(12), 0)) {
|
|
961
1041
|
return 12 /* UpgradeNonceAccount */;
|
|
962
1042
|
}
|
|
1043
|
+
if (kit.containsBytes(data, kit.getU32Encoder().encode(13), 0)) {
|
|
1044
|
+
return 13 /* CreateAccountAllowPrefund */;
|
|
1045
|
+
}
|
|
963
1046
|
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
964
1047
|
instructionData: data,
|
|
965
1048
|
programName: "system"
|
|
@@ -1047,6 +1130,13 @@ function parseSystemInstruction(instruction) {
|
|
|
1047
1130
|
...parseUpgradeNonceAccountInstruction(instruction)
|
|
1048
1131
|
};
|
|
1049
1132
|
}
|
|
1133
|
+
case 13 /* CreateAccountAllowPrefund */: {
|
|
1134
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
1135
|
+
return {
|
|
1136
|
+
instructionType: 13 /* CreateAccountAllowPrefund */,
|
|
1137
|
+
...parseCreateAccountAllowPrefundInstruction(instruction)
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1050
1140
|
default:
|
|
1051
1141
|
throw new kit.SolanaError(kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
1052
1142
|
instructionType,
|
|
@@ -1078,7 +1168,8 @@ function systemProgram() {
|
|
|
1078
1168
|
allocateWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAllocateWithSeedInstruction(input)),
|
|
1079
1169
|
assignWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAssignWithSeedInstruction(input)),
|
|
1080
1170
|
transferSolWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getTransferSolWithSeedInstruction(input)),
|
|
1081
|
-
upgradeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getUpgradeNonceAccountInstruction(input))
|
|
1171
|
+
upgradeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getUpgradeNonceAccountInstruction(input)),
|
|
1172
|
+
createAccountAllowPrefund: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getCreateAccountAllowPrefundInstruction(input))
|
|
1082
1173
|
}
|
|
1083
1174
|
}
|
|
1084
1175
|
});
|
|
@@ -1125,6 +1216,7 @@ exports.ALLOCATE_WITH_SEED_DISCRIMINATOR = ALLOCATE_WITH_SEED_DISCRIMINATOR;
|
|
|
1125
1216
|
exports.ASSIGN_DISCRIMINATOR = ASSIGN_DISCRIMINATOR;
|
|
1126
1217
|
exports.ASSIGN_WITH_SEED_DISCRIMINATOR = ASSIGN_WITH_SEED_DISCRIMINATOR;
|
|
1127
1218
|
exports.AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR = AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR;
|
|
1219
|
+
exports.CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR = CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR;
|
|
1128
1220
|
exports.CREATE_ACCOUNT_DISCRIMINATOR = CREATE_ACCOUNT_DISCRIMINATOR;
|
|
1129
1221
|
exports.CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR = CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR;
|
|
1130
1222
|
exports.INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR = INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR;
|
|
@@ -1181,6 +1273,11 @@ exports.getAuthorizeNonceAccountInstruction = getAuthorizeNonceAccountInstructio
|
|
|
1181
1273
|
exports.getAuthorizeNonceAccountInstructionDataCodec = getAuthorizeNonceAccountInstructionDataCodec;
|
|
1182
1274
|
exports.getAuthorizeNonceAccountInstructionDataDecoder = getAuthorizeNonceAccountInstructionDataDecoder;
|
|
1183
1275
|
exports.getAuthorizeNonceAccountInstructionDataEncoder = getAuthorizeNonceAccountInstructionDataEncoder;
|
|
1276
|
+
exports.getCreateAccountAllowPrefundDiscriminatorBytes = getCreateAccountAllowPrefundDiscriminatorBytes;
|
|
1277
|
+
exports.getCreateAccountAllowPrefundInstruction = getCreateAccountAllowPrefundInstruction;
|
|
1278
|
+
exports.getCreateAccountAllowPrefundInstructionDataCodec = getCreateAccountAllowPrefundInstructionDataCodec;
|
|
1279
|
+
exports.getCreateAccountAllowPrefundInstructionDataDecoder = getCreateAccountAllowPrefundInstructionDataDecoder;
|
|
1280
|
+
exports.getCreateAccountAllowPrefundInstructionDataEncoder = getCreateAccountAllowPrefundInstructionDataEncoder;
|
|
1184
1281
|
exports.getCreateAccountDiscriminatorBytes = getCreateAccountDiscriminatorBytes;
|
|
1185
1282
|
exports.getCreateAccountInstruction = getCreateAccountInstruction;
|
|
1186
1283
|
exports.getCreateAccountInstructionDataCodec = getCreateAccountInstructionDataCodec;
|
|
@@ -1235,6 +1332,7 @@ exports.parseAllocateWithSeedInstruction = parseAllocateWithSeedInstruction;
|
|
|
1235
1332
|
exports.parseAssignInstruction = parseAssignInstruction;
|
|
1236
1333
|
exports.parseAssignWithSeedInstruction = parseAssignWithSeedInstruction;
|
|
1237
1334
|
exports.parseAuthorizeNonceAccountInstruction = parseAuthorizeNonceAccountInstruction;
|
|
1335
|
+
exports.parseCreateAccountAllowPrefundInstruction = parseCreateAccountAllowPrefundInstruction;
|
|
1238
1336
|
exports.parseCreateAccountInstruction = parseCreateAccountInstruction;
|
|
1239
1337
|
exports.parseCreateAccountWithSeedInstruction = parseCreateAccountWithSeedInstruction;
|
|
1240
1338
|
exports.parseInitializeNonceAccountInstruction = parseInitializeNonceAccountInstruction;
|