UNPKG

@privy-io/js-sdk-core

Version:

Vanilla JS client for the Privy Auth API

2 lines (1 loc) 1.89 kB
function n(n,s){if(!Object.prototype.hasOwnProperty.call(n,s))throw TypeError("attempted to use private field on non-instance");return n}var s=0;function t(n){return"__private_"+s+++"_"+n}var a=/*#__PURE__*/t("_wallet"),e=/*#__PURE__*/t("_account");class r{get standardWallet(){return n(this,a)[a]}get address(){return n(this,e)[e].address}async disconnect(){if(!n(this,a)[a].features["standard:disconnect"]?.disconnect)throw Error("Wallet does not support disconnect");await n(this,a)[a].features["standard:disconnect"].disconnect()}async signMessage(s){if(!n(this,a)[a].features["solana:signMessage"]?.signMessage)throw Error("Wallet does not support signMessage");let[t]=await n(this,a)[a].features["solana:signMessage"].signMessage({...s,account:n(this,e)[e]});return t}async signTransaction(s){if(!n(this,a)[a].features["solana:signTransaction"]?.signTransaction)throw Error("Wallet does not support signTransaction");let[t]=await n(this,a)[a].features["solana:signTransaction"].signTransaction({...s,account:n(this,e)[e]});return t}async signAndSendTransaction(s){if(!n(this,a)[a].features["solana:signAndSendTransaction"]?.signAndSendTransaction)throw Error("Wallet does not support signAndSendTransaction");let[t]=await n(this,a)[a].features["solana:signAndSendTransaction"].signAndSendTransaction({...s,account:n(this,e)[e]});return t}async signAndSendAllTransactions(s){if(!n(this,a)[a].features["solana:signAndSendTransaction"]?.signAndSendTransaction)throw Error("Wallet does not support signAndSendTransaction");return[...await n(this,a)[a].features["solana:signAndSendTransaction"].signAndSendTransaction(...s.map((s=>({...s,account:n(this,e)[e]}))))]}constructor({wallet:s,account:t}){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,e,{writable:!0,value:void 0}),n(this,a)[a]=s,n(this,e)[e]=t}}export{r as ConnectedStandardSolanaWallet};