@medialane/sdk 0.123.0 → 0.125.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 +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 +12 -5
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +4 -1
- package/dist/starknet/index.d.ts +4 -1
- package/dist/starknet/index.js +12 -5
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -559,6 +559,7 @@ interface RequestSiwsTokenArgs {
|
|
|
559
559
|
backendUrl: string;
|
|
560
560
|
walletAddress: string;
|
|
561
561
|
signer: SiwsSigner;
|
|
562
|
+
appSource?: string;
|
|
562
563
|
}
|
|
563
564
|
|
|
564
565
|
declare function getSiwsStorageKey(address: string): string;
|
|
@@ -566,7 +567,7 @@ declare function isSiwsTokenValid(token: string | null | undefined): token is st
|
|
|
566
567
|
declare function getStoredSiwsToken(address: string): string | null;
|
|
567
568
|
declare function storeSiwsToken(address: string, token: string): void;
|
|
568
569
|
declare function normalizeSiwsSignature(signature: unknown): string[];
|
|
569
|
-
declare function requestSiwsToken({ backendUrl, walletAddress, signer, }: RequestSiwsTokenArgs): Promise<string>;
|
|
570
|
+
declare function requestSiwsToken({ backendUrl, walletAddress, signer, appSource, }: RequestSiwsTokenArgs): Promise<string>;
|
|
570
571
|
|
|
571
572
|
declare const IPMarketplaceABI: readonly [{
|
|
572
573
|
readonly type: "impl";
|
|
@@ -7877,6 +7878,7 @@ interface TypedDataSigner {
|
|
|
7877
7878
|
interface SponsoredExecuteConfig {
|
|
7878
7879
|
proxyUrl: string;
|
|
7879
7880
|
fetchImpl?: typeof fetch;
|
|
7881
|
+
identityToken?: string;
|
|
7880
7882
|
}
|
|
7881
7883
|
type SponsoredExecuteResult = {
|
|
7882
7884
|
status: "sponsored";
|
|
@@ -8077,6 +8079,7 @@ interface SponsoredDeps extends SelfFundedDeps {
|
|
|
8077
8079
|
consent: SelfFundConsent;
|
|
8078
8080
|
fetchImpl?: typeof fetch;
|
|
8079
8081
|
fallback?: WalletExecutor;
|
|
8082
|
+
identityToken?: () => string | null;
|
|
8080
8083
|
}
|
|
8081
8084
|
declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
|
|
8082
8085
|
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -559,6 +559,7 @@ interface RequestSiwsTokenArgs {
|
|
|
559
559
|
backendUrl: string;
|
|
560
560
|
walletAddress: string;
|
|
561
561
|
signer: SiwsSigner;
|
|
562
|
+
appSource?: string;
|
|
562
563
|
}
|
|
563
564
|
|
|
564
565
|
declare function getSiwsStorageKey(address: string): string;
|
|
@@ -566,7 +567,7 @@ declare function isSiwsTokenValid(token: string | null | undefined): token is st
|
|
|
566
567
|
declare function getStoredSiwsToken(address: string): string | null;
|
|
567
568
|
declare function storeSiwsToken(address: string, token: string): void;
|
|
568
569
|
declare function normalizeSiwsSignature(signature: unknown): string[];
|
|
569
|
-
declare function requestSiwsToken({ backendUrl, walletAddress, signer, }: RequestSiwsTokenArgs): Promise<string>;
|
|
570
|
+
declare function requestSiwsToken({ backendUrl, walletAddress, signer, appSource, }: RequestSiwsTokenArgs): Promise<string>;
|
|
570
571
|
|
|
571
572
|
declare const IPMarketplaceABI: readonly [{
|
|
572
573
|
readonly type: "impl";
|
|
@@ -7877,6 +7878,7 @@ interface TypedDataSigner {
|
|
|
7877
7878
|
interface SponsoredExecuteConfig {
|
|
7878
7879
|
proxyUrl: string;
|
|
7879
7880
|
fetchImpl?: typeof fetch;
|
|
7881
|
+
identityToken?: string;
|
|
7880
7882
|
}
|
|
7881
7883
|
type SponsoredExecuteResult = {
|
|
7882
7884
|
status: "sponsored";
|
|
@@ -8077,6 +8079,7 @@ interface SponsoredDeps extends SelfFundedDeps {
|
|
|
8077
8079
|
consent: SelfFundConsent;
|
|
8078
8080
|
fetchImpl?: typeof fetch;
|
|
8079
8081
|
fallback?: WalletExecutor;
|
|
8082
|
+
identityToken?: () => string | null;
|
|
8080
8083
|
}
|
|
8081
8084
|
declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
|
|
8082
8085
|
|
package/dist/starknet/index.js
CHANGED
|
@@ -11578,7 +11578,8 @@ function normalizeSiwsSignature(signature) {
|
|
|
11578
11578
|
async function requestSiwsToken({
|
|
11579
11579
|
backendUrl,
|
|
11580
11580
|
walletAddress,
|
|
11581
|
-
signer
|
|
11581
|
+
signer,
|
|
11582
|
+
appSource
|
|
11582
11583
|
}) {
|
|
11583
11584
|
const base = backendUrl.replace(/\/$/, "");
|
|
11584
11585
|
const nonceRes = await fetch(`${base}/v1/auth/siws/nonce`, {
|
|
@@ -11594,7 +11595,7 @@ async function requestSiwsToken({
|
|
|
11594
11595
|
const verifyRes = await fetch(`${base}/v1/auth/siws/verify`, {
|
|
11595
11596
|
method: "POST",
|
|
11596
11597
|
headers: { "Content-Type": "application/json" },
|
|
11597
|
-
body: JSON.stringify({ walletAddress, nonce, signature })
|
|
11598
|
+
body: JSON.stringify({ walletAddress, nonce, signature, ...appSource ? { appSource } : {} })
|
|
11598
11599
|
});
|
|
11599
11600
|
if (!verifyRes.ok) {
|
|
11600
11601
|
let backendMessage;
|
|
@@ -12036,9 +12037,11 @@ async function failureOf(res, fallback) {
|
|
|
12036
12037
|
async function executeSponsored(config, signer, calls) {
|
|
12037
12038
|
const doFetch = config.fetchImpl ?? fetch;
|
|
12038
12039
|
const base = config.proxyUrl.replace(/\/$/, "");
|
|
12040
|
+
const headers = { "Content-Type": "application/json" };
|
|
12041
|
+
if (config.identityToken) headers.Authorization = `Bearer ${config.identityToken}`;
|
|
12039
12042
|
const buildRes = await doFetch(`${base}/build`, {
|
|
12040
12043
|
method: "POST",
|
|
12041
|
-
headers
|
|
12044
|
+
headers,
|
|
12042
12045
|
body: JSON.stringify({ userAddress: signer.address, calls })
|
|
12043
12046
|
});
|
|
12044
12047
|
if (!buildRes.ok) {
|
|
@@ -12050,7 +12053,7 @@ async function executeSponsored(config, signer, calls) {
|
|
|
12050
12053
|
const signature = await signer.signTypedData(typedData);
|
|
12051
12054
|
const executeRes = await doFetch(`${base}/execute`, {
|
|
12052
12055
|
method: "POST",
|
|
12053
|
-
headers
|
|
12056
|
+
headers,
|
|
12054
12057
|
body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls })
|
|
12055
12058
|
});
|
|
12056
12059
|
if (!executeRes.ok) {
|
|
@@ -12633,7 +12636,11 @@ function sponsoredExecutor(deps) {
|
|
|
12633
12636
|
async execute(input) {
|
|
12634
12637
|
const { userAddress, privateKeyHex, calls } = input;
|
|
12635
12638
|
const result = await executeSponsored(
|
|
12636
|
-
{
|
|
12639
|
+
{
|
|
12640
|
+
proxyUrl: deps.proxyUrl,
|
|
12641
|
+
fetchImpl: deps.fetchImpl,
|
|
12642
|
+
identityToken: deps.identityToken?.() ?? void 0
|
|
12643
|
+
},
|
|
12637
12644
|
{
|
|
12638
12645
|
address: userAddress,
|
|
12639
12646
|
signTypedData: async (data) => signWithPrivateKey(privateKeyHex, typedData.getMessageHash(data, userAddress))
|