@medialane/sdk 0.113.0 → 0.115.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.
|
@@ -7930,6 +7930,10 @@ declare function getEscape(provider: ProviderInterface, address: string): Promis
|
|
|
7930
7930
|
declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
|
|
7931
7931
|
|
|
7932
7932
|
declare function deriveAesKey(prfSecret: Uint8Array, hkdfInfo: Uint8Array): Promise<CryptoKey>;
|
|
7933
|
+
declare function deriveStarkKeyPair(prfSecret: Uint8Array): Promise<{
|
|
7934
|
+
privateKeyHex: string;
|
|
7935
|
+
publicKeyHex: string;
|
|
7936
|
+
}>;
|
|
7933
7937
|
declare function generateStarkKeyPair(): {
|
|
7934
7938
|
privateKeyHex: string;
|
|
7935
7939
|
publicKeyHex: string;
|
|
@@ -7945,6 +7949,20 @@ declare function sealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, privateKeyHex
|
|
|
7945
7949
|
declare function unsealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, ciphertext: BufferSource): Promise<string>;
|
|
7946
7950
|
declare function signWithPrivateKey(privateKeyHex: string, msgHash: string): [string, string];
|
|
7947
7951
|
|
|
7952
|
+
declare const APPROVAL_PATH = "/approve-app";
|
|
7953
|
+
interface ApprovalRequest {
|
|
7954
|
+
publicKey: string;
|
|
7955
|
+
appName: string;
|
|
7956
|
+
returnUrl: string;
|
|
7957
|
+
}
|
|
7958
|
+
declare class InvalidApprovalRequestError extends Error {
|
|
7959
|
+
constructor(message: string);
|
|
7960
|
+
}
|
|
7961
|
+
declare function isMedialaneOrigin(url: string): boolean;
|
|
7962
|
+
declare function buildApprovalUrl(approverOrigin: string, request: ApprovalRequest): string;
|
|
7963
|
+
declare function parseApprovalRequest(params: URLSearchParams): ApprovalRequest;
|
|
7964
|
+
declare function buildReturnUrl(returnUrl: string, outcome: "approved" | "declined"): string;
|
|
7965
|
+
|
|
7948
7966
|
type StarknetVenueSigner = VenueSigner<TypedData, Call>;
|
|
7949
7967
|
|
|
7950
|
-
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClaimConditions, ClubService, type CreateCreatorCoinParams, CreateDropParams, type CreateGrantOpts, CreatePopCollectionParams, CreatorCoinFactoryABI, type CreatorCoinGuarantees, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecuteIntentOpts, type FeeSurface, type GuardianInfo, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidStarkPrivateKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type ReceiptProvider, type RequestSiwsTokenArgs, type ResolvedOrder, SUGGESTED_DEFAULT_PRICE, type SiwsSigner, SponsoredCallRejectedError, type SponsoredExecuteConfig, type SponsoredExecuteResult, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, type TypedDataSigner, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildAdminSessionTypedData, buildCancelEscapeCall, buildCancellationTypedData, buildChangeOwnersCall, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, toRaw as coinToRaw, computeAccountAddress, computeOwnerGuid, confirmIntentBestEffort, createAdminSessionGrant, decodeEscapeAndStatus, decodeGuardiansInfo, deriveAesKey, deriveOwnerKeyPair, encodeAdminHeaders, encodeByteArray, executeIntent, executeIntents, executeSponsored, fdvHuman, generateStarkKeyPair, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, ownerAliveTypedData, ownerConstructorCalldata, parseAdminHeaders, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sealPrivateKey, sessionKeyHashOf, signAdminRequest, signWithPrivateKey, starkKeyPairFromPrivateKey, storeSiwsToken, teamCoinsRaw, toContractConditions as toDropContractConditions, unsealPrivateKey, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyAdminRequestSig };
|
|
7968
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, APPROVAL_PATH, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type ApprovalRequest, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClaimConditions, ClubService, type CreateCreatorCoinParams, CreateDropParams, type CreateGrantOpts, CreatePopCollectionParams, CreatorCoinFactoryABI, type CreatorCoinGuarantees, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecuteIntentOpts, type FeeSurface, type GuardianInfo, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidApprovalRequestError, InvalidStarkPrivateKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type ReceiptProvider, type RequestSiwsTokenArgs, type ResolvedOrder, SUGGESTED_DEFAULT_PRICE, type SiwsSigner, SponsoredCallRejectedError, type SponsoredExecuteConfig, type SponsoredExecuteResult, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, type TypedDataSigner, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildAdminSessionTypedData, buildApprovalUrl, buildCancelEscapeCall, buildCancellationTypedData, buildChangeOwnersCall, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildReturnUrl, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, toRaw as coinToRaw, computeAccountAddress, computeOwnerGuid, confirmIntentBestEffort, createAdminSessionGrant, decodeEscapeAndStatus, decodeGuardiansInfo, deriveAesKey, deriveOwnerKeyPair, deriveStarkKeyPair, encodeAdminHeaders, encodeByteArray, executeIntent, executeIntents, executeSponsored, fdvHuman, generateStarkKeyPair, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isMedialaneOrigin, isSiwsTokenValid, normalizeSiwsSignature, ownerAliveTypedData, ownerConstructorCalldata, parseAdminHeaders, parseApprovalRequest, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sealPrivateKey, sessionKeyHashOf, signAdminRequest, signWithPrivateKey, starkKeyPairFromPrivateKey, storeSiwsToken, teamCoinsRaw, toContractConditions as toDropContractConditions, unsealPrivateKey, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyAdminRequestSig };
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -7930,6 +7930,10 @@ declare function getEscape(provider: ProviderInterface, address: string): Promis
|
|
|
7930
7930
|
declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
|
|
7931
7931
|
|
|
7932
7932
|
declare function deriveAesKey(prfSecret: Uint8Array, hkdfInfo: Uint8Array): Promise<CryptoKey>;
|
|
7933
|
+
declare function deriveStarkKeyPair(prfSecret: Uint8Array): Promise<{
|
|
7934
|
+
privateKeyHex: string;
|
|
7935
|
+
publicKeyHex: string;
|
|
7936
|
+
}>;
|
|
7933
7937
|
declare function generateStarkKeyPair(): {
|
|
7934
7938
|
privateKeyHex: string;
|
|
7935
7939
|
publicKeyHex: string;
|
|
@@ -7945,6 +7949,20 @@ declare function sealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, privateKeyHex
|
|
|
7945
7949
|
declare function unsealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, ciphertext: BufferSource): Promise<string>;
|
|
7946
7950
|
declare function signWithPrivateKey(privateKeyHex: string, msgHash: string): [string, string];
|
|
7947
7951
|
|
|
7952
|
+
declare const APPROVAL_PATH = "/approve-app";
|
|
7953
|
+
interface ApprovalRequest {
|
|
7954
|
+
publicKey: string;
|
|
7955
|
+
appName: string;
|
|
7956
|
+
returnUrl: string;
|
|
7957
|
+
}
|
|
7958
|
+
declare class InvalidApprovalRequestError extends Error {
|
|
7959
|
+
constructor(message: string);
|
|
7960
|
+
}
|
|
7961
|
+
declare function isMedialaneOrigin(url: string): boolean;
|
|
7962
|
+
declare function buildApprovalUrl(approverOrigin: string, request: ApprovalRequest): string;
|
|
7963
|
+
declare function parseApprovalRequest(params: URLSearchParams): ApprovalRequest;
|
|
7964
|
+
declare function buildReturnUrl(returnUrl: string, outcome: "approved" | "declined"): string;
|
|
7965
|
+
|
|
7948
7966
|
type StarknetVenueSigner = VenueSigner<TypedData, Call>;
|
|
7949
7967
|
|
|
7950
|
-
export { ADMIN_HEADERS, ADMIN_SCOPE, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClaimConditions, ClubService, type CreateCreatorCoinParams, CreateDropParams, type CreateGrantOpts, CreatePopCollectionParams, CreatorCoinFactoryABI, type CreatorCoinGuarantees, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecuteIntentOpts, type FeeSurface, type GuardianInfo, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidStarkPrivateKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type ReceiptProvider, type RequestSiwsTokenArgs, type ResolvedOrder, SUGGESTED_DEFAULT_PRICE, type SiwsSigner, SponsoredCallRejectedError, type SponsoredExecuteConfig, type SponsoredExecuteResult, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, type TypedDataSigner, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildAdminSessionTypedData, buildCancelEscapeCall, buildCancellationTypedData, buildChangeOwnersCall, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, toRaw as coinToRaw, computeAccountAddress, computeOwnerGuid, confirmIntentBestEffort, createAdminSessionGrant, decodeEscapeAndStatus, decodeGuardiansInfo, deriveAesKey, deriveOwnerKeyPair, encodeAdminHeaders, encodeByteArray, executeIntent, executeIntents, executeSponsored, fdvHuman, generateStarkKeyPair, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isSiwsTokenValid, normalizeSiwsSignature, ownerAliveTypedData, ownerConstructorCalldata, parseAdminHeaders, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sealPrivateKey, sessionKeyHashOf, signAdminRequest, signWithPrivateKey, starkKeyPairFromPrivateKey, storeSiwsToken, teamCoinsRaw, toContractConditions as toDropContractConditions, unsealPrivateKey, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyAdminRequestSig };
|
|
7968
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, APPROVAL_PATH, type AddSupplyParams, type AdminGrant, type AdminRequest, type AdminRequestSig, type AdminSession, type AdminSessionTypedDataInput, type ApprovalRequest, type BatchMintEditionParams, type BuildFeeCallParams, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClaimConditions, ClubService, type CreateCreatorCoinParams, CreateDropParams, type CreateGrantOpts, CreatePopCollectionParams, CreatorCoinFactoryABI, type CreatorCoinGuarantees, type CreatorCoinReceiptLike, CreatorCoinService, type DeployCollectionParams, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, type EkuboLaunchParams, type EkuboPoolParams, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecuteIntentOpts, type FeeSurface, type GuardianInfo, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidApprovalRequestError, InvalidStarkPrivateKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, type MintEditionParams, POPCollectionABI, POPFactoryABI, type ParsedAdminHeaders, PopService, type ReceiptProvider, type RequestSiwsTokenArgs, type ResolvedOrder, SUGGESTED_DEFAULT_PRICE, type SiwsSigner, SponsoredCallRejectedError, type SponsoredExecuteConfig, type SponsoredExecuteResult, SponsorshipService, StarknetVenue, type StarknetVenueDeps, type StarknetVenueSigner, TicketService, type TypedDataSigner, VALIDATED_EKUBO_PARAMS, VenueSigner, adminRequestDigest, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildAdminSessionTypedData, buildApprovalUrl, buildCancelEscapeCall, buildCancellationTypedData, buildChangeOwnersCall, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildReturnUrl, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, toRaw as coinToRaw, computeAccountAddress, computeOwnerGuid, confirmIntentBestEffort, createAdminSessionGrant, decodeEscapeAndStatus, decodeGuardiansInfo, deriveAesKey, deriveOwnerKeyPair, deriveStarkKeyPair, encodeAdminHeaders, encodeByteArray, executeIntent, executeIntents, executeSponsored, fdvHuman, generateStarkKeyPair, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isMedialaneOrigin, isSiwsTokenValid, normalizeSiwsSignature, ownerAliveTypedData, ownerConstructorCalldata, parseAdminHeaders, parseApprovalRequest, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sealPrivateKey, sessionKeyHashOf, signAdminRequest, signWithPrivateKey, starkKeyPairFromPrivateKey, storeSiwsToken, teamCoinsRaw, toContractConditions as toDropContractConditions, unsealPrivateKey, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyAdminRequestSig };
|
package/dist/starknet/index.js
CHANGED
|
@@ -11910,6 +11910,25 @@ async function deriveAesKey(prfSecret, hkdfInfo) {
|
|
|
11910
11910
|
["encrypt", "decrypt"]
|
|
11911
11911
|
);
|
|
11912
11912
|
}
|
|
11913
|
+
var STARK_KEY_INFO = new TextEncoder().encode("medialane/passkey/stark-key/v1");
|
|
11914
|
+
var DERIVE_BITS = 384;
|
|
11915
|
+
function bytesToBigInt(bytes) {
|
|
11916
|
+
let value = 0n;
|
|
11917
|
+
for (const byte of bytes) value = value << 8n | BigInt(byte);
|
|
11918
|
+
return value;
|
|
11919
|
+
}
|
|
11920
|
+
async function deriveStarkKeyPair(prfSecret) {
|
|
11921
|
+
const hkdf = await crypto.subtle.importKey("raw", prfSecret, "HKDF", false, ["deriveBits"]);
|
|
11922
|
+
const bits = await crypto.subtle.deriveBits(
|
|
11923
|
+
{ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(0), info: STARK_KEY_INFO },
|
|
11924
|
+
hkdf,
|
|
11925
|
+
DERIVE_BITS
|
|
11926
|
+
);
|
|
11927
|
+
const order = ec.starkCurve.CURVE.n;
|
|
11928
|
+
const value = bytesToBigInt(new Uint8Array(bits)) % (order - 1n) + 1n;
|
|
11929
|
+
const privateKeyHex = "0x" + value.toString(16).padStart(64, "0");
|
|
11930
|
+
return { privateKeyHex, publicKeyHex: ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
11931
|
+
}
|
|
11913
11932
|
function generateStarkKeyPair() {
|
|
11914
11933
|
const privateKeyHex = "0x" + Array.from(ec.starkCurve.utils.randomPrivateKey()).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
11915
11934
|
return { privateKeyHex, publicKeyHex: ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
@@ -11948,6 +11967,70 @@ function signWithPrivateKey(privateKeyHex, msgHash) {
|
|
|
11948
11967
|
return [num.toHex(sig.r), num.toHex(sig.s)];
|
|
11949
11968
|
}
|
|
11950
11969
|
|
|
11951
|
-
|
|
11970
|
+
// src/starknet/app-approval/approval.ts
|
|
11971
|
+
var MEDIALANE_SUFFIX = ".medialane.io";
|
|
11972
|
+
var STARK_ORDER2 = (1n << 251n) + 17n * (1n << 192n) + 1n;
|
|
11973
|
+
var APPROVAL_PATH = "/approve-app";
|
|
11974
|
+
var InvalidApprovalRequestError = class extends Error {
|
|
11975
|
+
constructor(message) {
|
|
11976
|
+
super(message);
|
|
11977
|
+
this.name = "InvalidApprovalRequestError";
|
|
11978
|
+
}
|
|
11979
|
+
};
|
|
11980
|
+
function isMedialaneOrigin(url) {
|
|
11981
|
+
let parsed;
|
|
11982
|
+
try {
|
|
11983
|
+
parsed = new URL(url);
|
|
11984
|
+
} catch {
|
|
11985
|
+
return false;
|
|
11986
|
+
}
|
|
11987
|
+
if (parsed.protocol !== "https:") return parsed.hostname === "localhost";
|
|
11988
|
+
return parsed.hostname === "medialane.io" || parsed.hostname.endsWith(MEDIALANE_SUFFIX);
|
|
11989
|
+
}
|
|
11990
|
+
function assertPublicKey(value) {
|
|
11991
|
+
if (!/^0x[0-9a-fA-F]{1,64}$/.test(value)) {
|
|
11992
|
+
throw new InvalidApprovalRequestError("That is not a wallet key.");
|
|
11993
|
+
}
|
|
11994
|
+
const scalar = BigInt(value);
|
|
11995
|
+
if (scalar === 0n || scalar >= STARK_ORDER2) {
|
|
11996
|
+
throw new InvalidApprovalRequestError("That is not a wallet key.");
|
|
11997
|
+
}
|
|
11998
|
+
return `0x${scalar.toString(16)}`;
|
|
11999
|
+
}
|
|
12000
|
+
function assertAppName(value) {
|
|
12001
|
+
const name = value.replace(/\s+/g, " ").trim().slice(0, 40);
|
|
12002
|
+
if (!name) throw new InvalidApprovalRequestError("The app asking has no name.");
|
|
12003
|
+
return name;
|
|
12004
|
+
}
|
|
12005
|
+
function assertReturnUrl(value) {
|
|
12006
|
+
if (!isMedialaneOrigin(value)) {
|
|
12007
|
+
throw new InvalidApprovalRequestError("That app is not part of Medialane.");
|
|
12008
|
+
}
|
|
12009
|
+
return value;
|
|
12010
|
+
}
|
|
12011
|
+
function buildApprovalUrl(approverOrigin, request) {
|
|
12012
|
+
if (!isMedialaneOrigin(approverOrigin)) {
|
|
12013
|
+
throw new InvalidApprovalRequestError("That app is not part of Medialane.");
|
|
12014
|
+
}
|
|
12015
|
+
const url = new URL(APPROVAL_PATH, approverOrigin);
|
|
12016
|
+
url.searchParams.set("key", assertPublicKey(request.publicKey));
|
|
12017
|
+
url.searchParams.set("app", assertAppName(request.appName));
|
|
12018
|
+
url.searchParams.set("return", assertReturnUrl(request.returnUrl));
|
|
12019
|
+
return url.toString();
|
|
12020
|
+
}
|
|
12021
|
+
function parseApprovalRequest(params) {
|
|
12022
|
+
return {
|
|
12023
|
+
publicKey: assertPublicKey(params.get("key") ?? ""),
|
|
12024
|
+
appName: assertAppName(params.get("app") ?? ""),
|
|
12025
|
+
returnUrl: assertReturnUrl(params.get("return") ?? "")
|
|
12026
|
+
};
|
|
12027
|
+
}
|
|
12028
|
+
function buildReturnUrl(returnUrl, outcome) {
|
|
12029
|
+
const url = new URL(assertReturnUrl(returnUrl));
|
|
12030
|
+
url.searchParams.set("approval", outcome);
|
|
12031
|
+
return url.toString();
|
|
12032
|
+
}
|
|
12033
|
+
|
|
12034
|
+
export { ADMIN_HEADERS, ADMIN_SCOPE, APPROVAL_PATH, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidApprovalRequestError, InvalidStarkPrivateKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, adminRequestDigest, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildAdminSessionTypedData, buildApprovalUrl, buildCancelEscapeCall, buildCancellationTypedData, buildChangeOwnersCall, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildReturnUrl, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, toRaw as coinToRaw, computeAccountAddress, computeOwnerGuid, confirmIntentBestEffort, createAdminSessionGrant, decodeEscapeAndStatus, decodeGuardiansInfo, deriveAesKey, deriveOwnerKeyPair, deriveStarkKeyPair, encodeAdminHeaders, encodeByteArray, executeIntent, executeIntents, executeSponsored, fdvHuman, generateStarkKeyPair, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isMedialaneOrigin, isSiwsTokenValid, normalizeSiwsSignature, ownerAliveTypedData, ownerConstructorCalldata, parseAdminHeaders, parseApprovalRequest, parseCreatorCoinCreated, priceToEkuboParams, randomNonce, requestSiwsToken, sealPrivateKey, sessionKeyHashOf, signAdminRequest, signWithPrivateKey, starkKeyPairFromPrivateKey, storeSiwsToken, teamCoinsRaw, toContractConditions as toDropContractConditions, unsealPrivateKey, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyAdminRequestSig };
|
|
11952
12035
|
//# sourceMappingURL=index.js.map
|
|
11953
12036
|
//# sourceMappingURL=index.js.map
|