@medialane/sdk 0.141.0 → 0.143.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/{errors-CtXjdRsL.d.ts → errors-DUiebYFo.d.ts} +17 -6
- package/dist/{errors-CMjZp66y.d.cts → errors-SGwgtvtF.d.cts} +17 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +42 -15
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +4 -5
- package/dist/starknet/index.d.ts +4 -5
- package/dist/starknet/index.js +40 -15
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -646,7 +646,7 @@ var ApiClient = class {
|
|
|
646
646
|
registerBusinessProvisioning(params) {
|
|
647
647
|
return this.post(
|
|
648
648
|
"/v1/business/provisioning",
|
|
649
|
-
{ chain: params.chain ?? "STARKNET",
|
|
649
|
+
{ chain: params.chain ?? "STARKNET", email: params.email }
|
|
650
650
|
);
|
|
651
651
|
}
|
|
652
652
|
getCollectionProfile(contractAddress) {
|
|
@@ -12465,7 +12465,7 @@ function ownerAliveCalldata(proof) {
|
|
|
12465
12465
|
function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey, ownerAlive) {
|
|
12466
12466
|
if (!ownerAlive) {
|
|
12467
12467
|
throw new Error(
|
|
12468
|
-
"
|
|
12468
|
+
"Replacing the signing owner requires an owner-alive proof from the new owner. Sign ownerAliveTypedData with the new owner key and pass it here."
|
|
12469
12469
|
);
|
|
12470
12470
|
}
|
|
12471
12471
|
return changeOwners(
|
|
@@ -12721,13 +12721,39 @@ function parseAccountAddress(input) {
|
|
|
12721
12721
|
}
|
|
12722
12722
|
|
|
12723
12723
|
// src/wallet/recovery-key.ts
|
|
12724
|
-
|
|
12724
|
+
var PREFIX = "medialane-recovery:v1:";
|
|
12725
|
+
var ADDRESS = /^0x[0-9a-fA-F]{1,64}$/;
|
|
12726
|
+
var InvalidRecoveryKeyError = class extends Error {
|
|
12727
|
+
constructor(message = "This is not a valid recovery key.") {
|
|
12728
|
+
super(message);
|
|
12729
|
+
this.name = "InvalidRecoveryKeyError";
|
|
12730
|
+
}
|
|
12731
|
+
};
|
|
12732
|
+
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12733
|
+
function keyPair(privateKey) {
|
|
12725
12734
|
try {
|
|
12726
|
-
return
|
|
12735
|
+
return starkKeyPairFromPrivateKey(privateKey);
|
|
12727
12736
|
} catch {
|
|
12728
|
-
|
|
12737
|
+
throw new InvalidRecoveryKeyError();
|
|
12729
12738
|
}
|
|
12730
12739
|
}
|
|
12740
|
+
function encodeRecoveryKey(key) {
|
|
12741
|
+
if (!ADDRESS.test(key.walletAddress) || BigInt(key.walletAddress) === 0n) throw new InvalidRecoveryKeyError();
|
|
12742
|
+
return `${PREFIX}${canonicalAddress(key.walletAddress)}:${keyPair(key.privateKey).privateKeyHex}`;
|
|
12743
|
+
}
|
|
12744
|
+
function parseRecoveryKey(input) {
|
|
12745
|
+
const trimmed = input.trim();
|
|
12746
|
+
if (!trimmed.startsWith(PREFIX)) {
|
|
12747
|
+
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12748
|
+
return { walletAddress: computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12749
|
+
}
|
|
12750
|
+
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12751
|
+
const [walletAddress, privateKey] = parts;
|
|
12752
|
+
if (parts.length !== 2 || !walletAddress || !privateKey || !ADDRESS.test(walletAddress) || BigInt(walletAddress) === 0n) {
|
|
12753
|
+
throw new InvalidRecoveryKeyError();
|
|
12754
|
+
}
|
|
12755
|
+
return { walletAddress: canonicalAddress(walletAddress), privateKey: keyPair(privateKey).privateKeyHex };
|
|
12756
|
+
}
|
|
12731
12757
|
|
|
12732
12758
|
// src/wallet/guardian-status.ts
|
|
12733
12759
|
function describeGuardianStatus(guardians) {
|
|
@@ -12751,12 +12777,14 @@ function isValidStarknetAddress(address) {
|
|
|
12751
12777
|
return false;
|
|
12752
12778
|
}
|
|
12753
12779
|
}
|
|
12780
|
+
var CONTRACT_NOT_FOUND = 20;
|
|
12754
12781
|
async function isDeployed(provider, address) {
|
|
12755
12782
|
try {
|
|
12756
12783
|
await provider.getClassHashAt(normalizeWalletAddress(address));
|
|
12757
12784
|
return true;
|
|
12758
|
-
} catch {
|
|
12759
|
-
return false;
|
|
12785
|
+
} catch (err) {
|
|
12786
|
+
if (err?.code === CONTRACT_NOT_FOUND) return false;
|
|
12787
|
+
throw err;
|
|
12760
12788
|
}
|
|
12761
12789
|
}
|
|
12762
12790
|
|
|
@@ -12894,21 +12922,18 @@ function createPasskeyOwner(config) {
|
|
|
12894
12922
|
const aes = await deriveAesKey(secret, config.hkdfInfo);
|
|
12895
12923
|
return unsealPrivateKey(aes, decodeBase64(sealed.iv), decodeBase64(sealed.ciphertext));
|
|
12896
12924
|
},
|
|
12897
|
-
async sealImportedOwnerKey(
|
|
12898
|
-
const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(
|
|
12925
|
+
async sealImportedOwnerKey(recovery) {
|
|
12926
|
+
const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(recovery.privateKey);
|
|
12899
12927
|
const registration = await registerPasskey();
|
|
12900
12928
|
const secret = await secretFromRegistration(registration);
|
|
12901
12929
|
const { iv, ciphertext } = await seal(secret, privateKeyHex);
|
|
12902
12930
|
return {
|
|
12903
12931
|
credentialId: registration.credentialId,
|
|
12904
12932
|
ownerPubKey: publicKeyHex,
|
|
12905
|
-
address:
|
|
12933
|
+
address: recovery.walletAddress,
|
|
12906
12934
|
iv,
|
|
12907
12935
|
ciphertext
|
|
12908
12936
|
};
|
|
12909
|
-
},
|
|
12910
|
-
walletAddressForPrivateKey(privateKeyInput) {
|
|
12911
|
-
return computeAccountAddress(starkKeyPairFromPrivateKey(privateKeyInput).publicKeyHex, 0);
|
|
12912
12937
|
}
|
|
12913
12938
|
};
|
|
12914
12939
|
}
|
|
@@ -13008,7 +13033,7 @@ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep2 = (m
|
|
|
13008
13033
|
const deadline = Date.now() + timeoutMs;
|
|
13009
13034
|
let wait = 1e3;
|
|
13010
13035
|
for (; ; ) {
|
|
13011
|
-
if (await isDeployed(provider, address)) return;
|
|
13036
|
+
if (await isDeployed(provider, address).catch(() => false)) return;
|
|
13012
13037
|
if (Date.now() >= deadline) {
|
|
13013
13038
|
throw new Error(
|
|
13014
13039
|
"Your wallet was submitted but has not appeared on Starknet yet. Please try again in a moment."
|
|
@@ -13222,6 +13247,7 @@ exports.IPSponsorshipABI = IPSponsorshipABI;
|
|
|
13222
13247
|
exports.IPTicketCollectionABI = IPTicketCollectionABI;
|
|
13223
13248
|
exports.IPTicketCollectionFactoryABI = IPTicketCollectionFactoryABI;
|
|
13224
13249
|
exports.InvalidPairingPayloadError = InvalidPairingPayloadError;
|
|
13250
|
+
exports.InvalidRecoveryKeyError = InvalidRecoveryKeyError;
|
|
13225
13251
|
exports.InvalidStarkPrivateKeyError = InvalidStarkPrivateKeyError;
|
|
13226
13252
|
exports.MAX_HOLDERS_AT_LAUNCH = MAX_HOLDERS_AT_LAUNCH;
|
|
13227
13253
|
exports.MAX_TEAM_ALLOCATION_PERCENT = MAX_TEAM_ALLOCATION_PERCENT;
|
|
@@ -13287,6 +13313,7 @@ exports.describeRecoveryAction = describeRecoveryAction;
|
|
|
13287
13313
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
13288
13314
|
exports.encodeByteArray = encodeByteArray;
|
|
13289
13315
|
exports.encodePairingPayload = encodePairingPayload;
|
|
13316
|
+
exports.encodeRecoveryKey = encodeRecoveryKey;
|
|
13290
13317
|
exports.estimateSelfFundedFee = estimateSelfFundedFee;
|
|
13291
13318
|
exports.executeIntent = executeIntent;
|
|
13292
13319
|
exports.executeIntents = executeIntents;
|
|
@@ -13307,7 +13334,6 @@ exports.getOwners = getOwners;
|
|
|
13307
13334
|
exports.getSiwsStorageKey = getSiwsStorageKey;
|
|
13308
13335
|
exports.getStoredSiwsToken = getStoredSiwsToken;
|
|
13309
13336
|
exports.isDeployed = isDeployed;
|
|
13310
|
-
exports.isRecoveryKeyForWallet = isRecoveryKeyForWallet;
|
|
13311
13337
|
exports.isSiwsTokenValid = isSiwsTokenValid;
|
|
13312
13338
|
exports.isValidStarknetAddress = isValidStarknetAddress;
|
|
13313
13339
|
exports.mintedTokenIdFromReceipt = mintedTokenIdFromReceipt;
|
|
@@ -13319,6 +13345,7 @@ exports.parseAccountAddress = parseAccountAddress;
|
|
|
13319
13345
|
exports.parseAdminHeaders = parseAdminHeaders;
|
|
13320
13346
|
exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
13321
13347
|
exports.parsePairingPayload = parsePairingPayload;
|
|
13348
|
+
exports.parseRecoveryKey = parseRecoveryKey;
|
|
13322
13349
|
exports.priceToEkuboParams = priceToEkuboParams;
|
|
13323
13350
|
exports.randomNonce = randomNonce;
|
|
13324
13351
|
exports.requestSiwsToken = requestSiwsToken;
|