@medialane/sdk 0.162.0 → 0.163.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/starknet/index.cjs
CHANGED
|
@@ -11601,6 +11601,10 @@ function createOwnerStore(config) {
|
|
|
11601
11601
|
return this.load()?.address ?? null;
|
|
11602
11602
|
},
|
|
11603
11603
|
save(sealed) {
|
|
11604
|
+
const previous = this.load();
|
|
11605
|
+
if (previous && previous.address !== sealed.address) {
|
|
11606
|
+
localStorage.setItem(`${storeKey}:${previous.address}`, JSON.stringify(previous));
|
|
11607
|
+
}
|
|
11604
11608
|
localStorage.setItem(storeKey, JSON.stringify(sealed));
|
|
11605
11609
|
announce();
|
|
11606
11610
|
},
|
|
@@ -11873,20 +11877,7 @@ async function waitUntilDeployed(provider, address, timeoutMs = 9e4, sleep = (ms
|
|
|
11873
11877
|
wait = Math.min(Math.round(wait * 1.5), 5e3);
|
|
11874
11878
|
}
|
|
11875
11879
|
}
|
|
11876
|
-
async function
|
|
11877
|
-
let sealed = options.forceNew ? null : deps.store.load();
|
|
11878
|
-
let privateKeyHex;
|
|
11879
|
-
if (!sealed) {
|
|
11880
|
-
onStep("creating-passkey");
|
|
11881
|
-
const created = await deps.passkey.createOwnerKey();
|
|
11882
|
-
sealed = created.sealed;
|
|
11883
|
-
privateKeyHex = created.privateKeyHex;
|
|
11884
|
-
deps.store.save(sealed);
|
|
11885
|
-
} else {
|
|
11886
|
-
privateKeyHex = await deps.passkey.unlockOwnerKey(sealed);
|
|
11887
|
-
}
|
|
11888
|
-
onStep("deploying");
|
|
11889
|
-
const wallet = { ownerAddress: sealed.address, ownerPubKey: sealed.ownerPubKey, privateKeyHex };
|
|
11880
|
+
async function deployWallet(deps, wallet) {
|
|
11890
11881
|
const sponsored = deps.deploySponsoredImpl ?? deploySponsored;
|
|
11891
11882
|
const selfFunded = deps.deploySelfFundedImpl ?? deploySelfFunded;
|
|
11892
11883
|
if (deps.deployProxyUrl) {
|
|
@@ -11909,7 +11900,25 @@ async function completeDeployment(deps, onStep, options = {}) {
|
|
|
11909
11900
|
} else {
|
|
11910
11901
|
await selfFunded({ provider: deps.provider(), ...wallet });
|
|
11911
11902
|
}
|
|
11912
|
-
await (deps.waitUntilDeployedImpl ?? waitUntilDeployed)(deps.provider(),
|
|
11903
|
+
await (deps.waitUntilDeployedImpl ?? waitUntilDeployed)(deps.provider(), wallet.ownerAddress);
|
|
11904
|
+
}
|
|
11905
|
+
async function completeDeployment(deps, onStep, options = {}) {
|
|
11906
|
+
let sealed = options.forceNew ? null : deps.store.load();
|
|
11907
|
+
if (sealed && await (deps.isDeployedImpl ?? isDeployed)(deps.provider(), sealed.address).catch(() => false)) {
|
|
11908
|
+
sealed = null;
|
|
11909
|
+
}
|
|
11910
|
+
let privateKeyHex;
|
|
11911
|
+
if (!sealed) {
|
|
11912
|
+
onStep("creating-passkey");
|
|
11913
|
+
const created = await deps.passkey.createOwnerKey();
|
|
11914
|
+
sealed = created.sealed;
|
|
11915
|
+
privateKeyHex = created.privateKeyHex;
|
|
11916
|
+
deps.store.save(sealed);
|
|
11917
|
+
} else {
|
|
11918
|
+
privateKeyHex = await deps.passkey.unlockOwnerKey(sealed);
|
|
11919
|
+
}
|
|
11920
|
+
onStep("deploying");
|
|
11921
|
+
await deployWallet(deps, { ownerAddress: sealed.address, ownerPubKey: sealed.ownerPubKey, privateKeyHex });
|
|
11913
11922
|
onStep("signing-in");
|
|
11914
11923
|
const address = sealed.address;
|
|
11915
11924
|
const siwsToken = await (deps.requestSiwsTokenImpl ?? requestSiwsToken)({
|