@solana/web3.js 2.0.0-experimental.c2d0ddc → 2.0.0-experimental.c5061ae
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/index.development.js +73 -56
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +26 -24
- package/package.json +7 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/rpc-default-config.d.ts.map +0 -1
- package/dist/types/rpc-integer-overflow-error.d.ts.map +0 -1
- package/dist/types/rpc-request-coalescer.d.ts.map +0 -1
- package/dist/types/rpc-request-deduplication.d.ts.map +0 -1
- package/dist/types/rpc-transport.d.ts.map +0 -1
- package/dist/types/rpc.d.ts.map +0 -1
|
@@ -815,6 +815,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
815
815
|
|
|
816
816
|
// ../transactions/dist/index.browser.js
|
|
817
817
|
init_env_shim();
|
|
818
|
+
function getUnsignedTransaction(transaction) {
|
|
819
|
+
if ("signatures" in transaction) {
|
|
820
|
+
const {
|
|
821
|
+
signatures: _,
|
|
822
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
823
|
+
...unsignedTransaction
|
|
824
|
+
} = transaction;
|
|
825
|
+
return unsignedTransaction;
|
|
826
|
+
} else {
|
|
827
|
+
return transaction;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
818
830
|
function assertIsBlockhash(putativeBlockhash) {
|
|
819
831
|
try {
|
|
820
832
|
if (
|
|
@@ -835,6 +847,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
835
847
|
});
|
|
836
848
|
}
|
|
837
849
|
}
|
|
850
|
+
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
851
|
+
if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
|
|
852
|
+
return transaction;
|
|
853
|
+
}
|
|
854
|
+
const out = {
|
|
855
|
+
...getUnsignedTransaction(transaction),
|
|
856
|
+
lifetimeConstraint: blockhashLifetimeConstraint
|
|
857
|
+
};
|
|
858
|
+
Object.freeze(out);
|
|
859
|
+
return out;
|
|
860
|
+
}
|
|
838
861
|
function createTransaction({
|
|
839
862
|
version
|
|
840
863
|
}) {
|
|
@@ -845,62 +868,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
845
868
|
Object.freeze(out);
|
|
846
869
|
return out;
|
|
847
870
|
}
|
|
848
|
-
function setTransactionFeePayer(feePayer, transaction) {
|
|
849
|
-
if ("feePayer" in transaction && feePayer === transaction.feePayer) {
|
|
850
|
-
return transaction;
|
|
851
|
-
}
|
|
852
|
-
let out;
|
|
853
|
-
if ("signatures" in transaction) {
|
|
854
|
-
const {
|
|
855
|
-
signatures: _,
|
|
856
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
857
|
-
...unsignedTransaction
|
|
858
|
-
} = transaction;
|
|
859
|
-
out = {
|
|
860
|
-
...unsignedTransaction,
|
|
861
|
-
feePayer
|
|
862
|
-
};
|
|
863
|
-
} else {
|
|
864
|
-
out = {
|
|
865
|
-
...transaction,
|
|
866
|
-
feePayer
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
Object.freeze(out);
|
|
870
|
-
return out;
|
|
871
|
-
}
|
|
872
|
-
function replaceInstructions(transaction, nextInstructions) {
|
|
873
|
-
let out;
|
|
874
|
-
if ("signatures" in transaction) {
|
|
875
|
-
const {
|
|
876
|
-
signatures: _,
|
|
877
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
878
|
-
...unsignedTransaction
|
|
879
|
-
} = transaction;
|
|
880
|
-
out = {
|
|
881
|
-
...unsignedTransaction,
|
|
882
|
-
instructions: nextInstructions
|
|
883
|
-
};
|
|
884
|
-
} else {
|
|
885
|
-
out = {
|
|
886
|
-
...transaction,
|
|
887
|
-
instructions: nextInstructions
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
return out;
|
|
891
|
-
}
|
|
892
|
-
function appendTransactionInstruction(instruction, transaction) {
|
|
893
|
-
const nextInstructions = [...transaction.instructions, instruction];
|
|
894
|
-
const out = replaceInstructions(transaction, nextInstructions);
|
|
895
|
-
Object.freeze(out);
|
|
896
|
-
return out;
|
|
897
|
-
}
|
|
898
|
-
function prependTransactionInstruction(instruction, transaction) {
|
|
899
|
-
const nextInstructions = [instruction, ...transaction.instructions];
|
|
900
|
-
const out = replaceInstructions(transaction, nextInstructions);
|
|
901
|
-
Object.freeze(out);
|
|
902
|
-
return out;
|
|
903
|
-
}
|
|
904
871
|
var AccountRole2 = /* @__PURE__ */ ((AccountRole22) => {
|
|
905
872
|
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
906
873
|
3] = "WRITABLE_SIGNER";
|
|
@@ -922,6 +889,54 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
922
889
|
function mergeRoles2(roleA, roleB) {
|
|
923
890
|
return roleA | roleB;
|
|
924
891
|
}
|
|
892
|
+
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
|
|
893
|
+
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
894
|
+
function assertIsDurableNonceTransaction(transaction) {
|
|
895
|
+
if (!isDurableNonceTransaction(transaction)) {
|
|
896
|
+
throw new Error("Transaction is not a durable nonce transaction");
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function isAdvanceNonceAccountInstruction(instruction) {
|
|
900
|
+
return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
|
|
901
|
+
instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
|
|
902
|
+
instruction.accounts?.length === 3 && // First account is nonce account address
|
|
903
|
+
instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole2.WRITABLE && // Second account is recent blockhashes sysvar
|
|
904
|
+
instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole2.READONLY && // Third account is nonce authority account
|
|
905
|
+
instruction.accounts[2].address != null && instruction.accounts[2].role === AccountRole2.READONLY_SIGNER;
|
|
906
|
+
}
|
|
907
|
+
function isAdvanceNonceAccountInstructionData(data) {
|
|
908
|
+
return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
|
|
909
|
+
}
|
|
910
|
+
function isDurableNonceTransaction(transaction) {
|
|
911
|
+
return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
|
|
912
|
+
}
|
|
913
|
+
function setTransactionFeePayer(feePayer, transaction) {
|
|
914
|
+
if ("feePayer" in transaction && feePayer === transaction.feePayer) {
|
|
915
|
+
return transaction;
|
|
916
|
+
}
|
|
917
|
+
const out = {
|
|
918
|
+
...getUnsignedTransaction(transaction),
|
|
919
|
+
feePayer
|
|
920
|
+
};
|
|
921
|
+
Object.freeze(out);
|
|
922
|
+
return out;
|
|
923
|
+
}
|
|
924
|
+
function appendTransactionInstruction(instruction, transaction) {
|
|
925
|
+
const out = {
|
|
926
|
+
...getUnsignedTransaction(transaction),
|
|
927
|
+
instructions: [...transaction.instructions, instruction]
|
|
928
|
+
};
|
|
929
|
+
Object.freeze(out);
|
|
930
|
+
return out;
|
|
931
|
+
}
|
|
932
|
+
function prependTransactionInstruction(instruction, transaction) {
|
|
933
|
+
const out = {
|
|
934
|
+
...getUnsignedTransaction(transaction),
|
|
935
|
+
instructions: [instruction, ...transaction.instructions]
|
|
936
|
+
};
|
|
937
|
+
Object.freeze(out);
|
|
938
|
+
return out;
|
|
939
|
+
}
|
|
925
940
|
function upsert(addressMap, address, update) {
|
|
926
941
|
addressMap[address] = update(addressMap[address] ?? { role: AccountRole2.READONLY });
|
|
927
942
|
}
|
|
@@ -1955,6 +1970,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1955
1970
|
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
1956
1971
|
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
|
|
1957
1972
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
1973
|
+
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
1958
1974
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
1959
1975
|
exports.createSolanaRpc = createSolanaRpc;
|
|
1960
1976
|
exports.createTransaction = createTransaction;
|
|
@@ -1970,6 +1986,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1970
1986
|
exports.mergeRoles = mergeRoles;
|
|
1971
1987
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
1972
1988
|
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
1989
|
+
exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
|
|
1973
1990
|
exports.signBytes = signBytes;
|
|
1974
1991
|
exports.signTransaction = signTransaction;
|
|
1975
1992
|
exports.upgradeRoleToSigner = upgradeRoleToSigner;
|