@medialane/sdk 0.143.0 → 0.145.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 +31 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -2
- package/dist/index.d.ts +67 -2
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +40 -1
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -0
- package/dist/starknet/index.d.ts +2 -0
- package/dist/starknet/index.js +40 -1
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -8065,6 +8065,8 @@ declare function isDeployed(provider: ReceiptProviderLike, address: string): Pro
|
|
|
8065
8065
|
interface SelfFundFeeEstimate {
|
|
8066
8066
|
feeRaw: bigint;
|
|
8067
8067
|
unit: string;
|
|
8068
|
+
/** The wallet's balance of the fee token; `null` when it could not be read. */
|
|
8069
|
+
balanceRaw: bigint | null;
|
|
8068
8070
|
}
|
|
8069
8071
|
type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
|
|
8070
8072
|
interface SelfFundConsent {
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -8065,6 +8065,8 @@ declare function isDeployed(provider: ReceiptProviderLike, address: string): Pro
|
|
|
8065
8065
|
interface SelfFundFeeEstimate {
|
|
8066
8066
|
feeRaw: bigint;
|
|
8067
8067
|
unit: string;
|
|
8068
|
+
/** The wallet's balance of the fee token; `null` when it could not be read. */
|
|
8069
|
+
balanceRaw: bigint | null;
|
|
8068
8070
|
}
|
|
8069
8071
|
type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
|
|
8070
8072
|
interface SelfFundConsent {
|
package/dist/starknet/index.js
CHANGED
|
@@ -12072,6 +12072,25 @@ var SERVICES = {
|
|
|
12072
12072
|
],
|
|
12073
12073
|
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12074
12074
|
},
|
|
12075
|
+
"certificate-emission": {
|
|
12076
|
+
id: "certificate-emission",
|
|
12077
|
+
displayName: "Certificate Emission",
|
|
12078
|
+
description: "Issue a soulbound credential to a list of recipients in one run \u2014 everyone gets a wallet and their certificate.",
|
|
12079
|
+
standard: "ERC721",
|
|
12080
|
+
provenance: "MEDIALANE",
|
|
12081
|
+
onchain: {
|
|
12082
|
+
STARKNET: {
|
|
12083
|
+
factoryAddress: SN2.popFactory,
|
|
12084
|
+
classHash: SN2.popCollectionClassHash
|
|
12085
|
+
}
|
|
12086
|
+
},
|
|
12087
|
+
uiVariant: "pop",
|
|
12088
|
+
capabilities: ["mint", "airdrop"],
|
|
12089
|
+
events: [
|
|
12090
|
+
{ name: "CollectionCreated", emittedBy: "factory" }
|
|
12091
|
+
],
|
|
12092
|
+
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
12093
|
+
},
|
|
12075
12094
|
"drop-collection": {
|
|
12076
12095
|
id: "drop-collection",
|
|
12077
12096
|
displayName: "Collection Drop",
|
|
@@ -12935,13 +12954,33 @@ function createPasskeyOwner(config) {
|
|
|
12935
12954
|
}
|
|
12936
12955
|
};
|
|
12937
12956
|
}
|
|
12957
|
+
|
|
12958
|
+
// src/utils/token.ts
|
|
12959
|
+
function getTokenBySymbol(symbol) {
|
|
12960
|
+
if (typeof symbol !== "string") return void 0;
|
|
12961
|
+
const upper = symbol.toUpperCase();
|
|
12962
|
+
return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
|
|
12963
|
+
}
|
|
12964
|
+
|
|
12965
|
+
// src/wallet/executors.ts
|
|
12938
12966
|
function accountFor(provider, address, privateKeyHex) {
|
|
12939
12967
|
return new Account({ provider, address, signer: privateKeyHex, cairoVersion: "1" });
|
|
12940
12968
|
}
|
|
12941
12969
|
async function estimateSelfFundedFee(provider, address, calls) {
|
|
12942
12970
|
const account = new Account({ provider, address, signer: "0x1", cairoVersion: "1" });
|
|
12943
12971
|
const estimate = await account.estimateInvokeFee(calls);
|
|
12944
|
-
|
|
12972
|
+
const balanceRaw = await feeTokenBalance(provider, address, estimate.unit).catch(() => null);
|
|
12973
|
+
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
12974
|
+
}
|
|
12975
|
+
async function feeTokenBalance(provider, address, unit) {
|
|
12976
|
+
const token = getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
12977
|
+
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
12978
|
+
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
12979
|
+
contractAddress: token.address,
|
|
12980
|
+
entrypoint: "balance_of",
|
|
12981
|
+
calldata: [address]
|
|
12982
|
+
});
|
|
12983
|
+
return BigInt(low) + (BigInt(high) << 128n);
|
|
12945
12984
|
}
|
|
12946
12985
|
function selfFundedExecutor(deps) {
|
|
12947
12986
|
return {
|