@streamflow/common 8.0.0-alpha.p287.84ff30f → 8.0.1-alpha.p287.54fe41f
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +92 -57
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +96 -19
- package/dist/cjs/solana/rpc/index.cjs +40 -20
- package/dist/cjs/solana/rpc/index.cjs.map +1 -1
- package/dist/cjs/solana/rpc/index.d.cts +77 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +96 -19
- package/dist/esm/solana/index.js +93 -60
- package/dist/esm/solana/index.js.map +1 -1
- package/dist/esm/solana/rpc/index.d.ts +77 -4
- package/dist/esm/solana/rpc/index.js +40 -21
- package/dist/esm/solana/rpc/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/types-DGCX8JLm.d.cts +0 -73
- package/dist/esm/types-DGCX8JLm.d.ts +0 -73
package/dist/cjs/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ var ContractError = class _ContractError extends Error {
|
|
|
31
31
|
* @param code extracted code from the error if managed to parse it
|
|
32
32
|
*/
|
|
33
33
|
constructor(error, code, description) {
|
|
34
|
-
super(error.message);
|
|
34
|
+
super(error.message, { cause: error });
|
|
35
35
|
this.contractErrorCode = code ?? null;
|
|
36
36
|
this.description = description ?? null;
|
|
37
37
|
Object.setPrototypeOf(this, _ContractError.prototype);
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../types.ts","../../lib/assertions.ts","../../lib/utils.ts"],"names":["ICluster","IChain","BN"],"mappings":";;;;;;;;;;AAQY,IAAA,QAAA,qBAAAA,SAAL,KAAA;AACL,EAAAA,UAAA,SAAU,CAAA,GAAA,SAAA;AACV,E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W,CAAA,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD;AAEO,IAAM,QAAW,GAAA,CAAC,CAAW,EAAA,CAAA,KAAsB,CAAI,GAAA,CAAA,IAAK,CAAI,GAAA,CAAA,GAAI,MAAO,CAAA,CAAC,CAAI,GAAA,MAAA,CAAO,CAAC,CAAA","file":"index.cjs","sourcesContent":["import { type TransactionInstruction } from \"@solana/web3.js\";\n\nexport interface ITransactionResult {\n ixs: TransactionInstruction[];\n txId: string;\n}\n\n// Utility types\nexport enum ICluster {\n Mainnet = \"mainnet\",\n Devnet = \"devnet\",\n Testnet = \"testnet\",\n Local = \"local\",\n}\n\nexport enum IChain {\n Solana = \"Solana\",\n Aptos = \"Aptos\",\n Ethereum = \"Ethereum\",\n BNB = \"BNB\",\n Polygon = \"Polygon\",\n Sui = \"Sui\",\n}\n\n/**\n * Error wrapper for calls made to the contract on chain\n */\nexport class ContractError extends Error {\n public contractErrorCode: string | null;\n\n public description: string | null;\n\n /**\n * Constructs the Error Wrapper\n * @param error Original error raised probably by the chain SDK\n * @param code extracted code from the error if managed to parse it\n */\n constructor(error: Error, code?: string | null, description?: string | null) {\n super(error.message, { cause: error }); // Call the base class constructor with the error message\n this.contractErrorCode = code ?? null;\n this.description = description ?? null;\n // Copy properties from the original error\n Object.setPrototypeOf(this, ContractError.prototype);\n this.name = \"ContractError\"; // Set the name property\n this.stack = error.stack;\n }\n}\n","const prefix = \"Assertion failed\";\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const invariant: (condition: any, message?: string | (() => string)) => asserts condition = (\n condition,\n message,\n) => {\n if (condition) {\n return;\n }\n const provided: string | undefined = typeof message === \"function\" ? message() : message;\n const value: string = provided ? `${prefix}: ${provided}` : prefix;\n throw new Error(value);\n};\n","import BN from \"bn.js\";\n\nimport { ContractError } from \"../types.js\";\n\n/**\n * Used for conversion of token amounts to their Big Number representation.\n * Get Big Number representation in the smallest units from the same value in the highest units.\n * @param {number} value - Number of tokens you want to convert to its BN representation.\n * @param {number} decimals - Number of decimals the token has.\n */\nexport const getBN = (value: number, decimals: number): BN => {\n const decimalPart = value - Math.trunc(value);\n const integerPart = new BN(Math.trunc(value));\n\n const decimalE = new BN(decimalPart * 1e9);\n\n const sum = integerPart.mul(new BN(1e9)).add(decimalE);\n const resultE = sum.mul(new BN(10).pow(new BN(decimals)));\n return resultE.div(new BN(1e9));\n};\n\n/**\n * Used for token amounts conversion from their Big Number representation to number.\n * Get value in the highest units from BN representation of the same value in the smallest units.\n * @param {BN} value - Big Number representation of value in the smallest units.\n * @param {number} decimals - Number of decimals the token has.\n */\nexport const getNumberFromBN = (value: BN, decimals: number): number =>\n value.gt(new BN(2 ** 53 - 1)) ? value.div(new BN(10 ** decimals)).toNumber() : value.toNumber() / 10 ** decimals;\n\n/**\n * Used to make on chain calls to the contract and wrap raised errors if any\n * @param func function that interacts with the contract\n * @param callback callback that may be used to extract error code\n * @returns {T}\n */\nexport async function handleContractError<T>(\n func: () => Promise<T>,\n callback?: (err: Error) => string | null,\n): Promise<T> {\n try {\n return await func();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n if (err instanceof Error) {\n if (callback) {\n throw new ContractError(err, callback(err));\n }\n throw new ContractError(err);\n }\n throw err;\n }\n}\n\n/**\n * Pause async function execution for given amount of milliseconds\n * @param ms millisecond to sleep for\n */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport const divCeilN = (n: bigint, d: bigint): bigint => n / d + (n % d ? BigInt(1) : BigInt(0));\n"]}
|
|
@@ -245,9 +245,6 @@ var prepareWrappedAccount = async (connection, senderAddress, amount) => {
|
|
|
245
245
|
splToken.createSyncNativeInstruction(tokenAccount)
|
|
246
246
|
];
|
|
247
247
|
};
|
|
248
|
-
var pk = (address) => {
|
|
249
|
-
return typeof address === "string" ? new web3_js.PublicKey(address) : address;
|
|
250
|
-
};
|
|
251
248
|
|
|
252
249
|
// solana/types.ts
|
|
253
250
|
var TransactionFailedError = class _TransactionFailedError extends Error {
|
|
@@ -789,16 +786,18 @@ async function signTransaction(invoker, tx) {
|
|
|
789
786
|
}
|
|
790
787
|
return signedTx;
|
|
791
788
|
}
|
|
792
|
-
async function signAndExecuteTransaction(connection, invoker, tx, confirmationParams,
|
|
789
|
+
async function signAndExecuteTransaction(connection, invoker, tx, confirmationParams, transactionExecutionParams) {
|
|
793
790
|
const signedTx = await signTransaction(invoker, tx);
|
|
794
|
-
return executeTransaction(connection, signedTx, confirmationParams,
|
|
791
|
+
return executeTransaction(connection, signedTx, confirmationParams, transactionExecutionParams);
|
|
795
792
|
}
|
|
796
|
-
async function executeTransaction(connection, tx, confirmationParams,
|
|
793
|
+
async function executeTransaction(connection, tx, confirmationParams, transactionExecutionParams) {
|
|
797
794
|
if (tx.signatures.length === 0) {
|
|
798
795
|
throw Error("Error with transaction parameters.");
|
|
799
796
|
}
|
|
800
|
-
|
|
801
|
-
|
|
797
|
+
if (!transactionExecutionParams.skipSimulation) {
|
|
798
|
+
await simulateTransaction(connection, tx);
|
|
799
|
+
}
|
|
800
|
+
return sendAndConfirmTransaction(connection, tx, confirmationParams, transactionExecutionParams);
|
|
802
801
|
}
|
|
803
802
|
async function executeMultipleTransactions(connection, txs, confirmationParams, { sendRate = 1, sendThrottler, ...throttlingParams }) {
|
|
804
803
|
if (!sendThrottler) {
|
|
@@ -995,10 +994,10 @@ async function checkOrCreateAtaBatch(connection, owners, mint, invoker, programI
|
|
|
995
994
|
}
|
|
996
995
|
function prepareBaseInstructions(connection, { computePrice, computeLimit }) {
|
|
997
996
|
const ixs = [];
|
|
998
|
-
if (computePrice && typeof computePrice
|
|
997
|
+
if (computePrice && typeof computePrice !== "function") {
|
|
999
998
|
ixs.push(web3_js.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: computePrice }));
|
|
1000
999
|
}
|
|
1001
|
-
if (computeLimit) {
|
|
1000
|
+
if (computeLimit && typeof computeLimit === "number") {
|
|
1002
1001
|
ixs.push(web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: computeLimit }));
|
|
1003
1002
|
}
|
|
1004
1003
|
return ixs;
|
|
@@ -1024,68 +1023,102 @@ async function getMultipleAccountsInfoBatched(connection, pubKeys, commitment) {
|
|
|
1024
1023
|
const results = await Promise.all(batches);
|
|
1025
1024
|
return results.flat();
|
|
1026
1025
|
}
|
|
1026
|
+
function deserializeRawTransaction(serializedTx) {
|
|
1027
|
+
const txBuffer = buffer.Buffer.from(serializedTx, "base64");
|
|
1028
|
+
try {
|
|
1029
|
+
const tx = web3_js.Transaction.from(txBuffer);
|
|
1030
|
+
return resolveTransactionAccounts(tx);
|
|
1031
|
+
} catch (error) {
|
|
1032
|
+
try {
|
|
1033
|
+
const vtx = web3_js.VersionedTransaction.deserialize(txBuffer);
|
|
1034
|
+
return resolveTransactionAccounts(vtx);
|
|
1035
|
+
} catch (vError) {
|
|
1036
|
+
throw new Error("Failed to deserialize transaction: " + (vError instanceof Error ? vError.message : vError), {
|
|
1037
|
+
cause: vError
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
var resolveTransactionAccounts = (tx) => {
|
|
1043
|
+
if (tx instanceof web3_js.Transaction) {
|
|
1044
|
+
const message2 = tx.compileMessage();
|
|
1045
|
+
const accounts2 = message2.accountKeys;
|
|
1046
|
+
const writableAccounts2 = accounts2.filter((_, idx) => message2.isAccountWritable(idx));
|
|
1047
|
+
return {
|
|
1048
|
+
type: "legacy",
|
|
1049
|
+
transaction: tx,
|
|
1050
|
+
accounts: accounts2,
|
|
1051
|
+
writableAccounts: writableAccounts2
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
const message = tx.message;
|
|
1055
|
+
const accounts = "staticAccountKeys" in message ? message.staticAccountKeys : message.accountKeys;
|
|
1056
|
+
const writableAccounts = accounts.filter((_, idx) => message.isAccountWritable(idx));
|
|
1057
|
+
return {
|
|
1058
|
+
type: "versioned",
|
|
1059
|
+
transaction: tx,
|
|
1060
|
+
accounts,
|
|
1061
|
+
writableAccounts
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
var pk = (address) => {
|
|
1065
|
+
return typeof address === "string" ? new web3_js.PublicKey(address) : address;
|
|
1066
|
+
};
|
|
1027
1067
|
|
|
1028
1068
|
// solana/lib/estimate.ts
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
partialSigners
|
|
1035
|
-
);
|
|
1036
|
-
return estimate(Buffer.from(tx.serialize()).toString("base64"));
|
|
1069
|
+
var createTestTransaction = (ixs, payer, recentBlockhash, partialSigners) => {
|
|
1070
|
+
return createVersionedTransaction(ixs, payer, "11111111111111111111111111111111", partialSigners);
|
|
1071
|
+
};
|
|
1072
|
+
async function estimateComputeUnitPrice(estimate, testTx) {
|
|
1073
|
+
return estimate(resolveTransactionAccounts(testTx).writableAccounts);
|
|
1037
1074
|
}
|
|
1038
1075
|
async function createAndEstimateTransaction(createFn, extParams, select) {
|
|
1039
1076
|
select = select ?? ((value) => value);
|
|
1040
1077
|
const createResult = await createFn(extParams);
|
|
1041
1078
|
const prepareIxs = select(createResult);
|
|
1042
|
-
const
|
|
1043
|
-
if (priorityFee === void 0 || typeof priorityFee === "number") {
|
|
1044
|
-
return createResult;
|
|
1045
|
-
}
|
|
1079
|
+
const { computePrice, computeLimit } = extParams;
|
|
1046
1080
|
const invoker = extParams.invoker.publicKey;
|
|
1047
1081
|
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1048
|
-
const
|
|
1082
|
+
const testTx = createTestTransaction(prepareIxs, pk(invoker), void 0, void 0);
|
|
1083
|
+
const estimatedComputeLimit = typeof computeLimit === "function" ? await computeLimit(testTx) : computeLimit;
|
|
1084
|
+
if (typeof computePrice !== "function") {
|
|
1085
|
+
if (typeof computeLimit !== "function") {
|
|
1086
|
+
return createResult;
|
|
1087
|
+
}
|
|
1088
|
+
return createFn({
|
|
1089
|
+
...extParams,
|
|
1090
|
+
computeLimit: estimatedComputeLimit
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
const estimatedComputeUnitPrice = typeof computePrice === "function" ? await estimateComputeUnitPrice(computePrice, testTx) : (
|
|
1049
1094
|
// unachievable because we don't execute estimation for constant or undefined priority fee
|
|
1050
|
-
|
|
1095
|
+
computePrice
|
|
1051
1096
|
);
|
|
1052
1097
|
return createFn({
|
|
1053
1098
|
...extParams,
|
|
1054
|
-
computePrice: estimatedComputeUnitPrice
|
|
1099
|
+
computePrice: estimatedComputeUnitPrice,
|
|
1100
|
+
computeLimit: estimatedComputeLimit
|
|
1055
1101
|
});
|
|
1056
1102
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
return {
|
|
1077
|
-
type: "versioned",
|
|
1078
|
-
transaction: vtx,
|
|
1079
|
-
accounts,
|
|
1080
|
-
writableAccounts
|
|
1081
|
-
};
|
|
1082
|
-
} catch (vError) {
|
|
1083
|
-
throw new Error("Failed to deserialize transaction: " + (vError instanceof Error ? vError.message : vError), {
|
|
1084
|
-
cause: vError
|
|
1085
|
-
});
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1103
|
+
|
|
1104
|
+
// solana/rpc/consume-limit-estimate/estimate.ts
|
|
1105
|
+
var estimateConsumeLimit = async (connection, tx, options = {}) => {
|
|
1106
|
+
const { multiplierPercent = 0.05 } = options;
|
|
1107
|
+
const simulationResults = await connection.simulateTransaction(tx, {
|
|
1108
|
+
sigVerify: false,
|
|
1109
|
+
replaceRecentBlockhash: true
|
|
1110
|
+
});
|
|
1111
|
+
return {
|
|
1112
|
+
unitsConsumed: simulationResults.value.unitsConsumed ? Math.ceil(simulationResults.value.unitsConsumed * (1 + multiplierPercent)) : simulationResults.value.unitsConsumed,
|
|
1113
|
+
data: simulationResults
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
// solana/lib/unwrap-auto-simulate-ext.ts
|
|
1118
|
+
var unwrapExecutionParams = ({ computeLimit, ...rest }, connection) => {
|
|
1119
|
+
const consumeLimitFn = computeLimit === "autoSimulate" ? (tx) => estimateConsumeLimit(connection, tx).then((limit) => limit.unitsConsumed ?? 0) : computeLimit;
|
|
1120
|
+
return { ...rest, computeLimit: consumeLimitFn, skipSimulation: computeLimit === "autoSimulate" };
|
|
1121
|
+
};
|
|
1089
1122
|
|
|
1090
1123
|
exports.TransactionFailedError = TransactionFailedError;
|
|
1091
1124
|
exports.ata = ata;
|
|
@@ -1113,9 +1146,11 @@ exports.pk = pk;
|
|
|
1113
1146
|
exports.prepareBaseInstructions = prepareBaseInstructions;
|
|
1114
1147
|
exports.prepareTransaction = prepareTransaction;
|
|
1115
1148
|
exports.prepareWrappedAccount = prepareWrappedAccount;
|
|
1149
|
+
exports.resolveTransactionAccounts = resolveTransactionAccounts;
|
|
1116
1150
|
exports.sendAndConfirmTransaction = sendAndConfirmTransaction;
|
|
1117
1151
|
exports.signAndExecuteTransaction = signAndExecuteTransaction;
|
|
1118
1152
|
exports.signTransaction = signTransaction;
|
|
1119
1153
|
exports.simulateTransaction = simulateTransaction;
|
|
1154
|
+
exports.unwrapExecutionParams = unwrapExecutionParams;
|
|
1120
1155
|
//# sourceMappingURL=index.cjs.map
|
|
1121
1156
|
//# sourceMappingURL=index.cjs.map
|