@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
2 lines (1 loc) • 2.02 kB
JavaScript
;function n(n,t){if(!Object.prototype.hasOwnProperty.call(n,t))throw TypeError("attempted to use private field on non-instance");return n}var t=0;function s(n){return"__private_"+t+++"_"+n}var a=/*#__PURE__*/s("_wallet"),e=/*#__PURE__*/s("_account");exports.ConnectedStandardSolanaWallet=class{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(...t){if(!n(this,a)[a].features["solana:signMessage"]?.signMessage)throw Error("Wallet does not support signMessage");let s=await n(this,a)[a].features["solana:signMessage"].signMessage(...t.map((t=>({...t,account:n(this,e)[e]}))));return 1===t.length?s[0]:[...s]}async signTransaction(...t){if(!n(this,a)[a].features["solana:signTransaction"]?.signTransaction)throw Error("Wallet does not support signTransaction");let s=await n(this,a)[a].features["solana:signTransaction"].signTransaction(...t.map((t=>({...t,account:n(this,e)[e]}))));return 1===t.length?s[0]:[...s]}async signAndSendTransaction(...t){if(!n(this,a)[a].features["solana:signAndSendTransaction"]?.signAndSendTransaction)throw Error("Wallet does not support signAndSendTransaction");let s=await n(this,a)[a].features["solana:signAndSendTransaction"].signAndSendTransaction(...t.map((t=>({...t,account:n(this,e)[e]}))));return 1===t.length?s[0]:[...s]}async signAndSendAllTransactions(t){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(...t.map((t=>({...t,account:n(this,e)[e]}))))]}constructor({wallet:t,account:s}){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,e,{writable:!0,value:void 0}),n(this,a)[a]=t,n(this,e)[e]=s}};