@revibase/wallet-adapter 0.0.18 → 0.0.19
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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
|
|
4
4
|
|
|
5
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[Fr]:"No signature verification implementation could be found.",[Br]:"No key generation implementation could be found.",[zr]:"No signing implementation could be found.",[xr]:"No key export implementation could be found.",[tr]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[Lo]:"Transaction processing left an account with an outstanding borrowed reference",[lo]:"Account in use",[Eo]:"Account loaded twice",[go]:"Attempt to debit an account but found no record of a prior credit.",[Bo]:"Transaction loads an address table account that doesn't exist",[So]:"This transaction has already been processed",[fo]:"Blockhash not found",[Co]:"Loader call chain is too deep",[yo]:"Transactions are currently disabled due to cluster maintenance",[Ho]:"Transaction contains a duplicate instruction ($index) that is not allowed",[Do]:"Insufficient funds for fee",[Ko]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[No]:"This account may not be used to pay transaction fees",[mo]:"Transaction contains an invalid account reference",[xo]:"Transaction loads an address table account with invalid data",[ko]:"Transaction address table lookup uses an invalid index",[zo]:"Transaction loads an address table account with an invalid owner",[jo]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Mo]:"This program may not be used for executing instructions",[Wo]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[wo]:"Transaction loads a writable account that cannot be written",[Yo]:"Transaction exceeded max loaded accounts data size cap",[Oo]:"Transaction requires a fee but has no signature present",[Ro]:"Attempt to load a program that does not exist",[Xo]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[$o]:"ResanitizationNeeded",[ho]:"Transaction failed to sanitize accounts offsets correctly",[po]:"Transaction did not pass signature verification",[Fo]:"Transaction locked too many accounts",[Zo]:"Sum of account balances before and after transaction do not match",[To]:"The transaction failed with the error `$errorName`",[bo]:"Transaction version is unsupported",[Po]:"Transaction would exceed account data limit within the block",[Vo]:"Transaction would exceed total account data limit",[vo]:"Transaction would exceed max account limit within the block",[Uo]:"Transaction would exceed max Block Cost Limit",[Go]:"Transaction would exceed max Vote Cost Limit",[lt]:"Attempted to sign a transaction with an address that is not a signer for it",[uo]:"Transaction is missing an address at index: $index.",[Ne]:"Transaction has no expected signers therefore it cannot be encoded",[Dt]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ge]:"Transaction does not have a blockhash lifetime",[Re]:"Transaction is not a durable nonce transaction",[dt]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[ut]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[At]:"No fee payer set in CompiledTransaction",[It]:"Could not find program address at index $index",[gt]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[Rt]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[Io]:"Transaction is missing a fee payer.",[Tt]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[_o]:"Transaction first instruction is not advance nonce account instruction.",[Ao]:"Transaction with no instructions cannot be durable nonce transaction.",[Ee]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Z]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[Et]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[_t]:"Transaction is missing signatures for addresses: $addresses.",[De]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[Se]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Nt]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction."},p="i",m="t";function Sa(e,t={}){let n=Na[e];if(n.length===0)return "";let r;function i(o){if(r[m]===2){let a=n.slice(r[p]+1,o);c.push(a in t?`${t[a]}`:`$${a}`);}else r[m]===1&&c.push(n.slice(r[p],o));}let c=[];return n.split("").forEach((o,a)=>{if(a===0){r={[p]:0,[m]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let s;switch(r[m]){case 0:s={[p]:a,[m]:1};break;case 1:o==="\\"?s={[p]:a,[m]:0}:o==="$"&&(s={[p]:a,[m]:2});break;case 2:o==="\\"?s={[p]:a,[m]:0}:o==="$"?s={[p]:a,[m]:2}:o.match(/\w/)||(s={[p]:a,[m]:1});break}s&&(r!==s&&i(a),r=s);}),i(),c.join("")}function fa(e,t={}){if(process.env.NODE_ENV!=="production")return Sa(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${Da(t)}'`),`${n}\``}}var A=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([c,o])=>{c==="cause"?r={cause:o.value}:(n===void 0&&(n={}),Object.defineProperty(n,c,o));});let i=fa(e,n);super(i,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function Ca(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var Oa=(e,t)=>Ca(e.length<=t?e:e.slice(0,t),t);function L(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function _(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(L(t,e));return e.write(t,n,0),n}})}function v(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function N(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function ma(e){return !N(e)}function pe(e,t,n,r=0){let i=n.length-r;if(i<t)throw new A(fe,{bytesLength:i,codecDescription:e,expected:t})}function kt(e,t){let n=(o,a,s)=>{let d=e.encode(o);return s=t.write(d.length,a,s),a.set(d,s),s+d.length};if(N(t)&&N(e))return _({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});let r=N(t)?t.fixedSize:t.maxSize??null,i=N(e)?e.fixedSize:e.maxSize??null,c=r!==null&&i!==null?r+i:null;return _({...e,...c!==null?{maxSize:c}:{},getSizeFromValue:o=>{let a=L(o,e);return L(a,t)+a},write:n})}function P(e,t){return _({fixedSize:t,write:(n,r,i)=>{let c=e.encode(n),o=c.length>t?c.slice(0,t):c;return r.set(o,i),i+t}})}function V(e,t){return v({fixedSize:t,read:(n,r)=>{pe("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),N(e)&&(n=Oa(n,e.fixedSize));let[i]=e.read(n,0);return [i,r+t]}})}function S(e,t){return _({...ma(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,i)=>e.write(t(n),r,i)})}function pa(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var Ma=e=>_({getSizeFromValue:t=>{let[n,r]=Wt(t,e[0]);if(!r)return t.length;let i=Gt(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(pa(e,t),t==="")return r;let[i,c]=Wt(t,e[0]);if(!c)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=Gt(c,e),a=[];for(;o>0n;)a.unshift(Number(o%256n)),o/=256n;let s=[...Array(i.length).fill(0),...a];return n.set(s,r),r+s.length}}),ha=e=>v({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let i=r.findIndex(s=>s!==0);i=i===-1?r.length:i;let c=e[0].repeat(i);if(i===r.length)return [c,t.length];let o=r.slice(i).reduce((s,d)=>s*256n+BigInt(d),0n),a=ya(o,e);return [c+a,t.length]}});function Wt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Gt(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}function ya(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var Vt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Q=()=>Ma(Vt),F=()=>ha(Vt);var q=()=>v({read:(e,t=0)=>[Buffer.from(e,t).toString("base64"),e.length]});var Me,he;function ye(){return Me||(Me=Q()),Me}function Ua(){return he||(he=F()),he}function Ht(e){if(e.length<32||e.length>44)return false;let t=ye();try{return t.encode(e).byteLength===32}catch{return false}}function Le(e){if(e.length<32||e.length>44)throw new A(le,{actualLength:e.length});let r=ye().encode(e).byteLength;if(r!==32)throw new A(Te,{actualLength:r})}function x(e){return Le(e),e}function M(){return S(P(ye(),32),e=>x(e))}function H(){return V(Ua(),32)}function J(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:false,localeMatcher:"best fit",numeric:false,sensitivity:"variant",usage:"sort"}).compare}function Kt(e,t,n,r){if(r<t||r>n)throw new A(Oe,{codecDescription:e,max:n,min:t,value:r})}function ba(e){return e?.endian!==1}function Ue(e){return _({fixedSize:e.size,write(t,n,r){e.range&&Kt(e.name,e.range[0],e.range[1],t);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,ba(e.config)),n.set(new Uint8Array(i),r),r+e.size}})}var h=()=>_({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Kt("shortU16",0,65535,e);let r=[0];for(let i=0;;i+=1){let c=Number(e)>>i*7;if(c===0)break;let o=127&c;r[i]=o,i>0&&(r[i-1]|=128);}return t.set(r,n),n+r.length}});var ee=(e={})=>Ue({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4});var te=(e={})=>Ue({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,n,r)=>t.setBigUint64(0,BigInt(n),r),size:8});var y=()=>Ue({name:"u8",range:[0,255],set:(e,t)=>e.setUint8(0,Number(t)),size:1});function Pa(e,t,n){if(t!==n)throw new A(Ce,{actual:n,codecDescription:e,expected:t})}function Fa(e){return e.reduce((t,n)=>t===null||n===null?null:Math.max(t,n),0)}function Yt(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Zt(e){return N(e)?e.fixedSize:null}function we(e){return N(e)?e.fixedSize:e.maxSize??null}function U(e,t={}){let n=t.size??ee(),r=jt(n,Zt(e)),i=jt(n,we(e))??void 0;return _({...r!==null?{fixedSize:r}:{getSizeFromValue:c=>(typeof n=="object"?L(c.length,n):0)+[...c].reduce((a,s)=>a+L(s,e),0),maxSize:i},write:(c,o,a)=>(typeof n=="number"&&Pa("array",n,c.length),typeof n=="object"&&(a=n.write(c.length,o,a)),c.forEach(s=>{a=e.write(s,o,a);}),a)})}function jt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function K(){return _({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Qt(e){return _({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function qt(e,t){let n=Ba(e),r=(c,o,a)=>{let s=t(c);return $t(e,s),e[s].write(c,o,a)};if(n!==null)return _({fixedSize:n,write:r});let i=za(e);return _({...i!==null?{maxSize:i}:{},getSizeFromValue:c=>{let o=t(c);return $t(e,o),L(c,e[o])},write:r})}function $t(e,t){if(typeof e[t]>"u")throw new A(me,{maxRange:e.length-1,minRange:0,variant:t})}function Ba(e){if(e.length===0)return 0;if(!N(e[0]))return null;let t=e[0].fixedSize;return e.every(r=>N(r)&&r.fixedSize===t)?t:null}function za(e){return Fa(e.map(t=>we(t)))}function f(e){let t=e.map(([,i])=>i),n=Yt(t.map(Zt)),r=Yt(t.map(we))??void 0;return _({...n===null?{getSizeFromValue:i=>e.map(([c,o])=>L(i[c],o)).reduce((c,o)=>c+o,0),maxSize:r}:{fixedSize:n},write:(i,c,o)=>(e.forEach(([a,s])=>{o=s.write(i[a],c,o);}),o)})}function ve(e,...t){return t.reduce((n,r)=>r(n),e)}var b=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(b||{});var xa=1;function w(e){return e>=2}function k(e){return (e&xa)!==0}function Pe(e,t){return e|t}function Jt(e){return Ht(e)}function en(){return H()}function cn(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.blockhash=="string"&&typeof e.lifetimeConstraint.lastValidBlockHeight=="bigint"&&Jt(e.lifetimeConstraint.blockhash)}function dn(e,t){return "lifetimeConstraint"in t&&t.lifetimeConstraint&&"blockhash"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}function Va(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var Ha=e=>_({getSizeFromValue:t=>{let[n,r]=tn(t,e[0]);if(!r)return t.length;let i=nn(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(Va(e,t),t==="")return r;let[i,c]=tn(t,e[0]);if(!c)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=nn(c,e),a=[];for(;o>0n;)a.unshift(Number(o%256n)),o/=256n;let s=[...Array(i.length).fill(0),...a];return n.set(s,r),r+s.length}});function tn(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function nn(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}var Ka="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ya=()=>Ha(Ka);var Fe;function ja(){if(!Fe){let e=U(y(),{size:h()});Fe=f([["lookupTableAddress",M()],["writableIndexes",e],["readonlyIndexes",e]]);}return Fe}var Be;function ze(){return Be||(Be=y()),Be}function $a(){return f([["numSignerAccounts",ze()],["numReadonlySignerAccounts",ze()],["numReadonlyNonSignerAccounts",ze()]])}var xe;function Xa(){return xe||(xe=S(f([["programAddressIndex",y()],["accountIndices",U(y(),{size:h()})],["data",kt(K(),h())]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),xe}var Za=0,Qa=128;function qa(){return _({getSizeFromValue:e=>e==="legacy"?0:1,maxSize:1,write:(e,t,n)=>{if(e==="legacy")return n;if(e<0||e>127)throw new A(De,{actualVersion:e});if(e>Za)throw new A(Se,{unsupportedVersion:e});return t.set([e|Qa],n),n+1}})}function rn(){return f(un())}function on(){return S(f([...un(),["addressTableLookups",Ja()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function un(){let e=qt([Qt(new Uint8Array(32)),P(Ya(),32)],t=>t===void 0?0:1);return [["version",qa()],["header",$a()],["staticAccounts",U(M(),{size:h()})],["lifetimeToken",e],["instructions",U(Xa(),{size:h()})]]}function Ja(){return U(ja(),{size:h()})}function In(){return _({getSizeFromValue:e=>e.version==="legacy"?rn().getSizeFromValue(e):on().getSizeFromValue(e),write:(e,t,n)=>e.version==="legacy"?rn().write(e,t,n):on().write(e,t,n)})}function an(e,t,n){e[t]=n(e[t]??{role:b.READONLY});}var T=Symbol("AddressMapTypeProperty");function es(e,t){let n={[e]:{[T]:0,role:b.WRITABLE_SIGNER}},r=new Set;for(let i of t){an(n,i.programAddress,o=>{if(r.add(i.programAddress),T in o){if(k(o.role))switch(o[T]){case 0:throw new A(Ee,{programAddress:i.programAddress});default:throw new A(Z,{programAddress:i.programAddress})}if(o[T]===2)return o}return {[T]:2,role:b.READONLY}});let c;if(i.accounts)for(let o of i.accounts)an(n,o.address,a=>{let{address:s,...d}=o;if(T in a)switch(a[T]){case 0:return a;case 1:{let I=Pe(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(c||=J())(d.lookupTableAddress,a.lookupTableAddress)<0)return {[T]:1,...d,role:I}}else if(w(d.role))return {[T]:2,role:I};return a.role!==I?{...a,role:I}:a}case 2:{let I=Pe(a.role,d.role);if(r.has(o.address)){if(k(d.role))throw new A(Z,{programAddress:o.address});return a.role!==I?{...a,role:I}:a}else return "lookupTableAddress"in d&&!w(a.role)?{...d,[T]:1,role:I}:a.role!==I?{...a,role:I}:a}}return "lookupTableAddress"in d?{...d,[T]:1}:{...d,[T]:2}});}return n}function ts(e){let t;return Object.entries(e).sort(([r,i],[c,o])=>{if(i[T]!==o[T]){if(i[T]===0)return -1;if(o[T]===0)return 1;if(i[T]===2)return -1;if(o[T]===2)return 1}let a=w(i.role);if(a!==w(o.role))return a?-1:1;let s=k(i.role);return s!==k(o.role)?s?-1:1:(t||=J(),i[T]===1&&o[T]===1&&i.lookupTableAddress!==o.lookupTableAddress?t(i.lookupTableAddress,o.lookupTableAddress):t(r,c))}).map(([r,i])=>({address:r,...i}))}function ns(e){let t={};for(let n of e){if(!("lookupTableAddress"in n))continue;let r=t[n.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};n.role===b.WRITABLE?r.writableIndexes.push(n.addressIndex):r.readonlyIndexes.push(n.addressIndex);}return Object.keys(t).sort(J()).map(n=>({lookupTableAddress:n,...t[n]}))}function rs(e){let t=0,n=0,r=0;for(let i of e){if("lookupTableAddress"in i)break;let c=k(i.role);w(i.role)?(r++,c||n++):c||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function is(e){let t={};for(let[n,r]of e.entries())t[r.address]=n;return t}function os(e,t){let n=is(t);return e.map(({accounts:r,data:i,programAddress:c})=>({programAddressIndex:n[c],...r?{accountIndices:r.map(({address:o})=>n[o])}:null,...i?{data:i}:null}))}function as(e){return "nonce"in e?e.nonce:e.blockhash}function ss(e){let t=e.findIndex(r=>"lookupTableAddress"in r);return (t===-1?e:e.slice(0,t)).map(({address:r})=>r)}function An(e){let t=es(e.feePayer.address,e.instructions),n=ts(t),r=e.lifetimeConstraint;return {...e.version!=="legacy"?{addressTableLookups:ns(n)}:null,...r?{lifetimeToken:as(r)}:null,header:rs(n),instructions:os(e.instructions,n),staticAccounts:ss(n),version:e.version}}function cs(e,t,n){for(let[r,i]of Object.entries(n))for(let c=0;c<i.length;c++)if(e===i[c])return {address:e,addressIndex:c,lookupTableAddress:r,role:t}}function _n(e,t){let n=new Set(e.instructions.map(o=>o.programAddress)),r=new Set(Object.values(t).flatMap(o=>o).filter(o=>!n.has(o))),i=[],c=false;for(let o of e.instructions){if(!o.accounts){i.push(o);continue}let a=[],s=false;for(let d of o.accounts){if("lookupTableAddress"in d||!r.has(d.address)||w(d.role)){a.push(d);continue}let I=cs(d.address,d.role,t);a.push(Object.freeze(I)),s=true,c=true;}i.push(Object.freeze(s?{...o,accounts:a}:o));}return Object.freeze(c?{...e,instructions:i}:e)}function Tn(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var ds="SysvarRecentB1ockHashes11111111111111111111",us="11111111111111111111111111111111";function Is(e){return e.programAddress===us&&e.data!=null&&As(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===b.WRITABLE&&e.accounts[1].address===ds&&e.accounts[1].role===b.READONLY&&e.accounts[2].address!=null&&w(e.accounts[2].role)}function As(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function ke(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Is(e.instructions[0])}function ln(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function En(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function _s(e){let t=Object.values(e);if(t.length===0)throw new A(Ne);return t.map(n=>n||new Uint8Array(64).fill(0))}function Ts(){return S(U(P(K(),64),{size:h()}),_s)}function We(){return f([["signatures",Ts()],["messageBytes",K()]])}function Ge(e){let t=An(e),n=In().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),i={};for(let o of r)i[o]=null;let c;return cn(e)?c={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:ke(e)&&(c={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...c?{lifetimeConstraint:c}:void 0,messageBytes:n,signatures:Object.freeze(i)})}function Ve(e){let t=We().encode(e);return q().decode(t)}function gn(e,t){Object.freeze(e);let n={...t,feePayer:e};return Object.freeze(n),n}function Rn(e){return Object.freeze({address:e,signMessages:n=>Promise.resolve(n.map(()=>Object.freeze({}))),signTransactions:n=>Promise.resolve(n.map(()=>Object.freeze({})))})}var ne="ComputeBudget111111111111111111111111111111";var He=2;function Ke(){return S(f([["discriminator",y()],["units",ee()]]),e=>({...e,discriminator:He}))}function re(e,t){let n=ne,r={...e};return Object.freeze({data:Ke().encode(r),programAddress:n})}var Ye=3;function je(){return S(f([["discriminator",y()],["microLamports",te()]]),e=>({...e,discriminator:Ye}))}function ie(e,t){let n=ne,r={...e};return Object.freeze({data:je().encode(r),programAddress:n})}var oe="11111111111111111111111111111111";var Dn=0,Nn=1,Sn=2,fn=3,Cn=4,On=5,mn=6,pn=7,Mn=8;process.env.NODE_ENV!=="production"&&({[Dn]:"an account with the same address already exists",[On]:"provided address does not match addressed derived from seed",[fn]:"cannot allocate account data of this length",[Sn]:"cannot assign account to this program id",[Cn]:"length of requested seed is too long",[pn]:"stored nonce is still in recent_blockhashes",[mn]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[Mn]:"specified nonce does not match stored nonce",[Nn]:"account does not have enough SOL to perform the operation"});var $e="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";async function Y({transactionActionType:e,transactionAddress:t,transactionMessageBytes:n,signer:r,provider:i}){if(typeof window>"u")throw new Error("Function can only be called in a browser environment");let c={transactionActionType:e,transactionAddress:t,transactionMessageBytes:core.bufferToBase64URLString(n)},o=window.origin,a={phase:"start",data:{type:"transaction",payload:c},redirectOrigin:o,signer:r},{signature:s}=await i.onClientAuthorizationCallback(a),d=await i.sendPayloadToProvider({payload:a,signature:s}),{signature:I}=await i.onClientAuthorizationCallback({...d,data:{...d.data,payload:{...d.data.payload,transactionPayload:c}}});return {...d.data.payload,clientSignature:{...d.data.payload.clientSignature,signature:I}}}async function hn(e){let t=await Xe(e);return core.signAndSendTransaction(t)}var Xe=async e=>{let{amount:t,destination:n,mint:r,payer:i,addressesByLookupTableAddress:c,tokenProgram:o=$e,cachedAccounts:a=new Map,signer:s,provider:d,createAtaIfNeeded:I=true}=e;d.openBlankPopUp();let u=await Y({transactionActionType:"transfer_intent",transactionAddress:r?o:oe,transactionMessageBytes:new Uint8Array([...te().encode(t),...M().encode(n),...M().encode(r??oe)]),signer:s,provider:d}),l;if(u.additionalInfo.settingsIndexWithAddress)l=u.additionalInfo.settingsIndexWithAddress;else {let B=await core.fetchUserAccountData(new core.Secp256r1Key(u.signer),u.userAddressTreeIndex,a);if(B.delegatedTo.__option==="None")throw Error("User has no delegated wallet");l=B.delegatedTo.value;}let[D,W]=await Promise.all([core.fetchSettingsAccountData(l.index,l.settingsAddressTreeIndex,a),core.getSignedSecp256r1Key(u)]),{transactionManagerAddress:E,userAddressTreeIndex:C}=core.retrieveTransactionManager(u.signer,D),O=await core.getSignedTransactionManager({authResponses:[u],transactionManagerAddress:E,userAddressTreeIndex:C,cachedAccounts:a}),g=O?[W,O]:[W];return {instructions:r?await core.tokenTransferIntent({payer:i,index:l.index,settingsAddressTreeIndex:l.settingsAddressTreeIndex,createAtaIfNeeded:I,amount:t,signers:g,destination:n,mint:r,tokenProgram:o,compressed:D.isCompressed,cachedAccounts:a}):await core.nativeTransferIntent({payer:i,index:l.index,settingsAddressTreeIndex:l.settingsAddressTreeIndex,amount:t,signers:g,destination:n,compressed:D.isCompressed,cachedAccounts:a}),payer:i,addressesByLookupTableAddress:c}};function ae(e){let t=`${e.domain} wants you to sign in with your account.`,n=[];return e.nonce&&n.push(`Nonce: ${e.nonce}`),n.length&&(t+=`
|
|
5
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[Fr]:"No signature verification implementation could be found.",[Br]:"No key generation implementation could be found.",[zr]:"No signing implementation could be found.",[xr]:"No key export implementation could be found.",[tr]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[Lo]:"Transaction processing left an account with an outstanding borrowed reference",[lo]:"Account in use",[Eo]:"Account loaded twice",[go]:"Attempt to debit an account but found no record of a prior credit.",[Bo]:"Transaction loads an address table account that doesn't exist",[So]:"This transaction has already been processed",[fo]:"Blockhash not found",[Co]:"Loader call chain is too deep",[yo]:"Transactions are currently disabled due to cluster maintenance",[Ho]:"Transaction contains a duplicate instruction ($index) that is not allowed",[Do]:"Insufficient funds for fee",[Ko]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[No]:"This account may not be used to pay transaction fees",[mo]:"Transaction contains an invalid account reference",[xo]:"Transaction loads an address table account with invalid data",[ko]:"Transaction address table lookup uses an invalid index",[zo]:"Transaction loads an address table account with an invalid owner",[jo]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Mo]:"This program may not be used for executing instructions",[Wo]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[wo]:"Transaction loads a writable account that cannot be written",[Yo]:"Transaction exceeded max loaded accounts data size cap",[Oo]:"Transaction requires a fee but has no signature present",[Ro]:"Attempt to load a program that does not exist",[Xo]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[$o]:"ResanitizationNeeded",[ho]:"Transaction failed to sanitize accounts offsets correctly",[po]:"Transaction did not pass signature verification",[Fo]:"Transaction locked too many accounts",[Zo]:"Sum of account balances before and after transaction do not match",[To]:"The transaction failed with the error `$errorName`",[bo]:"Transaction version is unsupported",[Po]:"Transaction would exceed account data limit within the block",[Vo]:"Transaction would exceed total account data limit",[vo]:"Transaction would exceed max account limit within the block",[Uo]:"Transaction would exceed max Block Cost Limit",[Go]:"Transaction would exceed max Vote Cost Limit",[lt]:"Attempted to sign a transaction with an address that is not a signer for it",[uo]:"Transaction is missing an address at index: $index.",[Ne]:"Transaction has no expected signers therefore it cannot be encoded",[Dt]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ge]:"Transaction does not have a blockhash lifetime",[Re]:"Transaction is not a durable nonce transaction",[dt]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[ut]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[At]:"No fee payer set in CompiledTransaction",[It]:"Could not find program address at index $index",[gt]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[Rt]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[Io]:"Transaction is missing a fee payer.",[Tt]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[_o]:"Transaction first instruction is not advance nonce account instruction.",[Ao]:"Transaction with no instructions cannot be durable nonce transaction.",[Ee]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Z]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[Et]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[_t]:"Transaction is missing signatures for addresses: $addresses.",[De]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[Se]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Nt]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction."},p="i",m="t";function Sa(e,t={}){let n=Na[e];if(n.length===0)return "";let r;function i(o){if(r[m]===2){let a=n.slice(r[p]+1,o);c.push(a in t?`${t[a]}`:`$${a}`);}else r[m]===1&&c.push(n.slice(r[p],o));}let c=[];return n.split("").forEach((o,a)=>{if(a===0){r={[p]:0,[m]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let s;switch(r[m]){case 0:s={[p]:a,[m]:1};break;case 1:o==="\\"?s={[p]:a,[m]:0}:o==="$"&&(s={[p]:a,[m]:2});break;case 2:o==="\\"?s={[p]:a,[m]:0}:o==="$"?s={[p]:a,[m]:2}:o.match(/\w/)||(s={[p]:a,[m]:1});break}s&&(r!==s&&i(a),r=s);}),i(),c.join("")}function fa(e,t={}){if(process.env.NODE_ENV!=="production")return Sa(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${Da(t)}'`),`${n}\``}}var A=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([c,o])=>{c==="cause"?r={cause:o.value}:(n===void 0&&(n={}),Object.defineProperty(n,c,o));});let i=fa(e,n);super(i,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function Ca(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var Oa=(e,t)=>Ca(e.length<=t?e:e.slice(0,t),t);function L(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function _(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(L(t,e));return e.write(t,n,0),n}})}function v(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function N(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function ma(e){return !N(e)}function pe(e,t,n,r=0){let i=n.length-r;if(i<t)throw new A(fe,{bytesLength:i,codecDescription:e,expected:t})}function kt(e,t){let n=(o,a,s)=>{let d=e.encode(o);return s=t.write(d.length,a,s),a.set(d,s),s+d.length};if(N(t)&&N(e))return _({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});let r=N(t)?t.fixedSize:t.maxSize??null,i=N(e)?e.fixedSize:e.maxSize??null,c=r!==null&&i!==null?r+i:null;return _({...e,...c!==null?{maxSize:c}:{},getSizeFromValue:o=>{let a=L(o,e);return L(a,t)+a},write:n})}function P(e,t){return _({fixedSize:t,write:(n,r,i)=>{let c=e.encode(n),o=c.length>t?c.slice(0,t):c;return r.set(o,i),i+t}})}function V(e,t){return v({fixedSize:t,read:(n,r)=>{pe("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),N(e)&&(n=Oa(n,e.fixedSize));let[i]=e.read(n,0);return [i,r+t]}})}function S(e,t){return _({...ma(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,i)=>e.write(t(n),r,i)})}function pa(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var Ma=e=>_({getSizeFromValue:t=>{let[n,r]=Wt(t,e[0]);if(!r)return t.length;let i=Gt(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(pa(e,t),t==="")return r;let[i,c]=Wt(t,e[0]);if(!c)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=Gt(c,e),a=[];for(;o>0n;)a.unshift(Number(o%256n)),o/=256n;let s=[...Array(i.length).fill(0),...a];return n.set(s,r),r+s.length}}),ha=e=>v({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let i=r.findIndex(s=>s!==0);i=i===-1?r.length:i;let c=e[0].repeat(i);if(i===r.length)return [c,t.length];let o=r.slice(i).reduce((s,d)=>s*256n+BigInt(d),0n),a=ya(o,e);return [c+a,t.length]}});function Wt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Gt(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}function ya(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var Vt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Q=()=>Ma(Vt),F=()=>ha(Vt);var q=()=>v({read:(e,t=0)=>[Buffer.from(e,t).toString("base64"),e.length]});var Me,he;function ye(){return Me||(Me=Q()),Me}function Ua(){return he||(he=F()),he}function Ht(e){if(e.length<32||e.length>44)return false;let t=ye();try{return t.encode(e).byteLength===32}catch{return false}}function Le(e){if(e.length<32||e.length>44)throw new A(le,{actualLength:e.length});let r=ye().encode(e).byteLength;if(r!==32)throw new A(Te,{actualLength:r})}function x(e){return Le(e),e}function M(){return S(P(ye(),32),e=>x(e))}function H(){return V(Ua(),32)}function J(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:false,localeMatcher:"best fit",numeric:false,sensitivity:"variant",usage:"sort"}).compare}function Kt(e,t,n,r){if(r<t||r>n)throw new A(Oe,{codecDescription:e,max:n,min:t,value:r})}function ba(e){return e?.endian!==1}function Ue(e){return _({fixedSize:e.size,write(t,n,r){e.range&&Kt(e.name,e.range[0],e.range[1],t);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,ba(e.config)),n.set(new Uint8Array(i),r),r+e.size}})}var h=()=>_({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Kt("shortU16",0,65535,e);let r=[0];for(let i=0;;i+=1){let c=Number(e)>>i*7;if(c===0)break;let o=127&c;r[i]=o,i>0&&(r[i-1]|=128);}return t.set(r,n),n+r.length}});var ee=(e={})=>Ue({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4});var te=(e={})=>Ue({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,n,r)=>t.setBigUint64(0,BigInt(n),r),size:8});var y=()=>Ue({name:"u8",range:[0,255],set:(e,t)=>e.setUint8(0,Number(t)),size:1});function Pa(e,t,n){if(t!==n)throw new A(Ce,{actual:n,codecDescription:e,expected:t})}function Fa(e){return e.reduce((t,n)=>t===null||n===null?null:Math.max(t,n),0)}function Yt(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Zt(e){return N(e)?e.fixedSize:null}function we(e){return N(e)?e.fixedSize:e.maxSize??null}function U(e,t={}){let n=t.size??ee(),r=jt(n,Zt(e)),i=jt(n,we(e))??void 0;return _({...r!==null?{fixedSize:r}:{getSizeFromValue:c=>(typeof n=="object"?L(c.length,n):0)+[...c].reduce((a,s)=>a+L(s,e),0),maxSize:i},write:(c,o,a)=>(typeof n=="number"&&Pa("array",n,c.length),typeof n=="object"&&(a=n.write(c.length,o,a)),c.forEach(s=>{a=e.write(s,o,a);}),a)})}function jt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function K(){return _({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Qt(e){return _({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function qt(e,t){let n=Ba(e),r=(c,o,a)=>{let s=t(c);return $t(e,s),e[s].write(c,o,a)};if(n!==null)return _({fixedSize:n,write:r});let i=za(e);return _({...i!==null?{maxSize:i}:{},getSizeFromValue:c=>{let o=t(c);return $t(e,o),L(c,e[o])},write:r})}function $t(e,t){if(typeof e[t]>"u")throw new A(me,{maxRange:e.length-1,minRange:0,variant:t})}function Ba(e){if(e.length===0)return 0;if(!N(e[0]))return null;let t=e[0].fixedSize;return e.every(r=>N(r)&&r.fixedSize===t)?t:null}function za(e){return Fa(e.map(t=>we(t)))}function f(e){let t=e.map(([,i])=>i),n=Yt(t.map(Zt)),r=Yt(t.map(we))??void 0;return _({...n===null?{getSizeFromValue:i=>e.map(([c,o])=>L(i[c],o)).reduce((c,o)=>c+o,0),maxSize:r}:{fixedSize:n},write:(i,c,o)=>(e.forEach(([a,s])=>{o=s.write(i[a],c,o);}),o)})}function ve(e,...t){return t.reduce((n,r)=>r(n),e)}var b=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(b||{});var xa=1;function w(e){return e>=2}function k(e){return (e&xa)!==0}function Pe(e,t){return e|t}function Jt(e){return Ht(e)}function en(){return H()}function cn(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.blockhash=="string"&&typeof e.lifetimeConstraint.lastValidBlockHeight=="bigint"&&Jt(e.lifetimeConstraint.blockhash)}function dn(e,t){return "lifetimeConstraint"in t&&t.lifetimeConstraint&&"blockhash"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}function Va(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var Ha=e=>_({getSizeFromValue:t=>{let[n,r]=tn(t,e[0]);if(!r)return t.length;let i=nn(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(Va(e,t),t==="")return r;let[i,c]=tn(t,e[0]);if(!c)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=nn(c,e),a=[];for(;o>0n;)a.unshift(Number(o%256n)),o/=256n;let s=[...Array(i.length).fill(0),...a];return n.set(s,r),r+s.length}});function tn(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function nn(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}var Ka="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ya=()=>Ha(Ka);var Fe;function ja(){if(!Fe){let e=U(y(),{size:h()});Fe=f([["lookupTableAddress",M()],["writableIndexes",e],["readonlyIndexes",e]]);}return Fe}var Be;function ze(){return Be||(Be=y()),Be}function $a(){return f([["numSignerAccounts",ze()],["numReadonlySignerAccounts",ze()],["numReadonlyNonSignerAccounts",ze()]])}var xe;function Xa(){return xe||(xe=S(f([["programAddressIndex",y()],["accountIndices",U(y(),{size:h()})],["data",kt(K(),h())]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),xe}var Za=0,Qa=128;function qa(){return _({getSizeFromValue:e=>e==="legacy"?0:1,maxSize:1,write:(e,t,n)=>{if(e==="legacy")return n;if(e<0||e>127)throw new A(De,{actualVersion:e});if(e>Za)throw new A(Se,{unsupportedVersion:e});return t.set([e|Qa],n),n+1}})}function rn(){return f(un())}function on(){return S(f([...un(),["addressTableLookups",Ja()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function un(){let e=qt([Qt(new Uint8Array(32)),P(Ya(),32)],t=>t===void 0?0:1);return [["version",qa()],["header",$a()],["staticAccounts",U(M(),{size:h()})],["lifetimeToken",e],["instructions",U(Xa(),{size:h()})]]}function Ja(){return U(ja(),{size:h()})}function In(){return _({getSizeFromValue:e=>e.version==="legacy"?rn().getSizeFromValue(e):on().getSizeFromValue(e),write:(e,t,n)=>e.version==="legacy"?rn().write(e,t,n):on().write(e,t,n)})}function an(e,t,n){e[t]=n(e[t]??{role:b.READONLY});}var T=Symbol("AddressMapTypeProperty");function es(e,t){let n={[e]:{[T]:0,role:b.WRITABLE_SIGNER}},r=new Set;for(let i of t){an(n,i.programAddress,o=>{if(r.add(i.programAddress),T in o){if(k(o.role))switch(o[T]){case 0:throw new A(Ee,{programAddress:i.programAddress});default:throw new A(Z,{programAddress:i.programAddress})}if(o[T]===2)return o}return {[T]:2,role:b.READONLY}});let c;if(i.accounts)for(let o of i.accounts)an(n,o.address,a=>{let{address:s,...d}=o;if(T in a)switch(a[T]){case 0:return a;case 1:{let I=Pe(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(c||=J())(d.lookupTableAddress,a.lookupTableAddress)<0)return {[T]:1,...d,role:I}}else if(w(d.role))return {[T]:2,role:I};return a.role!==I?{...a,role:I}:a}case 2:{let I=Pe(a.role,d.role);if(r.has(o.address)){if(k(d.role))throw new A(Z,{programAddress:o.address});return a.role!==I?{...a,role:I}:a}else return "lookupTableAddress"in d&&!w(a.role)?{...d,[T]:1,role:I}:a.role!==I?{...a,role:I}:a}}return "lookupTableAddress"in d?{...d,[T]:1}:{...d,[T]:2}});}return n}function ts(e){let t;return Object.entries(e).sort(([r,i],[c,o])=>{if(i[T]!==o[T]){if(i[T]===0)return -1;if(o[T]===0)return 1;if(i[T]===2)return -1;if(o[T]===2)return 1}let a=w(i.role);if(a!==w(o.role))return a?-1:1;let s=k(i.role);return s!==k(o.role)?s?-1:1:(t||=J(),i[T]===1&&o[T]===1&&i.lookupTableAddress!==o.lookupTableAddress?t(i.lookupTableAddress,o.lookupTableAddress):t(r,c))}).map(([r,i])=>({address:r,...i}))}function ns(e){let t={};for(let n of e){if(!("lookupTableAddress"in n))continue;let r=t[n.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};n.role===b.WRITABLE?r.writableIndexes.push(n.addressIndex):r.readonlyIndexes.push(n.addressIndex);}return Object.keys(t).sort(J()).map(n=>({lookupTableAddress:n,...t[n]}))}function rs(e){let t=0,n=0,r=0;for(let i of e){if("lookupTableAddress"in i)break;let c=k(i.role);w(i.role)?(r++,c||n++):c||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function is(e){let t={};for(let[n,r]of e.entries())t[r.address]=n;return t}function os(e,t){let n=is(t);return e.map(({accounts:r,data:i,programAddress:c})=>({programAddressIndex:n[c],...r?{accountIndices:r.map(({address:o})=>n[o])}:null,...i?{data:i}:null}))}function as(e){return "nonce"in e?e.nonce:e.blockhash}function ss(e){let t=e.findIndex(r=>"lookupTableAddress"in r);return (t===-1?e:e.slice(0,t)).map(({address:r})=>r)}function An(e){let t=es(e.feePayer.address,e.instructions),n=ts(t),r=e.lifetimeConstraint;return {...e.version!=="legacy"?{addressTableLookups:ns(n)}:null,...r?{lifetimeToken:as(r)}:null,header:rs(n),instructions:os(e.instructions,n),staticAccounts:ss(n),version:e.version}}function cs(e,t,n){for(let[r,i]of Object.entries(n))for(let c=0;c<i.length;c++)if(e===i[c])return {address:e,addressIndex:c,lookupTableAddress:r,role:t}}function _n(e,t){let n=new Set(e.instructions.map(o=>o.programAddress)),r=new Set(Object.values(t).flatMap(o=>o).filter(o=>!n.has(o))),i=[],c=false;for(let o of e.instructions){if(!o.accounts){i.push(o);continue}let a=[],s=false;for(let d of o.accounts){if("lookupTableAddress"in d||!r.has(d.address)||w(d.role)){a.push(d);continue}let I=cs(d.address,d.role,t);a.push(Object.freeze(I)),s=true,c=true;}i.push(Object.freeze(s?{...o,accounts:a}:o));}return Object.freeze(c?{...e,instructions:i}:e)}function Tn(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var ds="SysvarRecentB1ockHashes11111111111111111111",us="11111111111111111111111111111111";function Is(e){return e.programAddress===us&&e.data!=null&&As(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===b.WRITABLE&&e.accounts[1].address===ds&&e.accounts[1].role===b.READONLY&&e.accounts[2].address!=null&&w(e.accounts[2].role)}function As(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function ke(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Is(e.instructions[0])}function ln(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function En(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function _s(e){let t=Object.values(e);if(t.length===0)throw new A(Ne);return t.map(n=>n||new Uint8Array(64).fill(0))}function Ts(){return S(U(P(K(),64),{size:h()}),_s)}function We(){return f([["signatures",Ts()],["messageBytes",K()]])}function Ge(e){let t=An(e),n=In().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),i={};for(let o of r)i[o]=null;let c;return cn(e)?c={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:ke(e)&&(c={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...c?{lifetimeConstraint:c}:void 0,messageBytes:n,signatures:Object.freeze(i)})}function Ve(e){let t=We().encode(e);return q().decode(t)}function gn(e,t){Object.freeze(e);let n={...t,feePayer:e};return Object.freeze(n),n}function Rn(e){return Object.freeze({address:e,signMessages:n=>Promise.resolve(n.map(()=>Object.freeze({}))),signTransactions:n=>Promise.resolve(n.map(()=>Object.freeze({})))})}var ne="ComputeBudget111111111111111111111111111111";var He=2;function Ke(){return S(f([["discriminator",y()],["units",ee()]]),e=>({...e,discriminator:He}))}function re(e,t){let n=ne,r={...e};return Object.freeze({data:Ke().encode(r),programAddress:n})}var Ye=3;function je(){return S(f([["discriminator",y()],["microLamports",te()]]),e=>({...e,discriminator:Ye}))}function ie(e,t){let n=ne,r={...e};return Object.freeze({data:je().encode(r),programAddress:n})}var oe="11111111111111111111111111111111";var Dn=0,Nn=1,Sn=2,fn=3,Cn=4,On=5,mn=6,pn=7,Mn=8;process.env.NODE_ENV!=="production"&&({[Dn]:"an account with the same address already exists",[On]:"provided address does not match addressed derived from seed",[fn]:"cannot allocate account data of this length",[Sn]:"cannot assign account to this program id",[Cn]:"length of requested seed is too long",[pn]:"stored nonce is still in recent_blockhashes",[mn]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[Mn]:"specified nonce does not match stored nonce",[Nn]:"account does not have enough SOL to perform the operation"});var $e="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";async function Y({transactionActionType:e,transactionAddress:t,transactionMessageBytes:n,signer:r,provider:i}){if(typeof window>"u")throw new Error("Function can only be called in a browser environment");let c={transactionActionType:e,transactionAddress:t,transactionMessageBytes:core.bufferToBase64URLString(n)},o=window.origin,a={phase:"start",data:{type:"transaction",payload:c},redirectOrigin:o,signer:r},{signature:s}=await i.onClientAuthorizationCallback(a),d=await i.sendPayloadToProvider({payload:a,signature:s}),{signature:I}=await i.onClientAuthorizationCallback({...d,data:{...d.data,payload:{...d.data.payload,transactionPayload:c}}});return {...d.data.payload,transactionPayload:c,clientSignature:{...d.data.payload.clientSignature,signature:I}}}async function hn(e){let t=await Xe(e);return core.signAndSendTransaction(t)}var Xe=async e=>{let{amount:t,destination:n,mint:r,payer:i,addressesByLookupTableAddress:c,tokenProgram:o=$e,cachedAccounts:a=new Map,signer:s,provider:d,createAtaIfNeeded:I=true}=e;d.openBlankPopUp();let u=await Y({transactionActionType:"transfer_intent",transactionAddress:r?o:oe,transactionMessageBytes:new Uint8Array([...te().encode(t),...M().encode(n),...M().encode(r??oe)]),signer:s,provider:d}),l;if(u.additionalInfo.settingsIndexWithAddress)l=u.additionalInfo.settingsIndexWithAddress;else {let B=await core.fetchUserAccountData(new core.Secp256r1Key(u.signer),u.userAddressTreeIndex,a);if(B.delegatedTo.__option==="None")throw Error("User has no delegated wallet");l=B.delegatedTo.value;}let[D,W]=await Promise.all([core.fetchSettingsAccountData(l.index,l.settingsAddressTreeIndex,a),core.getSignedSecp256r1Key(u)]),{transactionManagerAddress:E,userAddressTreeIndex:C}=core.retrieveTransactionManager(u.signer,D),O=await core.getSignedTransactionManager({authResponses:[u],transactionManagerAddress:E,userAddressTreeIndex:C,cachedAccounts:a}),g=O?[W,O]:[W];return {instructions:r?await core.tokenTransferIntent({payer:i,index:l.index,settingsAddressTreeIndex:l.settingsAddressTreeIndex,createAtaIfNeeded:I,amount:t,signers:g,destination:n,mint:r,tokenProgram:o,compressed:D.isCompressed,cachedAccounts:a}):await core.nativeTransferIntent({payer:i,index:l.index,settingsAddressTreeIndex:l.settingsAddressTreeIndex,amount:t,signers:g,destination:n,compressed:D.isCompressed,cachedAccounts:a}),payer:i,addressesByLookupTableAddress:c}};function ae(e){let t=`${e.domain} wants you to sign in with your account.`,n=[];return e.nonce&&n.push(`Nonce: ${e.nonce}`),n.length&&(t+=`
|
|
6
6
|
|
|
7
7
|
${n.join(`
|
|
8
8
|
`)}`),t}function yn(){let e=crypto.getRandomValues(new Uint8Array(33)),t=crypto.getRandomValues(new Uint8Array(37)),n=crypto.getRandomValues(new Uint8Array(250)),r=crypto.getRandomValues(new Uint8Array(64));return new core.SignedSecp256r1Key(e,{originIndex:0,crossOrigin:false,authData:t,domainConfig:H().decode(crypto.getRandomValues(new Uint8Array(32))),signature:r,verifyArgs:{slotHash:crypto.getRandomValues(new Uint8Array(32)),slotNumber:BigInt(0),truncatedClientDataJson:crypto.getRandomValues(new Uint8Array(100)),clientDataJson:n},clientAndDeviceHash:crypto.getRandomValues(new Uint8Array(32)),authResponse:{id:"",rawId:"",type:"public-key",clientExtensionResults:{},response:{authenticatorData:core.bufferToBase64URLString(t),clientDataJSON:core.bufferToBase64URLString(n),signature:core.bufferToBase64URLString(r)}}})}async function Ln({payer:e,index:t,settingsAddressTreeIndex:n,transactionMessageBytes:r,signers:i,compressed:c,addressesByLookupTableAddress:o,cachedAccounts:a}){let s=await core.prepareTransactionSync({payer:e,index:t,settingsAddressTreeIndex:n,transactionMessageBytes:r,signers:i,compressed:c,simulateProof:true,addressesByLookupTableAddress:o,cachedAccounts:a}),d=ve(Tn({version:0}),u=>ln(s.instructions,u),u=>gn(s.payer,u),u=>dn({blockhash:en().decode(crypto.getRandomValues(new Uint8Array(32))),lastValidBlockHeight:BigInt(Number.MAX_SAFE_INTEGER)},u),u=>s.addressesByLookupTableAddress?_n(u,s.addressesByLookupTableAddress):u,u=>En([re({units:8e5}),ie({microLamports:1e3})],u),u=>Ge(u)),I=Ve(d).length;return console.log("Estimated Tx Size: ",I),I>1644}async function Un(e=core.getJitoTipsConfig()){let{getJitoTipsUrl:t,priority:n}=e,i=await(await fetch(t)).json();return Math.round(i[0][n]*10**9)}var vn=async e=>{let{addressesByLookupTableAddress:t,instructions:n,payer:r,additionalSigners:i,signer:c,settingsIndexWithAddress:o,provider:a,cachedAccounts:s=new Map}=e;a.openBlankPopUp();let[d,I,u]=await Promise.all([core.fetchSettingsAccountData(o.index,o.settingsAddressTreeIndex,s),core.getSettingsFromIndex(o.index),core.prepareTransactionMessage({payer:await core.getWalletAddressFromIndex(o.index),instructions:n,addressesByLookupTableAddress:t})]),{transactionManagerAddress:l,userAddressTreeIndex:D}=core.retrieveTransactionManager(c,d);if(await Ln({signers:[yn(),...i??[],...l?[Rn(l)]:[]],compressed:d.isCompressed,payer:r,index:o.index,settingsAddressTreeIndex:o.settingsAddressTreeIndex,transactionMessageBytes:u,addressesByLookupTableAddress:t,cachedAccounts:s})){let[E,C]=await Promise.all([Y({signer:c,transactionActionType:l?"execute":"create_with_preauthorized_execution",transactionAddress:I,transactionMessageBytes:new Uint8Array(u),provider:a}),Un()]),[O,g]=await Promise.all([core.getSignedTransactionManager({authResponses:[E],transactionMessageBytes:u,transactionManagerAddress:l,userAddressTreeIndex:D}),core.getSignedSecp256r1Key(E)]);return await core.prepareTransactionBundle({compressed:d.isCompressed,index:o.index,settingsAddressTreeIndex:o.settingsAddressTreeIndex,transactionMessageBytes:u,creator:O??g,executor:O?g:void 0,jitoBundlesTipAmount:C,payer:r,additionalSigners:i,addressesByLookupTableAddress:t,cachedAccounts:s})}else {let E=await Y({signer:c,transactionActionType:"sync",transactionAddress:I.toString(),transactionMessageBytes:new Uint8Array(u),provider:a}),[C,O]=await Promise.all([core.getSignedTransactionManager({authResponses:[E],transactionMessageBytes:new Uint8Array(u),transactionManagerAddress:l,userAddressTreeIndex:D}),core.getSignedSecp256r1Key(E)]);return [await core.prepareTransactionSync({compressed:d.isCompressed,signers:[O,...i??[],...C?[C]:[]],payer:r,transactionMessageBytes:u,index:o.index,settingsAddressTreeIndex:o.settingsAddressTreeIndex,addressesByLookupTableAddress:t,cachedAccounts:s})]}};async function se(e){let t=await fetch(`${e}/getRandomPayer`),{randomPayer:n}=await t.json();return {address:x(n),async signTransactions(r){let i={publicKey:n,transactions:r.map(a=>q().decode(We().encode(a)))},o=await(await fetch(`${e}/sign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).json();if("error"in o)throw new Error(o.error);return o.signatures.map(a=>({[x(n)]:Q().encode(a)}))}}}async function Pn({message:e,signer:t,provider:n}){if(typeof window>"u")throw new Error("Function can only be called in a browser environment");n.openBlankPopUp();let r=window.origin,i={phase:"start",data:{type:"message",payload:e},redirectOrigin:r,signer:t},{signature:c,message:o,id:a}=await n.onClientAuthorizationCallback(i),s=await n.sendPayloadToProvider({payload:{...i,data:{...i.data,payload:o}},signature:c});return await n.onClientAuthorizationCallback({...s,data:{...s.data,payload:{...s.data.payload,id:a,message:o}}})}function Fn(e,t){let n={};function r(s,...d){n[s]?.forEach(({fn:I,ctx:u})=>{I.apply(u,d);});}let i=window.localStorage.getItem("Revibase:account"),{publicKey:c,member:o,settingsIndexWithAddress:a}=i?JSON.parse(i):{publicKey:null,member:null,settingsIndexWithAddress:null};return {publicKey:c,member:o,settingsIndexWithAddress:a,connect:async function(){let s=ae({domain:window.location.origin,nonce:crypto.randomUUID()}),{user:d}=await this.signMessage(s);if(!d)throw Error("Failed to verify signed message");this.publicKey=d.walletAddress,this.member=d.publicKey,this.settingsIndexWithAddress=d.settingsIndexWithAddress,window.localStorage.setItem("Revibase:account",JSON.stringify({publicKey:this.publicKey,member:this.member,settingsIndexWithAddress:this.settingsIndexWithAddress},(I,u)=>typeof u=="bigint"?Number(u.toString()):u)),r("connect"),r("accountChanged");},disconnect:async function(){this.publicKey=null,this.member=null,this.settingsIndexWithAddress=null,window.localStorage.removeItem("Revibase:account"),r("disconnect");},signMessage:async function(s){return await Pn({signer:this.member??void 0,message:s,provider:e})},buildTokenTransfer:async function(s){if(!this.member||!this.settingsIndexWithAddress||!this.publicKey)throw new Error("Wallet is not connected");let d=t??await se($);return Xe({...s,signer:this.member,payer:d,provider:e})},signAndSendTokenTransfer:async function(s){if(!this.member||!this.settingsIndexWithAddress||!this.publicKey)throw new Error("Wallet is not connected");let d=t??await se($);return hn({...s,signer:this.member,payer:d,provider:e})},buildTransaction:async function(s){if(!this.member||!this.settingsIndexWithAddress||!this.publicKey)throw new Error("Wallet is not connected");let d=t??await se($);return vn({...s,signer:this.member,settingsIndexWithAddress:this.settingsIndexWithAddress,payer:d,provider:e})},signAndSendTransaction:async function(s){let d=await this.buildTransaction(s);if(!d.length)throw new Error("Unable to build transaction");return d.length===1?core.signAndSendTransaction(d[0]):core.signAndSendBundledTransactions(d)},on:function(s,d,I){n[s]||(n[s]=[]),n[s].push({fn:d,ctx:I});},off:function(s,d,I){n[s]=n[s]?.filter(u=>u.fn!==d||u.ctx!==I);}}}var Bn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjI1MDAgMjAwIDUwMDAgNTAwMCI+CiAgPHBhdGggZD0iTTMxMDAgMzAwaDM4MDBhNDAwIDQwMCAwIDAxIDQwMCA0MDB2MzgwMGE0MDAgNDAwIDAgMDEtNDAwIDQwMEgzMTAwYTQwMCA0MDAgMCAwMS00MDAtNDAwVjcwMGE0MDAgNDAwIDAgMDEgNDAwLTQwMCIgZmlsbD0iI2ZmZiIvPgogIDxwYXRoIGQ9Ik01MjA0IDEwMDdoLTE2OTBhMTk5IDE5OSAwIDAwLTIwMCAxOTh2Mjc4MGExOTkgMTk5IDAgMDAgMTk5IDE5OGg3MzdsMTI5NyA0OTdhMjAwIDIwMCAwIDAwIDcwIDEzIDIwMCAyMDAgMCAwMCAxODYtMTI3bDc0NS0xOTQz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GgybDgtNGgzbDEwLTZoMjhhMTI2MCAxMjYwIDAgMDAgNTA4LTEwNmwtMTcwIDQ1NmE0NCA0NCAwIDAxLTQwIDI4TTY2MzAgMTg2MGE0MyA0MyAwIDAxIDIzIDUzbC0xNzUgNDU2LTMtNC01LTEyLTEwLTIwLTYtMTItMTAtMTQtNi0xMC0xNi0yOC0xOC0zMC02LTEwLTEzLTIwLTctMTAtMTMtMjAtNy0xMC0xNS0yMC01LTgtMjAtMjctNi01LTE3LTIwLTgtMTAtMTQtMTgtMTAtMTAtMTUtMTYtOC0xMC0yMC0yMFYyMDAwYTEyMDAgMTIwMCAwIDAwLTI1LTI0bC04LTctMTgtMTYtMTAtMTAtMTYtMTMtMTAtOC0xOC0xNi04LTYtMjctMjAtNC0zYTgwMCA4MDAgMCAwMC0yNC0xOGwtMTAtNi0yMC0xNS0xMC03LTIwLTEyLTEwLTctMjItMTQtNi0zLTMwLTE3LTEwLTQtMjMtMTItMTAtNi0yMC0xMC0xMS01LTIyLTEwLTEwLTRhMTM1MCAxMzUwIDAgMDAtMTcwLTU3IDE0MDAgMTQwMCAwIDAwLTQzLTEwbC04LTJhMTUwMCAxNTAwIDAgMDAtNDAtOGwtMTAtMWExMjAwIDEyMDAgMCAwMC00MC03IDE0MDAgMTQwMCAwIDAwLTQ0LTVsLTgtMWExNDAwIDE0MDAgMCAwMC00Mi00aC0zdi0yNDAiLz4KICA8cGF0aCBkPSJNNDM1OSAyMjU1YTM0MCAzNDAgMCAxMCAzNDAgMzQwIDM0MCAzNDAgMCAwMC0zNDAtMzQwbTAgNTI0YTE4NCAxODQgMCAwMS0xODUtMTg0IDE4NCAxODQgMCAwMSAxODQtMTg0IDE4NCAxODQgMCAwMSAxODUgMTg0IDE4NCAxODQgMCAwMS0xODQgMTg0Ii8+Cjwvc3ZnPgo=";var ce=class extends core$1.ReadonlyWalletAccount{member;settingsIndexWithAddress;constructor(t,n,r){super(t),this.member=n,this.settingsIndexWithAddress=r;}};var de=class e{#n={};#a="1.0.0";#s="Revibase";#c=Bn;#t=null;#e;get version(){return this.#a}get name(){return this.#s}get icon(){return this.#c}get chains(){return ["solana:mainnet","solana:devnet"]}get features(){return {"standard:connect":{version:"1.0.0",connect:this.#A},"standard:disconnect":{version:"1.0.0",disconnect:this.#_},"standard:events":{version:"1.0.0",on:this.#d},"revibase:SignAndSendTransaction":{version:"1.0.0",signAndSendTransaction:this.#T},"revibase:BuildTransaction":{version:"1.0.0",buildTransaction:this.#l},"revibase:SignAndSendTokenTransfer":{version:"1.0.0",signAndSendTokenTransfer:this.#E},"revibase:BuildTokenTransferTransaction":{version:"1.0.0",buildTokenTransferTransaction:this.#g},"revibase:SignMessage":{version:"1.0.0",signMessage:this.#R},"revibase:":{revibase:this.#e}}}get accounts(){return this.#t?[this.#t]:[]}constructor(t){new.target===e&&Object.freeze(this),this.#e=t,t.on("connect",this.#r,this),t.on("disconnect",this.#o,this),t.on("accountChanged",this.#I,this),this.#r();}#d=(t,n)=>(this.#n[t]?.push(n)||(this.#n[t]=[n]),()=>this.#u(t,n));#i(t,...n){this.#n[t]?.forEach(r=>r.apply(null,n));}#u(t,n){this.#n[t]=this.#n[t]?.filter(r=>n!==r);}#r=()=>{let t=this.#e.publicKey,n=this.#e.member,r=this.#e.settingsIndexWithAddress;if(t&&n&&r){let i=new Uint8Array(M().encode(x(t))),c=this.#t;(!c||c.address!==t.toString()||!core$1.bytesEqual(c.publicKey,i))&&(this.#t=new ce({address:t,publicKey:i,chains:this.chains,features:Object.keys(this.features)},n,r),this.#i("change",{accounts:this.accounts}));}};#o=()=>{this.#t&&(this.#t=null,this.#i("change",{accounts:this.accounts}));};#I=()=>{this.#t?this.#r():this.#o();};#A=async t=>(this.#t||await this.#e.connect(t),this.#r(),{accounts:this.accounts});#_=async()=>{await this.#e.disconnect();};#T=t=>this.#e.signAndSendTransaction(t);#l=t=>this.#e.buildTransaction(t);#E=t=>this.#e.signAndSendTokenTransfer(t);#g=t=>this.#e.buildTokenTransfer(t);#R=t=>this.#e.signMessage(t)};function Iy(e){if(core.initialize({rpcEndpoint:e.rpcEndpoint,proverEndpoint:e.proverEndpoint,compressionApiEndpoint:e.compressionApiEndpoint,jitoTipsConfig:e.jitoTipsConfig}),typeof window<"u"){let t=new X({onClientAuthorizationCallback:e.onClientAuthorizationCallback,providerOrigin:e.providerOrigin});core$1.registerWallet(new de(Fn(t,e.feePayer)));}}async function zn(e,t=j,n=qe){let{payload:r}=e.data,i=r.message,c=core.createMessageChallenge(i,r.clientSignature.clientOrigin,r.deviceSignature.publicKey,r.nonce),{verified:o}=await server.verifyAuthenticationResponse({response:r.authResponse,expectedChallenge:core.bufferToBase64URLString(c),expectedRPID:n,expectedOrigin:t,requireUserVerification:false,credential:{counter:0,id:r.authResponse.id,publicKey:core.convertPubkeyCompressedToCose(r.signer)}});if(!o)throw new Error("Unable to verify message");let a=e.data.payload.additionalInfo.settingsIndexWithAddress;if(!a)throw new Error("User does not have a delegated wallet address.");let s=await core.getWalletAddressFromIndex(a.index);return {publicKey:r.signer,walletAddress:s,settingsIndexWithAddress:a,...r.additionalInfo}}async function Oy(e,t,n,r){if(e.phase==="start"){let{data:o}=e;if(o.type==="message"){let a=o.payload??ae({domain:"your_website_name",nonce:crypto.randomUUID()}),s=core.createClientAuthorizationStartRequestChallenge({...e,data:{...o,payload:a}});return {signature:F().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(s)))),message:a}}else {let a=core.createClientAuthorizationStartRequestChallenge(e);return {signature:F().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(a))))}}}if(e.data.type==="message")return {user:await zn({data:e.data},n,r)};let i=core.createClientAuthorizationCompleteRequestChallenge(e);return {signature:F().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(i))))}}exports.RevibaseBuildTokenTransferTransaction=xc;exports.RevibaseBuildTransaction=Bc;exports.RevibaseSignAndSendTokenTransfer=zc;exports.RevibaseSignAndSendTransaction=Fc;exports.RevibaseSignMessage=kc;exports.getRandomPayer=se;exports.initializeWallet=Iy;exports.processClientAuthCallback=Oy;//# sourceMappingURL=index.cjs.map
|