@medialane/sdk 0.119.1 → 0.120.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/guardian-4rnV78dm.d.cts +28 -0
- package/dist/guardian-4rnV78dm.d.ts +28 -0
- package/dist/starknet/index.cjs +12 -7
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +4 -26
- package/dist/starknet/index.d.ts +4 -26
- package/dist/starknet/index.js +12 -8
- package/dist/starknet/index.js.map +1 -1
- package/dist/wallet/index.cjs +808 -0
- package/dist/wallet/index.cjs.map +1 -0
- package/dist/wallet/index.d.cts +163 -0
- package/dist/wallet/index.d.ts +163 -0
- package/dist/wallet/index.js +786 -0
- package/dist/wallet/index.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Call, ProviderInterface } from 'starknet';
|
|
2
|
+
|
|
3
|
+
declare const SIGNER_TYPE_NAMES: readonly ["Starknet", "Secp256k1", "Secp256r1"];
|
|
4
|
+
type SignerTypeName = (typeof SIGNER_TYPE_NAMES)[number];
|
|
5
|
+
interface GuardianInfo {
|
|
6
|
+
type: SignerTypeName;
|
|
7
|
+
guid: string;
|
|
8
|
+
storedValue: string;
|
|
9
|
+
}
|
|
10
|
+
declare function buildSetFirstGuardianCall(address: string, guardianPubkey: string): Call;
|
|
11
|
+
declare function buildTriggerEscapeOwnerCall(targetAddress: string, newOwnerPubkey: string): Call;
|
|
12
|
+
declare function buildCompleteEscapeOwnerCall(targetAddress: string): Call;
|
|
13
|
+
declare function buildCancelEscapeCall(address: string): Call;
|
|
14
|
+
declare function decodeGuardiansInfo(res: string[]): GuardianInfo[];
|
|
15
|
+
type EscapeTypeName = "None" | "Guardian" | "Owner";
|
|
16
|
+
type EscapeStatusName = "None" | "NotReady" | "Ready" | "Expired";
|
|
17
|
+
interface EscapeInfo {
|
|
18
|
+
readyAt: number;
|
|
19
|
+
escapeType: EscapeTypeName;
|
|
20
|
+
status: EscapeStatusName;
|
|
21
|
+
}
|
|
22
|
+
declare function decodeEscapeAndStatus(res: string[]): EscapeInfo;
|
|
23
|
+
declare function getGuardians(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
|
|
24
|
+
declare function getOwners(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
|
|
25
|
+
declare function getEscape(provider: ProviderInterface, address: string): Promise<EscapeInfo>;
|
|
26
|
+
declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
|
|
27
|
+
|
|
28
|
+
export { type EscapeInfo as E, type GuardianInfo as G, type EscapeStatusName as a, type EscapeTypeName as b, buildCancelEscapeCall as c, buildCompleteEscapeOwnerCall as d, buildSetFirstGuardianCall as e, buildTriggerEscapeOwnerCall as f, decodeEscapeAndStatus as g, decodeGuardiansInfo as h, getEscape as i, getEscapeSecurityPeriod as j, getGuardians as k, getOwners as l };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Call, ProviderInterface } from 'starknet';
|
|
2
|
+
|
|
3
|
+
declare const SIGNER_TYPE_NAMES: readonly ["Starknet", "Secp256k1", "Secp256r1"];
|
|
4
|
+
type SignerTypeName = (typeof SIGNER_TYPE_NAMES)[number];
|
|
5
|
+
interface GuardianInfo {
|
|
6
|
+
type: SignerTypeName;
|
|
7
|
+
guid: string;
|
|
8
|
+
storedValue: string;
|
|
9
|
+
}
|
|
10
|
+
declare function buildSetFirstGuardianCall(address: string, guardianPubkey: string): Call;
|
|
11
|
+
declare function buildTriggerEscapeOwnerCall(targetAddress: string, newOwnerPubkey: string): Call;
|
|
12
|
+
declare function buildCompleteEscapeOwnerCall(targetAddress: string): Call;
|
|
13
|
+
declare function buildCancelEscapeCall(address: string): Call;
|
|
14
|
+
declare function decodeGuardiansInfo(res: string[]): GuardianInfo[];
|
|
15
|
+
type EscapeTypeName = "None" | "Guardian" | "Owner";
|
|
16
|
+
type EscapeStatusName = "None" | "NotReady" | "Ready" | "Expired";
|
|
17
|
+
interface EscapeInfo {
|
|
18
|
+
readyAt: number;
|
|
19
|
+
escapeType: EscapeTypeName;
|
|
20
|
+
status: EscapeStatusName;
|
|
21
|
+
}
|
|
22
|
+
declare function decodeEscapeAndStatus(res: string[]): EscapeInfo;
|
|
23
|
+
declare function getGuardians(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
|
|
24
|
+
declare function getOwners(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
|
|
25
|
+
declare function getEscape(provider: ProviderInterface, address: string): Promise<EscapeInfo>;
|
|
26
|
+
declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
|
|
27
|
+
|
|
28
|
+
export { type EscapeInfo as E, type GuardianInfo as G, type EscapeStatusName as a, type EscapeTypeName as b, buildCancelEscapeCall as c, buildCompleteEscapeOwnerCall as d, buildSetFirstGuardianCall as e, buildTriggerEscapeOwnerCall as f, decodeEscapeAndStatus as g, decodeGuardiansInfo as h, getEscape as i, getEscapeSecurityPeriod as j, getGuardians as k, getOwners as l };
|
package/dist/starknet/index.cjs
CHANGED
|
@@ -12029,10 +12029,14 @@ function mintedTokenIdFromReceipt(receipt, contract) {
|
|
|
12029
12029
|
// src/starknet/services/sponsoredExecutor.ts
|
|
12030
12030
|
var SponsoredCallRejectedError = class extends Error {
|
|
12031
12031
|
};
|
|
12032
|
-
var
|
|
12033
|
-
|
|
12032
|
+
var USER_MAY_PAY = /* @__PURE__ */ new Set(["sponsor_unavailable", "credits_exhausted"]);
|
|
12033
|
+
function userMayPayInstead(code, status, stage) {
|
|
12034
|
+
if (code) return USER_MAY_PAY.has(code);
|
|
12035
|
+
return stage === "build" ? status >= 500 : status === 503;
|
|
12036
|
+
}
|
|
12037
|
+
async function failureOf(res, fallback) {
|
|
12034
12038
|
const body = await res.json().catch(() => null);
|
|
12035
|
-
return body?.error || fallback;
|
|
12039
|
+
return { reason: body?.error || fallback, code: typeof body?.code === "string" ? body.code : void 0 };
|
|
12036
12040
|
}
|
|
12037
12041
|
async function executeSponsored(config, signer, calls) {
|
|
12038
12042
|
const doFetch = config.fetchImpl ?? fetch;
|
|
@@ -12043,8 +12047,8 @@ async function executeSponsored(config, signer, calls) {
|
|
|
12043
12047
|
body: JSON.stringify({ userAddress: signer.address, calls })
|
|
12044
12048
|
});
|
|
12045
12049
|
if (!buildRes.ok) {
|
|
12046
|
-
const reason = await
|
|
12047
|
-
if (buildRes.status
|
|
12050
|
+
const { reason, code } = await failureOf(buildRes, "We couldn't prepare this transaction.");
|
|
12051
|
+
if (userMayPayInstead(code, buildRes.status, "build")) return { status: "unavailable", reason };
|
|
12048
12052
|
throw new SponsoredCallRejectedError(reason);
|
|
12049
12053
|
}
|
|
12050
12054
|
const { typedData } = await buildRes.json();
|
|
@@ -12055,8 +12059,8 @@ async function executeSponsored(config, signer, calls) {
|
|
|
12055
12059
|
body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls })
|
|
12056
12060
|
});
|
|
12057
12061
|
if (!executeRes.ok) {
|
|
12058
|
-
const reason = await
|
|
12059
|
-
if (executeRes.status
|
|
12062
|
+
const { reason, code } = await failureOf(executeRes, "We couldn't submit this transaction.");
|
|
12063
|
+
if (userMayPayInstead(code, executeRes.status, "execute")) {
|
|
12060
12064
|
return { status: "unavailable", reason };
|
|
12061
12065
|
}
|
|
12062
12066
|
throw new SponsoredCallRejectedError(reason);
|
|
@@ -12430,6 +12434,7 @@ exports.syncTransactionBestEffort = syncTransactionBestEffort;
|
|
|
12430
12434
|
exports.teamCoinsRaw = teamCoinsRaw;
|
|
12431
12435
|
exports.toDropContractConditions = toContractConditions;
|
|
12432
12436
|
exports.unsealPrivateKey = unsealPrivateKey;
|
|
12437
|
+
exports.userMayPayInstead = userMayPayInstead;
|
|
12433
12438
|
exports.validateCoinName = validateName;
|
|
12434
12439
|
exports.validateCoinSupply = validateSupply;
|
|
12435
12440
|
exports.validateCoinSymbol = validateSymbol;
|