@medialane/sdk 0.124.0 → 0.125.1
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 +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +9 -3
- 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 +9 -3
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -7878,6 +7878,7 @@ interface TypedDataSigner {
|
|
|
7878
7878
|
interface SponsoredExecuteConfig {
|
|
7879
7879
|
proxyUrl: string;
|
|
7880
7880
|
fetchImpl?: typeof fetch;
|
|
7881
|
+
identityToken?: string;
|
|
7881
7882
|
}
|
|
7882
7883
|
type SponsoredExecuteResult = {
|
|
7883
7884
|
status: "sponsored";
|
|
@@ -8078,6 +8079,7 @@ interface SponsoredDeps extends SelfFundedDeps {
|
|
|
8078
8079
|
consent: SelfFundConsent;
|
|
8079
8080
|
fetchImpl?: typeof fetch;
|
|
8080
8081
|
fallback?: WalletExecutor;
|
|
8082
|
+
identityToken?: () => string | null;
|
|
8081
8083
|
}
|
|
8082
8084
|
declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
|
|
8083
8085
|
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -7878,6 +7878,7 @@ interface TypedDataSigner {
|
|
|
7878
7878
|
interface SponsoredExecuteConfig {
|
|
7879
7879
|
proxyUrl: string;
|
|
7880
7880
|
fetchImpl?: typeof fetch;
|
|
7881
|
+
identityToken?: string;
|
|
7881
7882
|
}
|
|
7882
7883
|
type SponsoredExecuteResult = {
|
|
7883
7884
|
status: "sponsored";
|
|
@@ -8078,6 +8079,7 @@ interface SponsoredDeps extends SelfFundedDeps {
|
|
|
8078
8079
|
consent: SelfFundConsent;
|
|
8079
8080
|
fetchImpl?: typeof fetch;
|
|
8080
8081
|
fallback?: WalletExecutor;
|
|
8082
|
+
identityToken?: () => string | null;
|
|
8081
8083
|
}
|
|
8082
8084
|
declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
|
|
8083
8085
|
|
package/dist/starknet/index.js
CHANGED
|
@@ -12037,9 +12037,11 @@ async function failureOf(res, fallback) {
|
|
|
12037
12037
|
async function executeSponsored(config, signer, calls) {
|
|
12038
12038
|
const doFetch = config.fetchImpl ?? fetch;
|
|
12039
12039
|
const base = config.proxyUrl.replace(/\/$/, "");
|
|
12040
|
+
const headers = { "Content-Type": "application/json" };
|
|
12041
|
+
if (config.identityToken) headers.Authorization = `Bearer ${config.identityToken}`;
|
|
12040
12042
|
const buildRes = await doFetch(`${base}/build`, {
|
|
12041
12043
|
method: "POST",
|
|
12042
|
-
headers
|
|
12044
|
+
headers,
|
|
12043
12045
|
body: JSON.stringify({ userAddress: signer.address, calls })
|
|
12044
12046
|
});
|
|
12045
12047
|
if (!buildRes.ok) {
|
|
@@ -12051,7 +12053,7 @@ async function executeSponsored(config, signer, calls) {
|
|
|
12051
12053
|
const signature = await signer.signTypedData(typedData);
|
|
12052
12054
|
const executeRes = await doFetch(`${base}/execute`, {
|
|
12053
12055
|
method: "POST",
|
|
12054
|
-
headers
|
|
12056
|
+
headers,
|
|
12055
12057
|
body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls })
|
|
12056
12058
|
});
|
|
12057
12059
|
if (!executeRes.ok) {
|
|
@@ -12634,7 +12636,11 @@ function sponsoredExecutor(deps) {
|
|
|
12634
12636
|
async execute(input) {
|
|
12635
12637
|
const { userAddress, privateKeyHex, calls } = input;
|
|
12636
12638
|
const result = await executeSponsored(
|
|
12637
|
-
{
|
|
12639
|
+
{
|
|
12640
|
+
proxyUrl: deps.proxyUrl,
|
|
12641
|
+
fetchImpl: deps.fetchImpl,
|
|
12642
|
+
identityToken: deps.identityToken?.() ?? void 0
|
|
12643
|
+
},
|
|
12638
12644
|
{
|
|
12639
12645
|
address: userAddress,
|
|
12640
12646
|
signTypedData: async (data) => signWithPrivateKey(privateKeyHex, typedData.getMessageHash(data, userAddress))
|