New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@crossmint/common-sdk-base

Package Overview
Dependencies
Maintainers
8
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crossmint/common-sdk-base - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0

1

dist/index.d.ts

@@ -78,2 +78,3 @@ declare abstract class ApiClient {

jwt?: string;
refreshToken?: string;
overrideBaseUrl?: string;

@@ -80,0 +81,0 @@ };

2

dist/index.js

@@ -1,2 +0,2 @@

var H=Object.defineProperty,w=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var S=(t,e,i)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,r=(t,e)=>{for(var i in e||(e={}))j.call(e,i)&&S(t,i,e[i]);if(K)for(var i of K(e))Y.call(e,i)&&S(t,i,e[i]);return t},u=(t,e)=>w(t,z(e));var p=(t,e,i)=>new Promise((n,o)=>{var s=a=>{try{I(i.next(a))}catch(T){o(T)}},m=a=>{try{I(i.throw(a))}catch(T){o(T)}},I=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,m);I((i=i.apply(t,e)).next())});var P=class t{makeRequest(e,i){return p(this,null,function*(){return fetch(this.buildUrl(e),u(r({},i),{headers:r(r({},this.authHeaders),i.headers)}))})}buildUrl(e){return`${t.normalizePath(this.baseUrl)}/${t.normalizePath(e)}`}get(e,i){return p(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"GET"}))})}post(e,i){return p(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"POST"}))})}put(e,i){return p(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"PUT"}))})}delete(e,i){return p(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"DELETE"}))})}patch(e,i){return p(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"PATCH"}))})}static normalizePath(e){return e=e.startsWith("/")?e.slice(1):e,e=e.endsWith("/")?e.slice(0,-1):e,e}};function k(t,e){switch(t){case"development":return(e==null?void 0:e.development)||"http://localhost:3000";case"staging":return(e==null?void 0:e.staging)||"https://staging.crossmint.com";case"production":return(e==null?void 0:e.production)||"https://www.crossmint.com"}}import h from"bs58";import F from"tweetnacl";var g="3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5",A="8erZh8YApGck3iUSUHqATBxqMTM1Ukp9mHmvGgUWHtkK",V="http://localhost:3000/",R="https://staging.crossmint.com/",B="https://www.crossmint.com/";function C(t){switch(t){case"development":case"staging":return g;case"production":return A;default:return null}}var y={CLIENT:"ck",SERVER:"sk"},l={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},x={CLIENT:"client",SERVER:"server"};function _(t){return t==="client"?"ck":"sk"}var $={development:V,staging:R,production:B};function de(t){let e=d(t);if(!e.isValid)throw new Error("Crossmint API key is invalid");return $[e.environment]}function N(t,e){if(q(t))return{isValid:!1,message:"Old API key format detected. Please create a new API key from the Crossmint console."};let i=W(t);if(i==null)return{isValid:!1,message:`Malformed API key. Must start with '${y.CLIENT}' or '${y.SERVER}'.`};if((e==null?void 0:e.usageOrigin)!=null&&i!==e.usageOrigin)return{isValid:!1,message:`Disallowed API key. You passed a ${i} API key, but a ${e.usageOrigin} API key is required.`};let n=Z(t);return n==null?{isValid:!1,message:`Malformed API key. Must have a valid environment: '${l.DEVELOPMENT}', '${l.STAGING}' or '${l.PRODUCTION}'.`}:(e==null?void 0:e.environment)!=null&&n!==e.environment?{isValid:!1,message:`Disallowed API key. You passed a ${n} API key, but a ${e.environment} API key is required.`}:{isValid:!0,usageOrigin:i,environment:n,prefix:`${_(i)}_${n}`}}function q(t){return t.startsWith("sk_live")||t.startsWith("sk_test")}function W(t){return t.startsWith(y.CLIENT+"_")?x.CLIENT:t.startsWith(y.SERVER+"_")?x.SERVER:null}function Z(t){let e=t.slice(3);return e.startsWith(l.DEVELOPMENT+"_")?l.DEVELOPMENT:e.startsWith(l.STAGING+"_")?l.STAGING:e.startsWith(l.PRODUCTION+"_")?l.PRODUCTION:null}function d(t,e){let i=N(t,e);if(!i.isValid)return i;let{prefix:n}=i,{keyData:o,keyDataWithoutPrefix:s,signature:m}=J(t,n);if(!X(o,m,e))return{isValid:!1,message:"Invalid API key. Failed to validate signature"};let[a]=s.split(".");return u(r({},i),{projectId:a})}function J(t,e){let i=t.slice(`${e}_`.length),n=h.decode(i),o=new TextDecoder().decode(n),[s,m]=o.split(":");return{keyData:`${e}.${s}`,keyDataWithoutPrefix:s,signature:m}}function X(t,e,i){let n=C(i==null?void 0:i.environment);function o(s){try{let m=h.decode(e),I=new TextEncoder().encode(t),a=h.decode(s);return F.sign.detached.verify(I,m,a)}catch(m){return console.error("Failed to validate API key signature"),!1}}return n!=null?o(n):o(A)||o(g)}var b=class extends P{constructor(i,{internalConfig:n}){let o=d(i.apiKey,n.apiKeyExpectations);if(!o.isValid)throw new Error(o.message);super();this.crossmint=i;this.parsedAPIKey=o,this.internalConfig=n}get baseUrl(){if(this.crossmint.overrideBaseUrl)return P.normalizePath(this.crossmint.overrideBaseUrl);let i=k(this.parsedAPIKey.environment);return P.normalizePath(i)}get authHeaders(){return r({"x-api-key":this.crossmint.apiKey},this.crossmint.jwt?{Authorization:`Bearer ${this.crossmint.jwt}`}:{})}};function Ge(t,e){let{apiKey:i,jwt:n,overrideBaseUrl:o}=t,s=d(i,e);if(!s.isValid)throw new Error(s.message);return{apiKey:i,jwt:n,overrideBaseUrl:o}}function c(t){return Object.values(t)}var f={ETHEREUM:"ethereum",POLYGON:"polygon",BSC:"bsc",OPTIMISM:"optimism",ARBITRUM:"arbitrum",BASE:"base",ZORA:"zora",ARBITRUMNOVA:"arbitrumnova",ZKATANA:"zkatana",ZKYOTO:"zkyoto",ASTAR_ZKEVM:"astar-zkevm",APEX:"apex"},je=c(f),E={ARBITRUM_SEPOLIA:"arbitrum-sepolia",BASE_GOERLI:"base-goerli",BASE_SEPOLIA:"base-sepolia",BSC_TESTNET:"bsc-testnet",ETHEREUM_GOERLI:"ethereum-goerli",ETHEREUM_SEPOLIA:"ethereum-sepolia",POLYGON_MUMBAI:"polygon-mumbai",POLYGON_AMOY:"polygon-amoy",OPTIMISM_GOERLI:"optimism-goerli",OPTIMISM_SEPOLIA:"optimism-sepolia",ZORA_GOERLI:"zora-goerli",ZORA_SEPOLIA:"zora-sepolia",HYPERSONIC_TESTNET:"hypersonic-testnet"},Ye=c(E),Q=r(r({},f),E),v=c(Q);var ee={EVM:"evm",SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},Fe=c(ee);var U=r({SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},f),L=c(U),M=r({},E),tt=c(M),te=r(r({},U),M),G=c(te);function ut(t,e){return e?t===e:L.includes(t)}function D(t,e){return e?t===e:G.includes(t)}var ie={aptos:"Aptos",solana:"Solana",ethereum:"Ethereum","ethereum-sepolia":"Ethereum Sepolia","ethereum-goerli":"Ethereum Goerli",polygon:"Polygon","polygon-mumbai":"Polygon Mumbai","polygon-amoy":"Polygon Amoy Testnet",cardano:"Cardano",bsc:"BNB Smart Chain","bsc-testnet":"BNB Smart Chain Testnet",sui:"Sui",optimism:"Optimism","optimism-goerli":"Optimism Goerli","optimism-sepolia":"Optimism Sepolia",arbitrum:"Arbitrum","arbitrum-sepolia":"Arbitrum Sepolia",arbitrumnova:"Arbitrum Nova",base:"Base","base-goerli":"Base Goerli","base-sepolia":"Base Sepolia",zora:"Zora","zora-goerli":"Zora Goerli","zora-sepolia":"Zora Sepolia",zkatana:"zKatana",zkyoto:"zKyoto","astar-zkevm":"Astar zkEVM",apex:"Apex","hypersonic-testnet":"Hypersonic Testnet"};function yt(t){return ie[t]}var O={ethereum:1,polygon:137,bsc:56,optimism:10,arbitrum:42161,base:8453,zora:7777777,arbitrumnova:42170,"ethereum-sepolia":11155111,"ethereum-goerli":5,"polygon-mumbai":80001,"polygon-amoy":80002,"bsc-testnet":97,"optimism-sepolia":11155420,"optimism-goerli":420,"base-goerli":84531,"base-sepolia":84532,"arbitrum-sepolia":421614,"zora-sepolia":999999999,"zora-goerli":999,zkatana:1261120,zkyoto:6038361,"astar-zkevm":3776,apex:70700,"hypersonic-testnet":675852};function At(t){return O[t]}var re=Object.entries(O).reduce((t,[e,i])=>(t[i]=e,t),{});function Tt(t){return re[t]}function St(t){return v.some(e=>D(t,e))}export{l as APIKeyEnvironmentPrefix,x as APIKeyUsageOrigin,y as APIKeyUsageOriginPrefix,P as ApiClient,L as BLOCKCHAINS,G as BLOCKCHAINS_INCLUDING_TESTNETS,Fe as BLOCKCHAIN_BASE_LAYERS,tt as BLOCKCHAIN_TESTNETS,O as BLOCKCHAIN_TO_CHAIN_ID,ie as BLOCKCHAIN_TO_COPY_NAME,U as Blockchain,ee as BlockchainBaseLayer,te as BlockchainIncludingTestnet,M as BlockchainTestnet,re as CHAIN_ID_TO_BLOCKCHAIN,A as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD,g as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING,V as CROSSMINT_DEV_URL,B as CROSSMINT_PROD_URL,R as CROSSMINT_STG_URL,b as CrossmintApiClient,f as EVMBlockchain,Q as EVMBlockchainIncludingTestnet,E as EVMBlockchainTestnet,v as EVM_BLOCKCHAINS_INCLUDING_TESTNETS,Ye as EVM_BLOCKCHAIN_TESTNETS,je as EVM_CHAINS,At as blockchainToChainId,yt as blockchainToDisplayName,Tt as chainIdToBlockchain,Ge as createCrossmint,k as environmentToCrossmintBaseURL,C as environmentToExpectedPublicKey,Z as getEnvironmentForKey,ut as isBlockchain,D as isBlockchainIncludingTestnets,St as isEVMBlockchain,c as objectValues,_ as usageOriginToPrefix,d as validateAPIKey,N as validateAPIKeyPrefix,de as validateApiKeyAndGetCrossmintBaseUrl};
var H=Object.defineProperty,w=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var S=(t,e,i)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,r=(t,e)=>{for(var i in e||(e={}))j.call(e,i)&&S(t,i,e[i]);if(K)for(var i of K(e))Y.call(e,i)&&S(t,i,e[i]);return t},u=(t,e)=>w(t,z(e));var y=(t,e,i)=>new Promise((n,o)=>{var l=a=>{try{m(i.next(a))}catch(T){o(T)}},s=a=>{try{m(i.throw(a))}catch(T){o(T)}},m=a=>a.done?n(a.value):Promise.resolve(a.value).then(l,s);m((i=i.apply(t,e)).next())});var I=class t{makeRequest(e,i){return y(this,null,function*(){return fetch(this.buildUrl(e),u(r({},i),{headers:r(r({},this.authHeaders),i.headers)}))})}buildUrl(e){return`${t.normalizePath(this.baseUrl)}/${t.normalizePath(e)}`}get(e,i){return y(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"GET"}))})}post(e,i){return y(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"POST"}))})}put(e,i){return y(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"PUT"}))})}delete(e,i){return y(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"DELETE"}))})}patch(e,i){return y(this,null,function*(){return this.makeRequest(e,u(r({},i),{method:"PATCH"}))})}static normalizePath(e){return e=e.startsWith("/")?e.slice(1):e,e=e.endsWith("/")?e.slice(0,-1):e,e}};function k(t,e){switch(t){case"development":return(e==null?void 0:e.development)||"http://localhost:3000";case"staging":return(e==null?void 0:e.staging)||"https://staging.crossmint.com";case"production":return(e==null?void 0:e.production)||"https://www.crossmint.com"}}import x from"bs58";import F from"tweetnacl";var g="3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5",f="8erZh8YApGck3iUSUHqATBxqMTM1Ukp9mHmvGgUWHtkK",V="http://localhost:3000/",R="https://staging.crossmint.com/",B="https://www.crossmint.com/";function C(t){switch(t){case"development":case"staging":return g;case"production":return f;default:return null}}var d={CLIENT:"ck",SERVER:"sk"},c={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},h={CLIENT:"client",SERVER:"server"};function _(t){return t==="client"?"ck":"sk"}var $={development:V,staging:R,production:B};function Pe(t){let e=P(t);if(!e.isValid)throw new Error("Crossmint API key is invalid");return $[e.environment]}function N(t,e){if(q(t))return{isValid:!1,message:"Old API key format detected. Please create a new API key from the Crossmint console."};let i=W(t);if(i==null)return{isValid:!1,message:`Malformed API key. Must start with '${d.CLIENT}' or '${d.SERVER}'.`};if((e==null?void 0:e.usageOrigin)!=null&&i!==e.usageOrigin)return{isValid:!1,message:`Disallowed API key. You passed a ${i} API key, but a ${e.usageOrigin} API key is required.`};let n=Z(t);return n==null?{isValid:!1,message:`Malformed API key. Must have a valid environment: '${c.DEVELOPMENT}', '${c.STAGING}' or '${c.PRODUCTION}'.`}:(e==null?void 0:e.environment)!=null&&n!==e.environment?{isValid:!1,message:`Disallowed API key. You passed a ${n} API key, but a ${e.environment} API key is required.`}:{isValid:!0,usageOrigin:i,environment:n,prefix:`${_(i)}_${n}`}}function q(t){return t.startsWith("sk_live")||t.startsWith("sk_test")}function W(t){return t.startsWith(d.CLIENT+"_")?h.CLIENT:t.startsWith(d.SERVER+"_")?h.SERVER:null}function Z(t){let e=t.slice(3);return e.startsWith(c.DEVELOPMENT+"_")?c.DEVELOPMENT:e.startsWith(c.STAGING+"_")?c.STAGING:e.startsWith(c.PRODUCTION+"_")?c.PRODUCTION:null}function P(t,e){let i=N(t,e);if(!i.isValid)return i;let{prefix:n}=i,{keyData:o,keyDataWithoutPrefix:l,signature:s}=J(t,n);if(!X(o,s,e))return{isValid:!1,message:"Invalid API key. Failed to validate signature"};let[a]=l.split(".");return u(r({},i),{projectId:a})}function J(t,e){let i=t.slice(`${e}_`.length),n=x.decode(i),o=new TextDecoder().decode(n),[l,s]=o.split(":");return{keyData:`${e}.${l}`,keyDataWithoutPrefix:l,signature:s}}function X(t,e,i){let n=C(i==null?void 0:i.environment);function o(l){try{let s=x.decode(e),m=new TextEncoder().encode(t),a=x.decode(l);return F.sign.detached.verify(m,s,a)}catch(s){return console.error("Failed to validate API key signature"),!1}}return n!=null?o(n):o(f)||o(g)}var b=class extends I{constructor(i,{internalConfig:n}){let o=P(i.apiKey,n.apiKeyExpectations);if(!o.isValid)throw new Error(o.message);super();this.crossmint=i;this.parsedAPIKey=o,this.internalConfig=n}get baseUrl(){if(this.crossmint.overrideBaseUrl)return I.normalizePath(this.crossmint.overrideBaseUrl);let i=k(this.parsedAPIKey.environment);return I.normalizePath(i)}get authHeaders(){return r({"x-api-key":this.crossmint.apiKey},this.crossmint.jwt?{Authorization:`Bearer ${this.crossmint.jwt}`}:{})}};function Ne(t,e){let{apiKey:i,jwt:n,refreshToken:o,overrideBaseUrl:l}=t,s=P(i,e);if(!s.isValid)throw new Error(s.message);return{apiKey:i,jwt:n,refreshToken:o,overrideBaseUrl:l}}function p(t){return Object.values(t)}var A={ETHEREUM:"ethereum",POLYGON:"polygon",BSC:"bsc",OPTIMISM:"optimism",ARBITRUM:"arbitrum",BASE:"base",ZORA:"zora",ARBITRUMNOVA:"arbitrumnova",ZKATANA:"zkatana",ZKYOTO:"zkyoto",ASTAR_ZKEVM:"astar-zkevm",APEX:"apex"},Le=p(A),E={ARBITRUM_SEPOLIA:"arbitrum-sepolia",BASE_GOERLI:"base-goerli",BASE_SEPOLIA:"base-sepolia",BSC_TESTNET:"bsc-testnet",ETHEREUM_GOERLI:"ethereum-goerli",ETHEREUM_SEPOLIA:"ethereum-sepolia",POLYGON_MUMBAI:"polygon-mumbai",POLYGON_AMOY:"polygon-amoy",OPTIMISM_GOERLI:"optimism-goerli",OPTIMISM_SEPOLIA:"optimism-sepolia",ZORA_GOERLI:"zora-goerli",ZORA_SEPOLIA:"zora-sepolia",HYPERSONIC_TESTNET:"hypersonic-testnet"},Me=p(E),Q=r(r({},A),E),v=p(Q);var ee={EVM:"evm",SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},we=p(ee);var U=r({SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},A),L=p(U),M=r({},E),$e=p(M),te=r(r({},U),M),G=p(te);function et(t,e){return e?t===e:L.includes(t)}function D(t,e){return e?t===e:G.includes(t)}var ie={aptos:"Aptos",solana:"Solana",ethereum:"Ethereum","ethereum-sepolia":"Ethereum Sepolia","ethereum-goerli":"Ethereum Goerli",polygon:"Polygon","polygon-mumbai":"Polygon Mumbai","polygon-amoy":"Polygon Amoy Testnet",cardano:"Cardano",bsc:"BNB Smart Chain","bsc-testnet":"BNB Smart Chain Testnet",sui:"Sui",optimism:"Optimism","optimism-goerli":"Optimism Goerli","optimism-sepolia":"Optimism Sepolia",arbitrum:"Arbitrum","arbitrum-sepolia":"Arbitrum Sepolia",arbitrumnova:"Arbitrum Nova",base:"Base","base-goerli":"Base Goerli","base-sepolia":"Base Sepolia",zora:"Zora","zora-goerli":"Zora Goerli","zora-sepolia":"Zora Sepolia",zkatana:"zKatana",zkyoto:"zKyoto","astar-zkevm":"Astar zkEVM",apex:"Apex","hypersonic-testnet":"Hypersonic Testnet"};function nt(t){return ie[t]}var O={ethereum:1,polygon:137,bsc:56,optimism:10,arbitrum:42161,base:8453,zora:7777777,arbitrumnova:42170,"ethereum-sepolia":11155111,"ethereum-goerli":5,"polygon-mumbai":80001,"polygon-amoy":80002,"bsc-testnet":97,"optimism-sepolia":11155420,"optimism-goerli":420,"base-goerli":84531,"base-sepolia":84532,"arbitrum-sepolia":421614,"zora-sepolia":999999999,"zora-goerli":999,zkatana:1261120,zkyoto:6038361,"astar-zkevm":3776,apex:70700,"hypersonic-testnet":675852};function st(t){return O[t]}var re=Object.entries(O).reduce((t,[e,i])=>(t[i]=e,t),{});function ct(t){return re[t]}function yt(t){return v.some(e=>D(t,e))}export{c as APIKeyEnvironmentPrefix,h as APIKeyUsageOrigin,d as APIKeyUsageOriginPrefix,I as ApiClient,L as BLOCKCHAINS,G as BLOCKCHAINS_INCLUDING_TESTNETS,we as BLOCKCHAIN_BASE_LAYERS,$e as BLOCKCHAIN_TESTNETS,O as BLOCKCHAIN_TO_CHAIN_ID,ie as BLOCKCHAIN_TO_COPY_NAME,U as Blockchain,ee as BlockchainBaseLayer,te as BlockchainIncludingTestnet,M as BlockchainTestnet,re as CHAIN_ID_TO_BLOCKCHAIN,f as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD,g as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING,V as CROSSMINT_DEV_URL,B as CROSSMINT_PROD_URL,R as CROSSMINT_STG_URL,b as CrossmintApiClient,A as EVMBlockchain,Q as EVMBlockchainIncludingTestnet,E as EVMBlockchainTestnet,v as EVM_BLOCKCHAINS_INCLUDING_TESTNETS,Me as EVM_BLOCKCHAIN_TESTNETS,Le as EVM_CHAINS,st as blockchainToChainId,nt as blockchainToDisplayName,ct as chainIdToBlockchain,Ne as createCrossmint,k as environmentToCrossmintBaseURL,C as environmentToExpectedPublicKey,Z as getEnvironmentForKey,et as isBlockchain,D as isBlockchainIncludingTestnets,yt as isEVMBlockchain,p as objectValues,_ as usageOriginToPrefix,P as validateAPIKey,N as validateAPIKeyPrefix,Pe as validateApiKeyAndGetCrossmintBaseUrl};
//# sourceMappingURL=index.js.map
{
"name": "@crossmint/common-sdk-base",
"version": "0.1.4",
"version": "0.2.0",
"repository": "https://github.com/Crossmint/crossmint-sdk",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

import { environmentToCrossmintBaseURL } from "@/apiKey/utils/environmentToCrossmintBaseURL";
import { ValidateApiKeySuccessResult, validateAPIKey } from "@/apiKey/validateAPIKey";
import { ValidateAPIKeyPrefixExpectations } from "@/apiKey/validateAPIKeyPrefix";
import { Crossmint } from "@/types/Crossmint";
import { type ValidateApiKeySuccessResult, validateAPIKey } from "@/apiKey/validateAPIKey";
import type { ValidateAPIKeyPrefixExpectations } from "@/apiKey/validateAPIKeyPrefix";
import type { Crossmint } from "@/types/Crossmint";

@@ -6,0 +6,0 @@ import { ApiClient } from "./ApiClient";

@@ -1,2 +0,2 @@

import { APIKeyEnvironmentPrefix } from "../types";
import type { APIKeyEnvironmentPrefix } from "../types";

@@ -3,0 +3,0 @@ export function environmentToCrossmintBaseURL(

import { CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING } from "../consts";
import { APIKeyEnvironmentPrefix } from "../types";
import type { APIKeyEnvironmentPrefix } from "../types";

@@ -4,0 +4,0 @@ export function environmentToExpectedPublicKey(environment?: APIKeyEnvironmentPrefix): string | null {

@@ -1,2 +0,2 @@

import { APIKeyUsageOrigin, APIKeyUsageOriginPrefix } from "../types";
import type { APIKeyUsageOrigin, APIKeyUsageOriginPrefix } from "../types";

@@ -3,0 +3,0 @@ export function usageOriginToPrefix(usageOrigin: APIKeyUsageOrigin): APIKeyUsageOriginPrefix {

import { CROSSMINT_DEV_URL, CROSSMINT_PROD_URL, CROSSMINT_STG_URL } from "../consts";
import { APIKeyEnvironmentPrefix } from "../types";
import type { APIKeyEnvironmentPrefix } from "../types";
import { validateAPIKey } from "../validateAPIKey";

@@ -4,0 +4,0 @@

@@ -5,8 +5,8 @@ import base58 from "bs58";

import { CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING } from "./consts";
import { APIKeyPrefix } from "./types";
import type { APIKeyPrefix } from "./types";
import { environmentToExpectedPublicKey } from "./utils/environmentToExpectedPublicKey";
import {
ValidateAPIKeyFailResult,
ValidateAPIKeyPrefixExpectations,
ValidateAPIKeyPrefixSuccessData,
type ValidateAPIKeyFailResult,
type ValidateAPIKeyPrefixExpectations,
type ValidateAPIKeyPrefixSuccessData,
validateAPIKeyPrefix,

@@ -13,0 +13,0 @@ } from "./validateAPIKeyPrefix";

@@ -1,2 +0,2 @@

import { APIKeyEnvironmentPrefix, APIKeyPrefix, APIKeyUsageOrigin, APIKeyUsageOriginPrefix } from "./types";
import { APIKeyEnvironmentPrefix, type APIKeyPrefix, APIKeyUsageOrigin, APIKeyUsageOriginPrefix } from "./types";
import { usageOriginToPrefix } from "./utils";

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { ObjectValues, objectValues } from "@/types";
import { type ObjectValues, objectValues } from "@/types";

@@ -3,0 +3,0 @@ export const BlockchainBaseLayer = {

@@ -1,2 +0,2 @@

import { ObjectValues, objectValues } from "@/types";
import { type ObjectValues, objectValues } from "@/types";

@@ -3,0 +3,0 @@ export const EVMBlockchain = {

@@ -1,2 +0,2 @@

import { ObjectValues, objectValues } from "../..";
import { type ObjectValues, objectValues } from "../..";
import { EVMBlockchain, EVMBlockchainTestnet } from "./evm";

@@ -3,0 +3,0 @@

@@ -1,3 +0,3 @@

import { Blockchain } from ".";
import { EVMBlockchainIncludingTestnet } from "./evm";
import type { Blockchain } from ".";
import type { EVMBlockchainIncludingTestnet } from "./evm";

@@ -4,0 +4,0 @@ export interface EVMNFT {

@@ -1,2 +0,2 @@

import { BlockchainIncludingTestnet } from "../types";
import type { BlockchainIncludingTestnet } from "../types";

@@ -3,0 +3,0 @@ export const BLOCKCHAIN_TO_COPY_NAME: Record<BlockchainIncludingTestnet, string> = {

@@ -1,2 +0,2 @@

import { EVMBlockchainIncludingTestnet } from "../../types/evm";
import type { EVMBlockchainIncludingTestnet } from "../../types/evm";

@@ -3,0 +3,0 @@ export const BLOCKCHAIN_TO_CHAIN_ID: Record<EVMBlockchainIncludingTestnet, number> = {

@@ -1,2 +0,2 @@

import { EVMBlockchainIncludingTestnet } from "../../types";
import type { EVMBlockchainIncludingTestnet } from "../../types";
import { BLOCKCHAIN_TO_CHAIN_ID } from "./blockchainToChainId";

@@ -6,6 +6,9 @@

BLOCKCHAIN_TO_CHAIN_ID
).reduce((acc, [key, value]) => {
acc[value] = key as EVMBlockchainIncludingTestnet;
return acc;
}, {} as Record<number, EVMBlockchainIncludingTestnet>);
).reduce(
(acc, [key, value]) => {
acc[value] = key as EVMBlockchainIncludingTestnet;
return acc;
},
{} as Record<number, EVMBlockchainIncludingTestnet>
);

@@ -12,0 +15,0 @@ export function chainIdToBlockchain(chainId: number): EVMBlockchainIncludingTestnet | undefined {

@@ -1,2 +0,2 @@

import { EVMBlockchainIncludingTestnet, EVM_BLOCKCHAINS_INCLUDING_TESTNETS } from "../../types";
import { type EVMBlockchainIncludingTestnet, EVM_BLOCKCHAINS_INCLUDING_TESTNETS } from "../../types";
import { isBlockchainIncludingTestnets } from "../isBlockchainIncludingTestnets";

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { BLOCKCHAINS, Blockchain } from "../types";
import { BLOCKCHAINS, type Blockchain } from "../types";

@@ -3,0 +3,0 @@ export function isBlockchain<T extends Blockchain = Blockchain>(value: unknown, expectedBlockchain?: T): value is T {

@@ -1,2 +0,2 @@

import { BLOCKCHAINS_INCLUDING_TESTNETS, Blockchain, BlockchainIncludingTestnet } from "../types";
import { BLOCKCHAINS_INCLUDING_TESTNETS, type Blockchain, type BlockchainIncludingTestnet } from "../types";

@@ -3,0 +3,0 @@ export function isBlockchainIncludingTestnets<T extends BlockchainIncludingTestnet = BlockchainIncludingTestnet>(

@@ -1,2 +0,2 @@

import { ValidateAPIKeyPrefixExpectations, validateAPIKey } from "@/apiKey";
import { type ValidateAPIKeyPrefixExpectations, validateAPIKey } from "@/apiKey";

@@ -6,2 +6,3 @@ export type Crossmint = {

jwt?: string;
refreshToken?: string;
overrideBaseUrl?: string;

@@ -11,3 +12,3 @@ };

export function createCrossmint(config: Crossmint, apiKeyExpectations?: ValidateAPIKeyPrefixExpectations): Crossmint {
const { apiKey, jwt, overrideBaseUrl } = config;
const { apiKey, jwt, refreshToken, overrideBaseUrl } = config;
const apiKeyValidationResult = validateAPIKey(apiKey, apiKeyExpectations);

@@ -20,4 +21,5 @@ if (!apiKeyValidationResult.isValid) {

jwt,
refreshToken,
overrideBaseUrl,
};
}

@@ -1,4 +0,4 @@

import { NFTOrNFTLocator, Wallet } from "@/blockchain/types";
import type { NFTOrNFTLocator, Wallet } from "@/blockchain/types";
import { UIConfig } from "../uiconfig";
import type { UIConfig } from "../uiconfig";

@@ -5,0 +5,0 @@ interface CommonProps {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc