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
7
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.0.3 to 0.0.4

src/blockchain/index.ts

161

dist/index.d.ts

@@ -84,16 +84,69 @@ declare const CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING = "3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5";

declare const EVM_CHAINS: readonly ["ethereum", "ethereum-sepolia", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "zkatana"];
declare const BLOCKCHAIN_TEST_NET: readonly ["goerli", "ethereum-sepolia", "mumbai", "zkatana"];
declare const ALL_CHAINS: readonly ["solana", "cardano", "sui", "ethereum", "ethereum-sepolia", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "zkatana"];
declare const EVM_BLOCKCHAIN_INCLUDING_TESTNET: readonly ["ethereum", "ethereum-sepolia", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "zkatana", "goerli", "ethereum-sepolia", "mumbai", "zkatana"];
declare const BLOCKCHAIN_INCLUDING_TESTNET: readonly ["solana", "cardano", "sui", "ethereum", "ethereum-sepolia", "polygon", "bsc", "optimism", "arbitrum", "base", "zora", "arbitrumnova", "zkatana", "goerli", "ethereum-sepolia", "mumbai", "zkatana"];
type Blockchain = (typeof ALL_CHAINS)[number];
type EVMBlockchain = (typeof EVM_CHAINS)[number];
type BlockchainTestNet = (typeof BLOCKCHAIN_TEST_NET)[number];
type EVMBlockchainIncludingTestnet = (typeof EVM_BLOCKCHAIN_INCLUDING_TESTNET)[number];
type BlockchainIncludingTestnet = (typeof BLOCKCHAIN_INCLUDING_TESTNET)[number];
interface Wallet {
chain: string;
publicKey: string;
}
type UserIdentifierParams = {
email?: string;
userId?: string;
phoneNumber?: string;
};
type UserIdentifier = {
type: "whiteLabel";
userId: string;
} | {
type: "email";
email: string;
} | {
type: "phoneNumber";
phoneNumber: string;
};
type ObjectValues<T extends object> = T[keyof T];
declare function objectValues<T extends object>(obj: T): ReadonlyArray<T[keyof T]>;
declare const BlockchainBaseLayer: {
readonly EVM: "evm";
readonly SOLANA: "solana";
readonly CARDANO: "cardano";
readonly SUI: "sui";
readonly APTOS: "aptos";
};
type BlockchainBaseLayer = ObjectValues<typeof BlockchainBaseLayer>;
declare const BLOCKCHAIN_BASE_LAYERS: readonly ("evm" | "solana" | "cardano" | "sui" | "aptos")[];
declare const EVMBlockchain: {
readonly ETHEREUM: "ethereum";
readonly POLYGON: "polygon";
readonly BSC: "bsc";
readonly OPTIMISM: "optimism";
readonly ARBITRUM: "arbitrum";
readonly BASE: "base";
readonly ZORA: "zora";
readonly ARBITRUMNOVA: "arbitrumnova";
readonly ZKATANA: "zkatana";
};
type EVMBlockchain = ObjectValues<typeof EVMBlockchain>;
declare const EVM_CHAINS: readonly ("ethereum" | "polygon" | "bsc" | "optimism" | "arbitrum" | "base" | "zora" | "arbitrumnova" | "zkatana")[];
declare const EVMBlockchainTestnet: {
readonly GOERLI: "goerli";
readonly ETHEREUM_SEPOLIA: "ethereum-sepolia";
readonly MUMBAI: "mumbai";
readonly ZKATANA: "zkatana";
};
type EVMBlockchainTestnet = ObjectValues<typeof EVMBlockchainTestnet>;
declare const EVM_BLOCKCHAIN_TESTNETS: readonly ("zkatana" | "goerli" | "ethereum-sepolia" | "mumbai")[];
declare const EVMBlockchainIncludingTestnet: {
readonly GOERLI: "goerli";
readonly ETHEREUM_SEPOLIA: "ethereum-sepolia";
readonly MUMBAI: "mumbai";
readonly ZKATANA: "zkatana";
readonly ETHEREUM: "ethereum";
readonly POLYGON: "polygon";
readonly BSC: "bsc";
readonly OPTIMISM: "optimism";
readonly ARBITRUM: "arbitrum";
readonly BASE: "base";
readonly ZORA: "zora";
readonly ARBITRUMNOVA: "arbitrumnova";
};
type EVMBlockchainIncludingTestnet = ObjectValues<typeof EVMBlockchainIncludingTestnet>;
declare const EVM_BLOCKCHAINS_INCLUDING_TESTNETS: readonly ("ethereum" | "polygon" | "bsc" | "optimism" | "arbitrum" | "base" | "zora" | "arbitrumnova" | "zkatana" | "goerli" | "ethereum-sepolia" | "mumbai")[];
interface EVMNFT {

@@ -115,2 +168,54 @@ chain: EVMBlockchain;

type NFTOrNFTLocator = NFT | NFTLocator<"solana"> | NFTLocator<"ethereum"> | NFTLocator<"polygon"> | NFTLocator<"bsc"> | NFTLocator<"cardano">;
interface Wallet {
chain: string;
publicKey: string;
}
declare const Blockchain: {
readonly ETHEREUM: "ethereum";
readonly POLYGON: "polygon";
readonly BSC: "bsc";
readonly OPTIMISM: "optimism";
readonly ARBITRUM: "arbitrum";
readonly BASE: "base";
readonly ZORA: "zora";
readonly ARBITRUMNOVA: "arbitrumnova";
readonly ZKATANA: "zkatana";
readonly SOLANA: "solana";
readonly CARDANO: "cardano";
readonly SUI: "sui";
readonly APTOS: "aptos";
};
type Blockchain = ObjectValues<typeof Blockchain>;
declare const BLOCKCHAINS: readonly ("ethereum" | "polygon" | "bsc" | "optimism" | "arbitrum" | "base" | "zora" | "arbitrumnova" | "zkatana" | "solana" | "cardano" | "sui" | "aptos")[];
declare const BlockchainTestnet: {
readonly GOERLI: "goerli";
readonly ETHEREUM_SEPOLIA: "ethereum-sepolia";
readonly MUMBAI: "mumbai";
readonly ZKATANA: "zkatana";
};
type BlockchainTestnet = ObjectValues<typeof BlockchainTestnet>;
declare const BLOCKCHAIN_TESTNETS: readonly ("zkatana" | "goerli" | "ethereum-sepolia" | "mumbai")[];
declare const BlockchainIncludingTestnet: {
readonly GOERLI: "goerli";
readonly ETHEREUM_SEPOLIA: "ethereum-sepolia";
readonly MUMBAI: "mumbai";
readonly ZKATANA: "zkatana";
readonly ETHEREUM: "ethereum";
readonly POLYGON: "polygon";
readonly BSC: "bsc";
readonly OPTIMISM: "optimism";
readonly ARBITRUM: "arbitrum";
readonly BASE: "base";
readonly ZORA: "zora";
readonly ARBITRUMNOVA: "arbitrumnova";
readonly SOLANA: "solana";
readonly CARDANO: "cardano";
readonly SUI: "sui";
readonly APTOS: "aptos";
};
type BlockchainIncludingTestnet = ObjectValues<typeof BlockchainIncludingTestnet>;
declare const BLOCKCHAINS_INCLUDING_TESTNETS: readonly ("ethereum" | "polygon" | "bsc" | "optimism" | "arbitrum" | "base" | "zora" | "arbitrumnova" | "zkatana" | "goerli" | "ethereum-sepolia" | "mumbai" | "solana" | "cardano" | "sui" | "aptos")[];
interface CommonProps {

@@ -127,18 +232,14 @@ uiConfig?: UIConfig;

type UserIdentifierParams = {
email?: string;
userId?: string;
phoneNumber?: string;
};
type UserIdentifier = {
type: "whiteLabel";
userId: string;
} | {
type: "email";
email: string;
} | {
type: "phoneNumber";
phoneNumber: string;
};
declare function isBlockchain<T extends Blockchain = Blockchain>(value: unknown, expectedBlockchain?: T): value is T;
export { ALL_CHAINS, APIKeyEnvironmentPrefix, APIKeyPrefix, APIKeyUsageOrigin, APIKeyUsageOriginPrefix, BLOCKCHAIN_INCLUDING_TESTNET, BLOCKCHAIN_TEST_NET, Blockchain, BlockchainIncludingTestnet, BlockchainTestNet, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING, CardanoNFT, CssFontSource, CustomFontSource, EVMBlockchain, EVMBlockchainIncludingTestnet, EVMNFT, EVM_BLOCKCHAIN_INCLUDING_TESTNET, EVM_CHAINS, NFT, NFTCollectionViewProps, NFTDetailProps, NFTLocator, NFTOrNFTLocator, SolanaNFT, UIConfig, UiConfigColors, UiConfigFonts, UserIdentifier, UserIdentifierParams, ValidateAPIKeyPrefixExpectations, ValidateAPIKeyPrefixResult, ValidateAPIKeyPrefixSuccessData, ValidateAPIKeyResult, Wallet, environmentToExpectedPublicKey, usageOriginToPrefix, validateAPIKey, validateAPIKeyPrefix };
declare function isBlockchainIncludingTestnets<T extends BlockchainIncludingTestnet = BlockchainIncludingTestnet>(value: unknown, expectedBlockchain?: T): value is T;
declare const BLOCKCHAIN_TO_CHAIN_ID: Record<EVMBlockchainIncludingTestnet, number>;
declare function blockchainToChainId(blockchain: EVMBlockchainIncludingTestnet): number;
declare const CHAIN_ID_TO_BLOCKCHAIN: Record<number, EVMBlockchainIncludingTestnet>;
declare function chainIdToBlockchain(chainId: number): EVMBlockchainIncludingTestnet | undefined;
declare function isEVMBlockchain(value: unknown): value is EVMBlockchainIncludingTestnet;
export { APIKeyEnvironmentPrefix, APIKeyPrefix, APIKeyUsageOrigin, APIKeyUsageOriginPrefix, BLOCKCHAINS, BLOCKCHAINS_INCLUDING_TESTNETS, BLOCKCHAIN_BASE_LAYERS, BLOCKCHAIN_TESTNETS, BLOCKCHAIN_TO_CHAIN_ID, Blockchain, BlockchainBaseLayer, BlockchainIncludingTestnet, BlockchainTestnet, CHAIN_ID_TO_BLOCKCHAIN, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD, CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING, CardanoNFT, CssFontSource, CustomFontSource, EVMBlockchain, EVMBlockchainIncludingTestnet, EVMBlockchainTestnet, EVMNFT, EVM_BLOCKCHAINS_INCLUDING_TESTNETS, EVM_BLOCKCHAIN_TESTNETS, EVM_CHAINS, NFT, NFTCollectionViewProps, NFTDetailProps, NFTLocator, NFTOrNFTLocator, ObjectValues, SolanaNFT, UIConfig, UiConfigColors, UiConfigFonts, UserIdentifier, UserIdentifierParams, ValidateAPIKeyPrefixExpectations, ValidateAPIKeyPrefixResult, ValidateAPIKeyPrefixSuccessData, ValidateAPIKeyResult, Wallet, blockchainToChainId, chainIdToBlockchain, environmentToExpectedPublicKey, isBlockchain, isBlockchainIncludingTestnets, isEVMBlockchain, objectValues, usageOriginToPrefix, validateAPIKey, validateAPIKeyPrefix };

2

dist/index.js

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

var T=Object.defineProperty,O=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var d=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))S.call(e,r)&&d(t,r,e[r]);if(u)for(var r of u(e))C.call(e,r)&&d(t,r,e[r]);return t},p=(t,e)=>O(t,_(e));var l="3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5",I="8erZh8YApGck3iUSUHqATBxqMTM1Ukp9mHmvGgUWHtkK";function E(t){return t==="client"?"ck":"sk"}function m(t){switch(t){case"development":case"staging":return l;case"production":return I;default:return null}}var P={CLIENT:"ck",SERVER:"sk"},n={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},g={CLIENT:"client",SERVER:"server"};import y from"bs58";import U from"tweetnacl";function x(t,e){if(V(t))return{isValid:!1,message:"Old API key format detected. Please create a new API key from the Crossmint console."};let r=k(t);if(r==null)return{isValid:!1,message:`Malformed API key. Must start with '${P.CLIENT}' or '${P.SERVER}'.`};if((e==null?void 0:e.usageOrigin)!=null&&r!==e.usageOrigin)return{isValid:!1,message:`Disallowed API key. You passed a ${r} API key, but a ${e.usageOrigin} API key is required.`};let i=v(t);return i==null?{isValid:!1,message:`Malformed API key. Must have a valid environment: '${n.DEVELOPMENT}', '${n.STAGING}' or '${n.PRODUCTION}'.`}:(e==null?void 0:e.environment)!=null&&i!==e.environment?{isValid:!1,message:`Disallowed API key. You passed a ${i} API key, but a ${e.environment} API key is required.`}:{isValid:!0,usageOrigin:r,environment:i,prefix:`${E(r)}_${i}`}}function V(t){return t.startsWith("sk_live")||t.startsWith("sk_test")}function k(t){return t.startsWith(P.CLIENT+"_")?g.CLIENT:t.startsWith(P.SERVER+"_")?g.SERVER:null}function v(t){let e=t.slice(3);return e.startsWith(n.DEVELOPMENT+"_")?n.DEVELOPMENT:e.startsWith(n.STAGING+"_")?n.STAGING:e.startsWith(n.PRODUCTION+"_")?n.PRODUCTION:null}function Q(t,e){let r=x(t,e);if(!r.isValid)return r;let{prefix:i}=r,{keyData:o,keyDataWithoutPrefix:s,signature:a}=h(t,i);if(!L(o,a,e))return{isValid:!1,message:"Invalid API key. Failed to validate signature"};let[f]=s.split(".");return p(A({},r),{projectId:f})}function h(t,e){let r=t.slice(`${e}_`.length),i=y.decode(r),o=new TextDecoder().decode(i),[s,a]=o.split(":");return{keyData:`${e}.${s}`,keyDataWithoutPrefix:s,signature:a}}function L(t,e,r){let i=m(r==null?void 0:r.environment);function o(s){try{let a=y.decode(e),c=new TextEncoder().encode(t),f=y.decode(s);return U.sign.detached.verify(c,a,f)}catch(a){return console.error("Failed to validate API key signature",a),!1}}return i!=null?o(i):o(I)||o(l)}var K=["ethereum","ethereum-sepolia","polygon","bsc","optimism","arbitrum","base","zora","arbitrumnova","zkatana"],N=["goerli","ethereum-sepolia","mumbai","zkatana"],R=["solana","cardano","sui",...K],te=[...K,...N],re=[...R,...N];export{R as ALL_CHAINS,n as APIKeyEnvironmentPrefix,g as APIKeyUsageOrigin,P as APIKeyUsageOriginPrefix,re as BLOCKCHAIN_INCLUDING_TESTNET,N as BLOCKCHAIN_TEST_NET,I as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD,l as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING,te as EVM_BLOCKCHAIN_INCLUDING_TESTNET,K as EVM_CHAINS,m as environmentToExpectedPublicKey,E as usageOriginToPrefix,Q as validateAPIKey,x as validateAPIKeyPrefix};
var C=Object.defineProperty,M=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var T=(e,t,n)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r=(e,t)=>{for(var n in t||(t={}))U.call(t,n)&&T(e,n,t[n]);if(m)for(var n of m(t))v.call(t,n)&&T(e,n,t[n]);return e},x=(e,t)=>M(e,R(t));var I="3hSfN4dWSwgCg1uf2yytBtK6KxK3ySFKasd2h9J2vSK5",P="8erZh8YApGck3iUSUHqATBxqMTM1Ukp9mHmvGgUWHtkK";function O(e){return e==="client"?"ck":"sk"}function K(e){switch(e){case"development":case"staging":return I;case"production":return P;default:return null}}var u={CLIENT:"ck",SERVER:"sk"},o={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},y={CLIENT:"client",SERVER:"server"};import E from"bs58";import G from"tweetnacl";function k(e,t){if(b(e))return{isValid:!1,message:"Old API key format detected. Please create a new API key from the Crossmint console."};let n=L(e);if(n==null)return{isValid:!1,message:`Malformed API key. Must start with '${u.CLIENT}' or '${u.SERVER}'.`};if((t==null?void 0:t.usageOrigin)!=null&&n!==t.usageOrigin)return{isValid:!1,message:`Disallowed API key. You passed a ${n} API key, but a ${t.usageOrigin} API key is required.`};let i=D(e);return i==null?{isValid:!1,message:`Malformed API key. Must have a valid environment: '${o.DEVELOPMENT}', '${o.STAGING}' or '${o.PRODUCTION}'.`}:(t==null?void 0:t.environment)!=null&&i!==t.environment?{isValid:!1,message:`Disallowed API key. You passed a ${i} API key, but a ${t.environment} API key is required.`}:{isValid:!0,usageOrigin:n,environment:i,prefix:`${O(n)}_${i}`}}function b(e){return e.startsWith("sk_live")||e.startsWith("sk_test")}function L(e){return e.startsWith(u.CLIENT+"_")?y.CLIENT:e.startsWith(u.SERVER+"_")?y.SERVER:null}function D(e){let t=e.slice(3);return t.startsWith(o.DEVELOPMENT+"_")?o.DEVELOPMENT:t.startsWith(o.STAGING+"_")?o.STAGING:t.startsWith(o.PRODUCTION+"_")?o.PRODUCTION:null}function le(e,t){let n=k(e,t);if(!n.isValid)return n;let{prefix:i}=n,{keyData:a,keyDataWithoutPrefix:l,signature:c}=j(e,i);if(!H(a,c,t))return{isValid:!1,message:"Invalid API key. Failed to validate signature"};let[A]=l.split(".");return x(r({},n),{projectId:A})}function j(e,t){let n=e.slice(`${t}_`.length),i=E.decode(n),a=new TextDecoder().decode(i),[l,c]=a.split(":");return{keyData:`${t}.${l}`,keyDataWithoutPrefix:l,signature:c}}function H(e,t,n){let i=K(n==null?void 0:n.environment);function a(l){try{let c=E.decode(t),g=new TextEncoder().encode(e),A=E.decode(l);return G.sign.detached.verify(g,c,A)}catch(c){return console.error("Failed to validate API key signature",c),!1}}return i!=null?a(i):a(P)||a(I)}function s(e){return Object.values(e)}var f={ETHEREUM:"ethereum",POLYGON:"polygon",BSC:"bsc",OPTIMISM:"optimism",ARBITRUM:"arbitrum",BASE:"base",ZORA:"zora",ARBITRUMNOVA:"arbitrumnova",ZKATANA:"zkatana"},ge=s(f),d={GOERLI:"goerli",ETHEREUM_SEPOLIA:"ethereum-sepolia",MUMBAI:"mumbai",ZKATANA:"zkatana"},Ae=s(d),Y=r(r({},f),d),V=s(Y);var $={EVM:"evm",SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},Te=s($);var B=r({SOLANA:"solana",CARDANO:"cardano",SUI:"sui",APTOS:"aptos"},f),S=s(B),h=r({},d),Ve=s(h),W=r(r({},B),h),N=s(W);function Ue(e,t){return t?e===t:S.includes(e)}function _(e,t){return t?e===t:N.includes(e)}var p={ethereum:1,"ethereum-sepolia":11155111,polygon:137,bsc:56,optimism:10,base:8453,arbitrum:42161,arbitrumnova:42170,zora:7777777,zkatana:1261120,goerli:5,mumbai:80001};function je(e){return p[e]}var w=Object.entries(p).reduce((e,[t,n])=>(e[n]=t,e),{});function $e(e){return w[e]}function qe(e){return V.some(t=>_(e,t))}export{o as APIKeyEnvironmentPrefix,y as APIKeyUsageOrigin,u as APIKeyUsageOriginPrefix,S as BLOCKCHAINS,N as BLOCKCHAINS_INCLUDING_TESTNETS,Te as BLOCKCHAIN_BASE_LAYERS,Ve as BLOCKCHAIN_TESTNETS,p as BLOCKCHAIN_TO_CHAIN_ID,B as Blockchain,$ as BlockchainBaseLayer,W as BlockchainIncludingTestnet,h as BlockchainTestnet,w as CHAIN_ID_TO_BLOCKCHAIN,P as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_PROD,I as CROSSMINT_API_KEY_SIGNER_PUBLICKEY_STAGING,f as EVMBlockchain,Y as EVMBlockchainIncludingTestnet,d as EVMBlockchainTestnet,V as EVM_BLOCKCHAINS_INCLUDING_TESTNETS,Ae as EVM_BLOCKCHAIN_TESTNETS,ge as EVM_CHAINS,je as blockchainToChainId,$e as chainIdToBlockchain,K as environmentToExpectedPublicKey,Ue as isBlockchain,_ as isBlockchainIncludingTestnets,qe as isEVMBlockchain,s as objectValues,O as usageOriginToPrefix,le as validateAPIKey,k as validateAPIKeyPrefix};
//# sourceMappingURL=index.js.map

@@ -30,2 +30,3 @@ {

"clean": "shx rm -rf dist/*",
"dev": "yarn clean && tsup src/index.ts --format esm,cjs --outDir ./dist --dts --sourcemap --watch",
"test": "vitest run"

@@ -36,4 +37,3 @@ },

"types": "./dist/index.d.ts",
"version": "0.0.3",
"gitHead": "99beae8a7aafd75edb5ad77eaaf1cc0d632063b3"
"version": "0.0.4"
}
export * from "./utils";
export * from "./types";
export * from "./blockchain";

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

export * from "./blockchain";
export * from "./uiconfig";
export * from "./UserIdentifier";
export * from "./utils";
export * from "./react";

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