@medialane/sdk 0.101.0 → 0.102.0
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.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +59 -0
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +17 -2
- package/dist/starknet/index.d.ts +17 -2
- package/dist/starknet/index.js +56 -1
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -851,6 +851,9 @@ SN.creatorCoinEkuboLauncher;
|
|
|
851
851
|
SN.creatorCoinClassHash;
|
|
852
852
|
SN.creatorCoinFactoryClassHash;
|
|
853
853
|
SN.creatorCoinStartBlock;
|
|
854
|
+
SN.genesisMintLaunch;
|
|
855
|
+
SN.genesisMintBR;
|
|
856
|
+
SN.genesisMintGlobal;
|
|
854
857
|
SN.ekuboCore;
|
|
855
858
|
var SUPPORTED_TOKENS = [
|
|
856
859
|
{
|
|
@@ -11548,6 +11551,58 @@ async function requestSiwsToken({
|
|
|
11548
11551
|
return token;
|
|
11549
11552
|
}
|
|
11550
11553
|
|
|
11554
|
+
// src/starknet/services/executeIntent.ts
|
|
11555
|
+
async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
11556
|
+
await client.api.confirmIntent(intentId, txHash).catch(() => {
|
|
11557
|
+
});
|
|
11558
|
+
}
|
|
11559
|
+
var RECEIPT_RETRY_DELAYS_MS = [0, 3e3, 5e3, 7e3, 1e4];
|
|
11560
|
+
async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECEIPT_RETRY_DELAYS_MS) {
|
|
11561
|
+
for (let attempt = 0; attempt < retryDelaysMs.length; attempt++) {
|
|
11562
|
+
const delay = retryDelaysMs[attempt];
|
|
11563
|
+
if (delay) await new Promise((r) => setTimeout(r, delay));
|
|
11564
|
+
try {
|
|
11565
|
+
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11566
|
+
const status = receipt.execution_status ?? receipt.status;
|
|
11567
|
+
if (status === "REVERTED" || status === "REJECTED") {
|
|
11568
|
+
throw new Error("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11569
|
+
}
|
|
11570
|
+
if (status) return;
|
|
11571
|
+
} catch (err) {
|
|
11572
|
+
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11573
|
+
}
|
|
11574
|
+
}
|
|
11575
|
+
throw new Error("Verification timed out. Check your account for the transaction status.");
|
|
11576
|
+
}
|
|
11577
|
+
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
11578
|
+
let calls;
|
|
11579
|
+
if (intent.requiresSignature) {
|
|
11580
|
+
const signature = await signer.signTypedData(intent.typedData);
|
|
11581
|
+
const signed = await client.api.submitIntentSignature(intent.id, signature);
|
|
11582
|
+
calls = signed.data.calls;
|
|
11583
|
+
} else {
|
|
11584
|
+
calls = intent.calls;
|
|
11585
|
+
}
|
|
11586
|
+
const { txHash } = await signer.execute(calls);
|
|
11587
|
+
await assertTransactionSucceeded(provider, txHash);
|
|
11588
|
+
if (opts.confirm !== false) {
|
|
11589
|
+
await confirmIntentBestEffort(client, intent.id, txHash);
|
|
11590
|
+
}
|
|
11591
|
+
return { txHash };
|
|
11592
|
+
}
|
|
11593
|
+
async function executeIntents(provider, signer, client, intents, opts = {}) {
|
|
11594
|
+
if (intents.some((i) => i.requiresSignature)) {
|
|
11595
|
+
throw new Error("Expected prebuilt intents (requiresSignature=false)");
|
|
11596
|
+
}
|
|
11597
|
+
const calls = intents.flatMap((i) => i.calls);
|
|
11598
|
+
const { txHash } = await signer.execute(calls);
|
|
11599
|
+
await assertTransactionSucceeded(provider, txHash);
|
|
11600
|
+
if (opts.confirm !== false) {
|
|
11601
|
+
await Promise.all(intents.map((i) => confirmIntentBestEffort(client, i.id, txHash)));
|
|
11602
|
+
}
|
|
11603
|
+
return { txHash };
|
|
11604
|
+
}
|
|
11605
|
+
|
|
11551
11606
|
// src/starknet/services/sponsoredExecutor.ts
|
|
11552
11607
|
var SponsoredCallRejectedError = class extends Error {
|
|
11553
11608
|
};
|
|
@@ -11794,6 +11849,7 @@ exports.StarknetVenue = StarknetVenue;
|
|
|
11794
11849
|
exports.TicketService = TicketService;
|
|
11795
11850
|
exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
|
|
11796
11851
|
exports.adminRequestDigest = adminRequestDigest;
|
|
11852
|
+
exports.assertTransactionSucceeded = assertTransactionSucceeded;
|
|
11797
11853
|
exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
11798
11854
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|
|
11799
11855
|
exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
|
|
@@ -11812,6 +11868,7 @@ exports.buybackQuoteRaw = buybackQuoteRaw;
|
|
|
11812
11868
|
exports.coinToRaw = toRaw;
|
|
11813
11869
|
exports.computeAccountAddress = computeAccountAddress;
|
|
11814
11870
|
exports.computeOwnerGuid = computeOwnerGuid;
|
|
11871
|
+
exports.confirmIntentBestEffort = confirmIntentBestEffort;
|
|
11815
11872
|
exports.createAdminSessionGrant = createAdminSessionGrant;
|
|
11816
11873
|
exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
|
|
11817
11874
|
exports.decodeGuardiansInfo = decodeGuardiansInfo;
|
|
@@ -11819,6 +11876,8 @@ exports.deriveAesKey = deriveAesKey;
|
|
|
11819
11876
|
exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
|
|
11820
11877
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
11821
11878
|
exports.encodeByteArray = encodeByteArray;
|
|
11879
|
+
exports.executeIntent = executeIntent;
|
|
11880
|
+
exports.executeIntents = executeIntents;
|
|
11822
11881
|
exports.executeSponsored = executeSponsored;
|
|
11823
11882
|
exports.fdvHuman = fdvHuman;
|
|
11824
11883
|
exports.generateStarkKeyPair = generateStarkKeyPair;
|