@revibase/transaction-manager 0.4.4 → 0.4.6
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 +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {MULTI_WALLET_PROGRAM_ADDRESS,identifyMultiWalletInstruction,MultiWalletI
|
|
|
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.`,[sr]:"No signature verification implementation could be found.",[cr]:"No key generation implementation could be found.",[ur]:"No signing implementation could be found.",[dr]:"No key export implementation could be found.",[Un]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[ra]:"Transaction processing left an account with an outstanding borrowed reference",[Wo]:"Account in use",[Go]:"Account loaded twice",[Ho]:"Attempt to debit an account but found no record of a prior credit.",[da]:"Transaction loads an address table account that doesn't exist",[Xo]:"This transaction has already been processed",[jo]:"Blockhash not found",[Zo]:"Loader call chain is too deep",[na]:"Transactions are currently disabled due to cluster maintenance",[Ta]:"Transaction contains a duplicate instruction ($index) that is not allowed",[$o]:"Insufficient funds for fee",[ga]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Yo]:"This account may not be used to pay transaction fees",[Jo]:"Transaction contains an invalid account reference",[Aa]:"Transaction loads an address table account with invalid data",[la]:"Transaction address table lookup uses an invalid index",[_a]:"Transaction loads an address table account with an invalid owner",[Sa]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[ea]:"This program may not be used for executing instructions",[Ia]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[ia]:"Transaction loads a writable account that cannot be written",[fa]:"Transaction exceeded max loaded accounts data size cap",[qo]:"Transaction requires a fee but has no signature present",[Ko]:"Attempt to load a program that does not exist",[Da]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Na]:"ResanitizationNeeded",[ta]:"Transaction failed to sanitize accounts offsets correctly",[Qo]:"Transaction did not pass signature verification",[ua]:"Transaction locked too many accounts",[Oa]:"Sum of account balances before and after transaction do not match",[Vo]:"The transaction failed with the error `$errorName`",[aa]:"Transaction version is unsupported",[ca]:"Transaction would exceed account data limit within the block",[Ra]:"Transaction would exceed total account data limit",[sa]:"Transaction would exceed max account limit within the block",[oa]:"Transaction would exceed max Block Cost Limit",[Ea]:"Transaction would exceed max Vote Cost Limit",[lt]:"Attempted to sign a transaction with an address that is not a signer for it",[Bo]:"Transaction is missing an address at index: $index.",[It]:"Transaction has no expected signers therefore it cannot be encoded",[Et]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ne]:"Transaction does not have a blockhash lifetime",[re]:"Transaction is not a durable nonce transaction",[oe]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[ae]:"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",[se]:"No fee payer set in CompiledTransaction",[ie]:"Could not find program address at index $index",[zo]:"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",[ko]:"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",[Po]:"Transaction is missing a fee payer.",[At]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[xo]:"Transaction first instruction is not advance nonce account instruction.",[Fo]:"Transaction with no instructions cannot be durable nonce transaction.",[ct]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[ut]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[ce]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[_t]:"Transaction is missing signatures for addresses: $addresses.",[dt]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[ue]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Rt]:"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."},D="i",S="t";function ri(e,t={}){let n=ni[e];if(n.length===0)return "";let r;function o(i){if(r[S]===2){let s=n.slice(r[D]+1,i);a.push(s in t?`${t[s]}`:`$${s}`);}else r[S]===1&&a.push(n.slice(r[D],i));}let a=[];return n.split("").forEach((i,s)=>{if(s===0){r={[D]:0,[S]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[S]){case 0:c={[D]:s,[S]:1};break;case 1:i==="\\"?c={[D]:s,[S]:0}:i==="$"&&(c={[D]:s,[S]:2});break;case 2:i==="\\"?c={[D]:s,[S]:0}:i==="$"?c={[D]:s,[S]:2}:i.match(/\w/)||(c={[D]:s,[S]:1});break}c&&(r!==c&&o(s),r=c);}),o(),a.join("")}function oi(e,t={}){if(process.env.NODE_ENV!=="production")return ri(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${ti(t)}'`),`${n}\``}}var l=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([a,i])=>{a==="cause"?r={cause:i.value}:(n===void 0&&(n={}),Object.defineProperty(n,a,i));});let o=oi(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function ai(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var ii=(e,t)=>ai(e.length<=t?e:e.slice(0,t),t);function R(e,t,n){let r=e.length===t.length?e:e.slice(n,n+t.length);return r.length!==t.length?false:t.every((o,a)=>o===r[a])}function ht(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function M(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(ht(t,e));return e.write(t,n,0),n}})}function I(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function O(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function Lt(e,t,n=0){if(t.length-n<=0)throw new l(de,{codecDescription:e})}function z(e,t,n,r=0){let o=n.length-r;if(o<t)throw new l(_e,{bytesLength:o,codecDescription:e,expected:t})}function pt(e,t,n){if(t<0||t>n)throw new l(Ie,{bytesLength:n,codecDescription:e,offset:t})}function Ee(e,t){let n=(i,s)=>{let[c,u]=t.read(i,s),d=Number(c);return s=u,(s>0||i.length>d)&&(i=i.slice(s,s+d)),z("addDecoderSizePrefix",d,i),[e.decode(i),s+d]};if(O(t)&&O(e))return I({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=O(t)?t.fixedSize:t.maxSize??null,o=O(e)?e.fixedSize:e.maxSize??null,a=r!==null&&o!==null?r+o:null;return I({...e,...a!==null?{maxSize:a}:{},read:n})}function y(e,t){return I({fixedSize:t,read:(n,r)=>{z("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),O(e)&&(n=ii(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function si(e,t){return I({...e,read:(n,r)=>{let o=u=>ci(u,n.length),a=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;pt("offsetDecoder",a,n.length);let[i,s]=e.read(n,a),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:a,postOffset:s,preOffset:r,wrapBytes:o}):s;return pt("offsetDecoder",c,n.length),[i,c]}})}function ci(e,t){return t===0?0:(e%t+t)%t}function ui(e,t){if(O(e)){let n=t(e.fixedSize);if(n<0)throw new l(le,{bytesLength:n,codecDescription:"resizeDecoder"});return I({...e,fixedSize:n})}return e}function Mt(e,t){return si(ui(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function b(e,t){return I({...e,read:(n,r)=>{let[o,a]=e.read(n,r);return [t(o,n,r),a]}})}function bt(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new l(W,{alphabet:e,base:e.length,value:n})}var di=e=>M({getSizeFromValue:t=>{let[n,r]=yt(t,e[0]);if(!r)return t.length;let o=Ut(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(bt(e,t),t==="")return r;let[o,a]=yt(t,e[0]);if(!a)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let i=Ut(a,e),s=[];for(;i>0n;)s.unshift(Number(i%256n)),i/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),_i=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=Ai(i,e);return [a+s,t.length]}});function yt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Ut(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function Ai(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",Re=()=>di(vt),wt=()=>_i(vt);var li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=()=>M({getSizeFromValue:e=>Buffer.from(e,"base64").length,write(e,t,n){bt(li,e.replace(/=/g,""));let r=Buffer.from(e,"base64");return t.set(r,n),r.length+n}});var Ii=e=>e.replace(/\u0000/g,"");var Ei=globalThis.TextDecoder;var Te=()=>{let e;return I({read(t,n){let r=(e||=new Ei).decode(t.slice(n));return [Ii(r),t.length]}})};function Ri(e){return !("exists"in e)||"exists"in e&&e.exists}function Bt(e){let t=e.filter(n=>Ri(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new l(te,{addresses:n})}}function Ti(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=w().encode(t.data[0]);return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function gi(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function Pt(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function Ft(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((i,s)=>i&&typeof i=="object"&&"parsed"in i.data?gi(t[s],i):Ti(t[s],i))}function ge(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new l(ee,{addresses:n})}}var fe,Se;function fi(){return fe||(fe=Re()),fe}function Si(){return Se||(Se=wt()),Se}function H(e){if(e.length<32||e.length>44)throw new l(Q,{actualLength:e.length});let r=fi().encode(e).byteLength;if(r!==32)throw new l(J,{actualLength:r})}function B(e){return H(e),e}function P(){return y(Si(),32)}function Ni(e,t,n,r){if(r<t||r>n)throw new l(Ae,{codecDescription:e,max:n,min:t,value:r})}function xt(e){return e?.endian!==1}function Di(e){return M({fixedSize:e.size,write(t,n,r){e.range&&Ni(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,xt(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function zt(e){return I({fixedSize:e.size,read(t,n=0){Lt(e.name,t,n),z(e.name,e.size,t,n);let r=new DataView(Oi(t,n,e.size));return [e.get(r,xt(e.config)),n+e.size]}})}function Oi(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var N=()=>I({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,a=e[t+o],i=127&a;if(n|=i<<o*7,(a&128)===0)break}return [n,t+r]}});var T=(e={})=>Di({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4}),De=(e={})=>zt({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4});var p=()=>zt({get:e=>e.getUint8(0),name:"u8",size:1});function K(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Oe(e){return O(e)?e.fixedSize:null}function Ce(e){return O(e)?e.fixedSize:e.maxSize??null}function C(e,t={}){let n=t.size??De(),r=Oe(e),o=kt(n,r),a=kt(n,Ce(e))??void 0;return I({...o!==null?{fixedSize:o}:{maxSize:a},read:(i,s)=>{let c=[];if(typeof n=="object"&&i.slice(s).length===0)return [c,s];if(n==="remainder"){for(;s<i.length;){let[A,_]=e.read(i,s);s=_,c.push(A);}return [c,s]}let[u,d]=typeof n=="number"?[n,s]:n.read(i,s);s=d;for(let A=0;A<u;A+=1){let[_,f]=e.read(i,s);s=f,c.push(_);}return [c,s]}})}function kt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function k(){return I({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function Vt(e){let t=K(e.map(Oe)),n=K(e.map(Ce))??void 0;return I({...t===null?{maxSize:n}:{fixedSize:t},read:(r,o)=>{let a=[];return e.forEach(i=>{let[s,c]=i.read(r,o);a.push(s),o=c;}),[a,o]}})}function h(e){let t=e.map(([,o])=>o),n=K(t.map(Oe)),r=K(t.map(Ce))??void 0;return I({...n===null?{maxSize:r}:{fixedSize:n},read:(o,a)=>{let i={};return e.forEach(([s,c])=>{let[u,d]=c.read(o,a);a=d,i[s]=u;}),[i,a]}})}function Wt(e,...t){return t.reduce((n,r)=>r(n),e)}var E=(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))(E||{});function Gt(e){return e>=2}function yi(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)})}var Ui=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=bi(i,e);return [a+s,t.length]}});function bi(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var vi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var wi=()=>Ui(vi);var me;function Bi(){if(!me){let e=C(p(),{size:N()});me=h([["lookupTableAddress",P()],["writableIndexes",e],["readonlyIndexes",e]]);}return me}var pe;function he(){return pe||(pe=p()),pe}function Pi(){return h([["numSignerAccounts",he()],["numReadonlySignerAccounts",he()],["numReadonlyNonSignerAccounts",he()]])}var Le;function Fi(){return Le||(Le=b(h([["programAddressIndex",p()],["accountIndices",C(p(),{size:N()})],["data",Ee(k(),N())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:n,...r}=e;return {...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),Le}var xi=0,Ht=128;function Me(){return I({maxSize:1,read:(e,t)=>{let n=e[t];if((n&Ht)===0)return ["legacy",t];{let r=n^Ht;if(r>xi)throw new l(ue,{unsupportedVersion:r});return [r,t+1]}}})}function zi(){return [["version",Me()],["header",Pi()],["staticAccounts",C(P(),{size:N()})],["lifetimeToken",y(wi(),32)],["instructions",C(Fi(),{size:N()})],["addressTableLookups",ki()]]}function ki(){return C(Bi(),{size:N()})}function Yt(){return b(h(zi()),({addressTableLookups:e,...t})=>t.version==="legacy"||!e?.length?t:{...t,addressTableLookups:e})}function Vi(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var Xt="SysvarRecentB1ockHashes11111111111111111111",jt="11111111111111111111111111111111";function Kt(e,t){return {accounts:[{address:e,role:E.WRITABLE},{address:Xt,role:E.READONLY},{address:t,role:E.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:jt}}function ye(e){return e.programAddress===jt&&e.data!=null&&Wi(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===E.WRITABLE&&e.accounts[1].address===Xt&&e.accounts[1].role===E.READONLY&&e.accounts[2].address!=null&&Gt(e.accounts[2].role)}function Wi(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Zt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&ye(e.instructions[0])}function Gi(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}function Hi({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o,a=r.instructions[0];if(a&&ye(a))if(Gi(a,t,n)){if(Zt(r)&&r.lifetimeConstraint.nonce===e)return r;o=[a,...r.instructions.slice(1)];}else o=[Object.freeze(Kt(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Kt(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}function Ki(e,t){if("feePayer"in t&&e===t.feePayer?.address&&$i(t.feePayer))return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function $i(e){return !!e&&"address"in e&&typeof e.address=="string"&&Object.keys(e).length===1}function Yi(e,t){return Xi([e],t)}function Xi(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function ji(e){let{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[],a=0;for(let i=0;i<n;i++)o.push({address:e.staticAccounts[a],role:E.WRITABLE_SIGNER}),a++;for(let i=0;i<t.numReadonlySignerAccounts;i++)o.push({address:e.staticAccounts[a],role:E.READONLY_SIGNER}),a++;for(let i=0;i<r;i++)o.push({address:e.staticAccounts[a],role:E.WRITABLE}),a++;for(let i=0;i<t.numReadonlyNonSignerAccounts;i++)o.push({address:e.staticAccounts[a],role:E.READONLY}),a++;return o}function Zi(e,t){let r=e.map(i=>i.lookupTableAddress).filter(i=>t[i]===void 0);if(r.length>0)throw new l(oe,{lookupTableAddresses:r});let o=[],a=[];for(let i of e){let s=t[i.lookupTableAddress],c=i.readonlyIndexes,u=i.writableIndexes,d=Math.max(...c,...u);if(d>=s.length)throw new l(ae,{highestKnownIndex:s.length-1,highestRequestedIndex:d,lookupTableAddress:i.lookupTableAddress});let A=c.map(f=>({address:s[f],addressIndex:f,lookupTableAddress:i.lookupTableAddress,role:E.READONLY}));o.push(...A);let _=u.map(f=>({address:s[f],addressIndex:f,lookupTableAddress:i.lookupTableAddress,role:E.WRITABLE}));a.push(..._);}return [...a,...o]}function qi(e,t){let n=t[e.programAddressIndex]?.address;if(!n)throw new l(ie,{index:e.programAddressIndex});let r=e.accountIndices?.map(a=>t[a]),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}function Ji(e,t,n){if(!t||!ye(t))return {blockhash:e,lastValidBlockHeight:n??2n**64n-1n};{let r=t.accounts[0].address;H(r);let o=t.accounts[2].address;return H(o),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:o}}}function qt(e,t){let n=e.staticAccounts[0];if(!n)throw new l(se);let r=ji(e),o="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?Zi(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[],a=[...r,...o],i=e.instructions.map(u=>qi(u,a)),s=i[0],c=Ji(e.lifetimeToken,s,t?.lastValidBlockHeight);return Wt(Vi({version:e.version}),u=>Ki(n,u),u=>i.reduce((d,A)=>Yi(A,d),u),u=>"blockhash"in c?yi(c,u):Hi(c,u))}function Jt(){return b(h([["signatures",C(y(k(),64),{size:N()})],["messageBytes",k()]]),Qi)}function Qi(e){let{messageBytes:t,signatures:n}=e,r=Vt([Me(),Mt(p(),2),C(P(),{size:N()})]),[o,a,i]=r.decode(t),s=i.slice(0,a);if(s.length!==n.length)throw new l(ce,{numRequiredSignatures:a,signaturesLength:n.length,signerAddresses:s});let c={};return s.forEach((u,d)=>{let A=n[d];A.every(_=>_===0)?c[u]=null:c[u]=A;}),{messageBytes:t,signatures:Object.freeze(c)}}async function Ue(e,t,n){if(e.length===0)return {};let r=await Ft(t,e,n);return Bt(r),ge(r),r.reduce((o,a)=>({...o,[a.address]:a.data.addresses}),{})}var $="ComputeBudget111111111111111111111111111111";var V="11111111111111111111111111111111";var Y=(e=>(e[e.CreateAccount=0]="CreateAccount",e[e.Assign=1]="Assign",e[e.TransferSol=2]="TransferSol",e[e.CreateAccountWithSeed=3]="CreateAccountWithSeed",e[e.AdvanceNonceAccount=4]="AdvanceNonceAccount",e[e.WithdrawNonceAccount=5]="WithdrawNonceAccount",e[e.InitializeNonceAccount=6]="InitializeNonceAccount",e[e.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",e[e.Allocate=8]="Allocate",e[e.AllocateWithSeed=9]="AllocateWithSeed",e[e.AssignWithSeed=10]="AssignWithSeed",e[e.TransferSolWithSeed=11]="TransferSolWithSeed",e[e.UpgradeNonceAccount=12]="UpgradeNonceAccount",e))(Y||{});function be(e){let t="data"in e?e.data:e;if(R(t,T().encode(0),0))return 0;if(R(t,T().encode(1),0))return 1;if(R(t,T().encode(2),0))return 2;if(R(t,T().encode(3),0))return 3;if(R(t,T().encode(4),0))return 4;if(R(t,T().encode(5),0))return 5;if(R(t,T().encode(6),0))return 6;if(R(t,T().encode(7),0))return 7;if(R(t,T().encode(8),0))return 8;if(R(t,T().encode(9),0))return 9;if(R(t,T().encode(10),0))return 10;if(R(t,T().encode(11),0))return 11;if(R(t,T().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")}var Qt=0,en=1,tn=2,nn=3,rn=4,on=5,an=6,sn=7,cn=8;process.env.NODE_ENV!=="production"&&({[Qt]:"an account with the same address already exists",[on]:"provided address does not match addressed derived from seed",[nn]:"cannot allocate account data of this length",[tn]:"cannot assign account to this program id",[rn]:"length of requested seed is too long",[sn]:"stored nonce is still in recent_blockhashes",[an]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[cn]:"specified nonce does not match stored nonce",[en]:"account does not have enough SOL to perform the operation"});var un="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";function dn(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var ve="Secp256r1SigVerify1111111111111111111111111",_n=new Set([$,V,MULTI_WALLET_PROGRAM_ADDRESS,ve,un]),X="2c1LgZfCun82niPCgfg2cTMZmAiahraTjY4KNb1BSU4Z";function An(){return {[B(X)]:["ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL","11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb","metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s","Sysvar1nstructions1111111111111111111111111","auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg","SysvarS1otHashes111111111111111111111111111","3C6AdJiD9qxMqZTmB53b5HC5Yfq2Bb57XAzYDzu4YDcj","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY","noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV","cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK","GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy","SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7","35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA","compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU","oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto","cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y","bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi","oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg","cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B","bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb","oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ","cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf","bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8","oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq","cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc","bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2","oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P","cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6","amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx","ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg","r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti","cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m","2cLqZJrYMuCzKdSZBoWxZ3tXoeCMmMyDiuy6UBaKnbmK","5tgzUZaVtfnnSEBgmBDtJj6PdgYCnA1uaEGEUi3y5Njg","2yaSthpW4U4VZvBhwPfGA7HwC9v9Rfq3SNRZvJkKcrNe"].map(B)}}var ln=new Map;async function In(e,t){let n=Date.now(),r=ln.get(e);if(r&&n-r.cachedAt<3e5)return r;let o=t?`${t.origin}?origin=${encodeURIComponent(e)}`:`${e}/.well-known/revibase.json`,a=await fetch(o);if(!a.ok)throw new Error(`Failed to fetch .well-known/revibase.json for ${e}`);let i=await a.json();if(!i?.clientJwk)throw new Error(`Invalid .well-known response from ${e}`);let s={...i,cachedAt:n};return ln.set(e,s),s}function F(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}async function Rn(e,t){try{let n=await importJWK(convertBase64StringToJWK(e.jwk)),r=await compactVerify(e.jws,n);if(!F(r.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Device signature verification failed")}}async function Tn(e,t){if(e)try{let n=await importJWK(convertBase64StringToJWK(e.jwk)),r=await compactVerify(e.jws,n);if(!F(r.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Auth provider signature verification failed")}}async function gn(e,t,n){let r=await In(e.clientOrigin,n);try{let o=await importJWK(convertBase64StringToJWK(r.clientJwk)),a=await compactVerify(e.jws,o);if(!F(a.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Client signature verification failed ")}return r}async function fn(e,t){let{authResponse:n,startRequest:r,slotHash:o,slotNumber:a,device:i,client:s,estimatedSlotHashExpiry:c}=e;if(r.data.type!=="transaction")throw new Error("Invalid request type.");let{response:u}=n,d=base64URLStringToBuffer(u.clientDataJSON),A=JSON.parse(Te().decode(d)),{challenge:_}=await createTransactionChallenge(r.data.payload,s.clientOrigin,i.jwk,r.rid,o,a,c),f=base64URLStringToBuffer(A.challenge);if(!F(f,_))throw new Error("Invalid challenge");let x=getSecp256r1MessageHash(n);if(!F(x,t))throw new Error("Invalid message hash")}async function Fe(e,t){let n=sha256(t);return F(e.finalBufferHash,n)}async function m(e,t,n){if(!e)return [];let r=e.find(a=>a.instructionIndex===t-1)?.data;if(!r)return [];let{payload:o}=getSecp256r1VerifyInstructionDataDecoder().decode(r);return Promise.all(n.map(async a=>{let i=o[a.verifyArgs.signedMessageIndex],s=sha256(i.message);return {signer:new Secp256r1Key(i.publicKey),messageHash:s}}))}function xe(e){return e.map(t=>{if(t.memberKey.keyType===KeyType.Secp256r1){if(t.messageHash.__option==="None")throw new Error("Message hash cannot be found.");return {signer:new Secp256r1Key(convertMemberKeyToString(t.memberKey)),messageHash:t.messageHash.value}}else return {signer:B(convertMemberKeyToString(t.memberKey))}})}async function L(e,t,n,r,o){if(!r)throw new Error("Transaction Auth Response is missing");if(n.filter(s=>s.signer instanceof Secp256r1Key).length!==r.length)throw new Error(`Signer count mismatch. Expected ${n.length} auth responses, got ${r.length}`);let a=await getWalletAddressFromSettings(B(t)),i=await Promise.all(n.map(async({signer:s,messageHash:c})=>{if(s instanceof Secp256r1Key){if(!c)throw new Error("Hash not found.");let u=r.find(Dn=>dn(getSecp256r1MessageHash(Dn.authResponse),c));if(!u)throw new Error("Hash mismatch");let{client:d,device:A,startRequest:_,estimatedSlotHashExpiry:f,authProvider:x}=u;if(_.data.type!=="transaction")throw new Error("Invalid request type.");let je=Math.min(f,_.validTill);if(je<Date.now())throw new Error("Request has expired.");if(_.data.sendTx&&!x)throw new Error("Auth provider is missing");let[Nn]=await Promise.all([gn(d,_.data.sendTx?createClientAuthorizationStartRequestChallenge(_):c,o),fn(u,c),Rn(A,c),Tn(x,c)]);return {signer:s,walletAddress:a,client:{origin:d.clientOrigin,...Nn},device:A.jwk,authProvider:x?.jwk,startRequest:_,estimatedValidTill:je}}return {signer:s,walletAddress:a}}));return {instructions:e,signers:i}}async function U(e,t){let n=e?.data?.data;if(!n||n.__option==="None")throw new Error(t);return getSettingsFromIndex(n.value.index)}async function ze(e,t){let n=vaultTransactionMessageDeserialize(t);return (await Ve(n,e)).instructions}function ke(e,t){if(!e)throw new Error("Invalid instruction accounts.");let n=3+(t.addressTableLookups?.length??0),r=e.slice(n);return t.instructions.map(o=>({accounts:[...o.accountIndices].map(a=>r[a]),data:o.data,programAddress:r[o.programAddressIndex].address}))}async function Ve(e,t){let r="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?e.addressTableLookups.map(a=>a.lookupTableAddress):[],o=r.length>0?await ic(r,t):{};return qt(e,{addressesByLookupTableAddress:o})}async function ic(e,t){if(e.some(r=>r.toString()===X)){let r=e.filter(o=>o.toString()!==X);return {...An(),...await Ue(r,t)}}return Ue(e,t)}async function We(e,t,n,r,o){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts");let a=getChangeConfigCompressedInstructionDataDecoder().decode(e.data),i=await U(a.settingsMutArgs,"Invalid instruction data. Settings not found."),s=await m(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),c=3,u=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[c+d.fields[0]].address}));return L([e],i,s.concat(u),r,o)}async function Ge(e,t,n,r,o){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts.");let a=getChangeConfigInstructionDataDecoder().decode(e.data),i=e.accounts[0].address.toString(),s=await m(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),c=5,u=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[c+d.fields[0]].address}));return L([e],i,s.concat(u),r,o)}async function He(e,t,n,r,o,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let s=(e===MultiWalletInstruction.NativeTransferIntentCompressed?getNativeTransferIntentCompressedInstructionDataDecoder():getTokenTransferIntentCompressedInstructionDataDecoder()).decode(t.data),c=await U(s.settingsMutArgs,"Invalid instruction data. Settings not found."),u=await m(n,r,s.signers.filter(_=>_.__kind==="Secp256r1").map(_=>_.fields[0])),d=e===MultiWalletInstruction.NativeTransferIntentCompressed?6:17,A=s.signers.filter(_=>_.__kind==="Ed25519").map(_=>({signer:t.accounts[d+_.fields[0]].address}));return L([t],c,u.concat(A),o,a)}async function Ke(e,t,n,r,o,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let s=(e===MultiWalletInstruction.NativeTransferIntent?getNativeTransferIntentInstructionDataDecoder():getTokenTransferIntentInstructionDataDecoder()).decode(t.data),c=t.accounts[0].address.toString(),u=await m(n,r,s.signers.filter(_=>_.__kind==="Secp256r1").map(_=>_.fields[0])),d=e===MultiWalletInstruction.NativeTransferIntentCompressed?6:18,A=s.signers.filter(_=>_.__kind==="Ed25519").map(_=>({signer:t.accounts[d+_.fields[0]].address}));return L([t],c,u.concat(A),o,a)}function $e(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=getCreateUserAccountsInstructionDataDecoder().decode(e.data);for(let r of n.createUserArgs){if(r.member.toString()!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r.member.toString()}`);if(r.transactionManagerUrl?.__option==="None")throw new Error("Transaction manager URL cannot be empty when creating user accounts");if(r.transactionManagerUrl?.value!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${r.transactionManagerUrl?.value}`)}return null}function Ye(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=getEditTransactionManagerUrlInstructionDataDecoder().decode(e.data),r=convertMemberKeyToString(n.userMutArgs.data.member);if(r!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r}`);if(n.transactionManagerUrl!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${n.transactionManagerUrl}`);return null}async function Xe(e,t,n,r,o,a,i,s,c){if(!t.accounts)throw new Error("Invalid instruction accounts");if(!t.data)throw new Error("Invalid instruction data");Sc(t,r);let u=n===MultiWalletInstruction.TransactionBufferCreate||n===MultiWalletInstruction.TransactionBufferCreateCompressed,d=n===MultiWalletInstruction.TransactionBufferCreateCompressed||n===MultiWalletInstruction.TransactionExecuteSyncCompressed,A;return u?A=await Nc(e,t,d,s):A=await Cc(t,d,i,o),L(A.instructionsToVerify,A.settingsAddress,A.signers,a,c)}function Sc(e,t){let n=e.accounts?.find(r=>r.address.toString()===t.publicKey);if(n&&n.role!==E.READONLY_SIGNER)throw new Error("Transaction Manager should be readonly signer.")}async function Nc(e,t,n,r){if(!r)throw new Error("Missing transaction message bytes");if(!t.data||!t.accounts)throw new Error("Invalid instruction");let o=w().encode(r);return n?Dc(e,t,o):Oc(e,t,o)}async function Dc(e,t,n){let r=getTransactionBufferCreateCompressedInstructionDataDecoder().decode(t.data),o=await U(r.settingsReadonlyArgs,"Settings account is required for compressed transaction buffer create"),a=xe(r.args.expectedSigners);if(!await Fe(r.args,n))throw new Error("Hash mismatch.");let s=await ze(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Oc(e,t,n){let r=getTransactionBufferCreateInstructionDataDecoder().decode(t.data),o=t.accounts[0].address.toString(),a=xe(r.args.expectedSigners);if(!await Fe(r.args,n))throw new Error("Hash mismatch.");let s=await ze(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Cc(e,t,n,r){if(!e.data||!e.accounts)throw new Error("Invalid instruction");return t?mc(e,n,r):pc(e,n,r)}async function mc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=getTransactionExecuteSyncCompressedInstructionDataDecoder().decode(e.data),o=await U(r.settingsMutArgs,"Settings account is required for compressed transaction execute"),a=await m(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),i=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[i+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a.concat(s),instructionsToVerify:c}}async function pc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=getTransactionExecuteSyncInstructionDataDecoder().decode(e.data),o=e.accounts[0].address.toString(),a=await m(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),i=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[i+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a.concat(s),instructionsToVerify:c}}async function Mc(e,t,n,r){let{transaction:o,transactionMessageBytes:a,authResponses:i}=n,{messageBytes:s}=Jt().decode(w().encode(o)),c=Yt().decode(s),{instructions:u}=await Ve(c,e),d=yc(u),A=(await Promise.all(u.map((_,f)=>Uc(e,_,t,f,i,d,a,r)))).filter(_=>_!==null);return {transactionMessage:s,verificationResults:A}}function yc(e){return e.map((t,n)=>({instruction:t,instructionIndex:n})).filter(({instruction:t})=>t.programAddress.toString()===ve).map(({instructionIndex:t,instruction:n})=>({instructionIndex:t,data:n.data}))}async function Uc(e,t,n,r,o,a,i,s){let c=t.programAddress.toString();if(!_n.has(c))throw new Error("Instruction rejected by Transaction Manager.");if(!t.data)throw new Error("Invalid instruction data.");if(c===V.toString()){if(be({data:t.data})!==Y.AdvanceNonceAccount)throw new Error("Instruction rejected by Transaction Manager.");return null}if(c!==MULTI_WALLET_PROGRAM_ADDRESS.toString())return null;let u=identifyMultiWalletInstruction({data:t.data});return bc(e,t,u,n,r,o,a,i,s)}async function bc(e,t,n,r,o,a,i,s,c){switch(n){case MultiWalletInstruction.DecompressSettingsAccount:case MultiWalletInstruction.TransactionBufferClose:case MultiWalletInstruction.TransactionBufferCloseCompressed:return null;case MultiWalletInstruction.ChangeConfig:return Ge(t,i,o,a,c);case MultiWalletInstruction.ChangeConfigCompressed:return We(t,i,o,a,c);case MultiWalletInstruction.CreateUserAccounts:return $e(t,r);case MultiWalletInstruction.EditTransactionManagerUrl:return Ye(t,r);case MultiWalletInstruction.NativeTransferIntent:case MultiWalletInstruction.TokenTransferIntent:return Ke(n,t,i,o,a,c);case MultiWalletInstruction.NativeTransferIntentCompressed:case MultiWalletInstruction.TokenTransferIntentCompressed:return He(n,t,i,o,a,c);case MultiWalletInstruction.TransactionBufferCreate:case MultiWalletInstruction.TransactionBufferCreateCompressed:case MultiWalletInstruction.TransactionExecuteSync:case MultiWalletInstruction.TransactionExecuteSyncCompressed:return Xe(e,t,n,r,o,a,i,s,c);default:throw new Error("Instruction rejected by transaction manager.")}}/*! Bundled license information:
|
|
5
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[sr]:"No signature verification implementation could be found.",[cr]:"No key generation implementation could be found.",[ur]:"No signing implementation could be found.",[dr]:"No key export implementation could be found.",[Un]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[ra]:"Transaction processing left an account with an outstanding borrowed reference",[Wo]:"Account in use",[Go]:"Account loaded twice",[Ho]:"Attempt to debit an account but found no record of a prior credit.",[da]:"Transaction loads an address table account that doesn't exist",[Xo]:"This transaction has already been processed",[jo]:"Blockhash not found",[Zo]:"Loader call chain is too deep",[na]:"Transactions are currently disabled due to cluster maintenance",[Ta]:"Transaction contains a duplicate instruction ($index) that is not allowed",[$o]:"Insufficient funds for fee",[ga]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Yo]:"This account may not be used to pay transaction fees",[Jo]:"Transaction contains an invalid account reference",[Aa]:"Transaction loads an address table account with invalid data",[la]:"Transaction address table lookup uses an invalid index",[_a]:"Transaction loads an address table account with an invalid owner",[Sa]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[ea]:"This program may not be used for executing instructions",[Ia]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[ia]:"Transaction loads a writable account that cannot be written",[fa]:"Transaction exceeded max loaded accounts data size cap",[qo]:"Transaction requires a fee but has no signature present",[Ko]:"Attempt to load a program that does not exist",[Da]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Na]:"ResanitizationNeeded",[ta]:"Transaction failed to sanitize accounts offsets correctly",[Qo]:"Transaction did not pass signature verification",[ua]:"Transaction locked too many accounts",[Oa]:"Sum of account balances before and after transaction do not match",[Vo]:"The transaction failed with the error `$errorName`",[aa]:"Transaction version is unsupported",[ca]:"Transaction would exceed account data limit within the block",[Ra]:"Transaction would exceed total account data limit",[sa]:"Transaction would exceed max account limit within the block",[oa]:"Transaction would exceed max Block Cost Limit",[Ea]:"Transaction would exceed max Vote Cost Limit",[lt]:"Attempted to sign a transaction with an address that is not a signer for it",[Bo]:"Transaction is missing an address at index: $index.",[It]:"Transaction has no expected signers therefore it cannot be encoded",[Et]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ne]:"Transaction does not have a blockhash lifetime",[re]:"Transaction is not a durable nonce transaction",[oe]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[ae]:"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",[se]:"No fee payer set in CompiledTransaction",[ie]:"Could not find program address at index $index",[zo]:"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",[ko]:"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",[Po]:"Transaction is missing a fee payer.",[At]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[xo]:"Transaction first instruction is not advance nonce account instruction.",[Fo]:"Transaction with no instructions cannot be durable nonce transaction.",[ct]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[ut]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[ce]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[_t]:"Transaction is missing signatures for addresses: $addresses.",[dt]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[ue]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Rt]:"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."},D="i",S="t";function ri(e,t={}){let n=ni[e];if(n.length===0)return "";let r;function o(i){if(r[S]===2){let s=n.slice(r[D]+1,i);a.push(s in t?`${t[s]}`:`$${s}`);}else r[S]===1&&a.push(n.slice(r[D],i));}let a=[];return n.split("").forEach((i,s)=>{if(s===0){r={[D]:0,[S]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[S]){case 0:c={[D]:s,[S]:1};break;case 1:i==="\\"?c={[D]:s,[S]:0}:i==="$"&&(c={[D]:s,[S]:2});break;case 2:i==="\\"?c={[D]:s,[S]:0}:i==="$"?c={[D]:s,[S]:2}:i.match(/\w/)||(c={[D]:s,[S]:1});break}c&&(r!==c&&o(s),r=c);}),o(),a.join("")}function oi(e,t={}){if(process.env.NODE_ENV!=="production")return ri(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${ti(t)}'`),`${n}\``}}var l=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([a,i])=>{a==="cause"?r={cause:i.value}:(n===void 0&&(n={}),Object.defineProperty(n,a,i));});let o=oi(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function ai(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var ii=(e,t)=>ai(e.length<=t?e:e.slice(0,t),t);function R(e,t,n){let r=e.length===t.length?e:e.slice(n,n+t.length);return r.length!==t.length?false:t.every((o,a)=>o===r[a])}function ht(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function M(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(ht(t,e));return e.write(t,n,0),n}})}function I(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function O(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function Lt(e,t,n=0){if(t.length-n<=0)throw new l(de,{codecDescription:e})}function z(e,t,n,r=0){let o=n.length-r;if(o<t)throw new l(_e,{bytesLength:o,codecDescription:e,expected:t})}function pt(e,t,n){if(t<0||t>n)throw new l(Ie,{bytesLength:n,codecDescription:e,offset:t})}function Ee(e,t){let n=(i,s)=>{let[c,u]=t.read(i,s),d=Number(c);return s=u,(s>0||i.length>d)&&(i=i.slice(s,s+d)),z("addDecoderSizePrefix",d,i),[e.decode(i),s+d]};if(O(t)&&O(e))return I({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=O(t)?t.fixedSize:t.maxSize??null,o=O(e)?e.fixedSize:e.maxSize??null,a=r!==null&&o!==null?r+o:null;return I({...e,...a!==null?{maxSize:a}:{},read:n})}function y(e,t){return I({fixedSize:t,read:(n,r)=>{z("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),O(e)&&(n=ii(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function si(e,t){return I({...e,read:(n,r)=>{let o=u=>ci(u,n.length),a=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;pt("offsetDecoder",a,n.length);let[i,s]=e.read(n,a),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:a,postOffset:s,preOffset:r,wrapBytes:o}):s;return pt("offsetDecoder",c,n.length),[i,c]}})}function ci(e,t){return t===0?0:(e%t+t)%t}function ui(e,t){if(O(e)){let n=t(e.fixedSize);if(n<0)throw new l(le,{bytesLength:n,codecDescription:"resizeDecoder"});return I({...e,fixedSize:n})}return e}function Mt(e,t){return si(ui(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function b(e,t){return I({...e,read:(n,r)=>{let[o,a]=e.read(n,r);return [t(o,n,r),a]}})}function bt(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new l(W,{alphabet:e,base:e.length,value:n})}var di=e=>M({getSizeFromValue:t=>{let[n,r]=yt(t,e[0]);if(!r)return t.length;let o=Ut(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(bt(e,t),t==="")return r;let[o,a]=yt(t,e[0]);if(!a)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let i=Ut(a,e),s=[];for(;i>0n;)s.unshift(Number(i%256n)),i/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),_i=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=Ai(i,e);return [a+s,t.length]}});function yt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Ut(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function Ai(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",Re=()=>di(vt),wt=()=>_i(vt);var li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=()=>M({getSizeFromValue:e=>Buffer.from(e,"base64").length,write(e,t,n){bt(li,e.replace(/=/g,""));let r=Buffer.from(e,"base64");return t.set(r,n),r.length+n}});var Ii=e=>e.replace(/\u0000/g,"");var Ei=globalThis.TextDecoder;var Te=()=>{let e;return I({read(t,n){let r=(e||=new Ei).decode(t.slice(n));return [Ii(r),t.length]}})};function Ri(e){return !("exists"in e)||"exists"in e&&e.exists}function Bt(e){let t=e.filter(n=>Ri(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new l(te,{addresses:n})}}function Ti(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=w().encode(t.data[0]);return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function gi(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function Pt(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function Ft(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((i,s)=>i&&typeof i=="object"&&"parsed"in i.data?gi(t[s],i):Ti(t[s],i))}function ge(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new l(ee,{addresses:n})}}var fe,Se;function fi(){return fe||(fe=Re()),fe}function Si(){return Se||(Se=wt()),Se}function H(e){if(e.length<32||e.length>44)throw new l(Q,{actualLength:e.length});let r=fi().encode(e).byteLength;if(r!==32)throw new l(J,{actualLength:r})}function B(e){return H(e),e}function P(){return y(Si(),32)}function Ni(e,t,n,r){if(r<t||r>n)throw new l(Ae,{codecDescription:e,max:n,min:t,value:r})}function xt(e){return e?.endian!==1}function Di(e){return M({fixedSize:e.size,write(t,n,r){e.range&&Ni(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,xt(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function zt(e){return I({fixedSize:e.size,read(t,n=0){Lt(e.name,t,n),z(e.name,e.size,t,n);let r=new DataView(Oi(t,n,e.size));return [e.get(r,xt(e.config)),n+e.size]}})}function Oi(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var N=()=>I({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,a=e[t+o],i=127&a;if(n|=i<<o*7,(a&128)===0)break}return [n,t+r]}});var T=(e={})=>Di({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4}),De=(e={})=>zt({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4});var p=()=>zt({get:e=>e.getUint8(0),name:"u8",size:1});function K(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Oe(e){return O(e)?e.fixedSize:null}function Ce(e){return O(e)?e.fixedSize:e.maxSize??null}function C(e,t={}){let n=t.size??De(),r=Oe(e),o=kt(n,r),a=kt(n,Ce(e))??void 0;return I({...o!==null?{fixedSize:o}:{maxSize:a},read:(i,s)=>{let c=[];if(typeof n=="object"&&i.slice(s).length===0)return [c,s];if(n==="remainder"){for(;s<i.length;){let[A,_]=e.read(i,s);s=_,c.push(A);}return [c,s]}let[u,d]=typeof n=="number"?[n,s]:n.read(i,s);s=d;for(let A=0;A<u;A+=1){let[_,f]=e.read(i,s);s=f,c.push(_);}return [c,s]}})}function kt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function k(){return I({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function Vt(e){let t=K(e.map(Oe)),n=K(e.map(Ce))??void 0;return I({...t===null?{maxSize:n}:{fixedSize:t},read:(r,o)=>{let a=[];return e.forEach(i=>{let[s,c]=i.read(r,o);a.push(s),o=c;}),[a,o]}})}function h(e){let t=e.map(([,o])=>o),n=K(t.map(Oe)),r=K(t.map(Ce))??void 0;return I({...n===null?{maxSize:r}:{fixedSize:n},read:(o,a)=>{let i={};return e.forEach(([s,c])=>{let[u,d]=c.read(o,a);a=d,i[s]=u;}),[i,a]}})}function Wt(e,...t){return t.reduce((n,r)=>r(n),e)}var E=(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))(E||{});function Gt(e){return e>=2}function yi(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)})}var Ui=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=bi(i,e);return [a+s,t.length]}});function bi(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var vi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var wi=()=>Ui(vi);var me;function Bi(){if(!me){let e=C(p(),{size:N()});me=h([["lookupTableAddress",P()],["writableIndexes",e],["readonlyIndexes",e]]);}return me}var pe;function he(){return pe||(pe=p()),pe}function Pi(){return h([["numSignerAccounts",he()],["numReadonlySignerAccounts",he()],["numReadonlyNonSignerAccounts",he()]])}var Le;function Fi(){return Le||(Le=b(h([["programAddressIndex",p()],["accountIndices",C(p(),{size:N()})],["data",Ee(k(),N())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:n,...r}=e;return {...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),Le}var xi=0,Ht=128;function Me(){return I({maxSize:1,read:(e,t)=>{let n=e[t];if((n&Ht)===0)return ["legacy",t];{let r=n^Ht;if(r>xi)throw new l(ue,{unsupportedVersion:r});return [r,t+1]}}})}function zi(){return [["version",Me()],["header",Pi()],["staticAccounts",C(P(),{size:N()})],["lifetimeToken",y(wi(),32)],["instructions",C(Fi(),{size:N()})],["addressTableLookups",ki()]]}function ki(){return C(Bi(),{size:N()})}function Yt(){return b(h(zi()),({addressTableLookups:e,...t})=>t.version==="legacy"||!e?.length?t:{...t,addressTableLookups:e})}function Vi(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var Xt="SysvarRecentB1ockHashes11111111111111111111",jt="11111111111111111111111111111111";function Kt(e,t){return {accounts:[{address:e,role:E.WRITABLE},{address:Xt,role:E.READONLY},{address:t,role:E.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:jt}}function ye(e){return e.programAddress===jt&&e.data!=null&&Wi(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===E.WRITABLE&&e.accounts[1].address===Xt&&e.accounts[1].role===E.READONLY&&e.accounts[2].address!=null&&Gt(e.accounts[2].role)}function Wi(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Zt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&ye(e.instructions[0])}function Gi(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}function Hi({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o,a=r.instructions[0];if(a&&ye(a))if(Gi(a,t,n)){if(Zt(r)&&r.lifetimeConstraint.nonce===e)return r;o=[a,...r.instructions.slice(1)];}else o=[Object.freeze(Kt(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Kt(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}function Ki(e,t){if("feePayer"in t&&e===t.feePayer?.address&&$i(t.feePayer))return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function $i(e){return !!e&&"address"in e&&typeof e.address=="string"&&Object.keys(e).length===1}function Yi(e,t){return Xi([e],t)}function Xi(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function ji(e){let{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[],a=0;for(let i=0;i<n;i++)o.push({address:e.staticAccounts[a],role:E.WRITABLE_SIGNER}),a++;for(let i=0;i<t.numReadonlySignerAccounts;i++)o.push({address:e.staticAccounts[a],role:E.READONLY_SIGNER}),a++;for(let i=0;i<r;i++)o.push({address:e.staticAccounts[a],role:E.WRITABLE}),a++;for(let i=0;i<t.numReadonlyNonSignerAccounts;i++)o.push({address:e.staticAccounts[a],role:E.READONLY}),a++;return o}function Zi(e,t){let r=e.map(i=>i.lookupTableAddress).filter(i=>t[i]===void 0);if(r.length>0)throw new l(oe,{lookupTableAddresses:r});let o=[],a=[];for(let i of e){let s=t[i.lookupTableAddress],c=i.readonlyIndexes,u=i.writableIndexes,d=Math.max(...c,...u);if(d>=s.length)throw new l(ae,{highestKnownIndex:s.length-1,highestRequestedIndex:d,lookupTableAddress:i.lookupTableAddress});let A=c.map(f=>({address:s[f],addressIndex:f,lookupTableAddress:i.lookupTableAddress,role:E.READONLY}));o.push(...A);let _=u.map(f=>({address:s[f],addressIndex:f,lookupTableAddress:i.lookupTableAddress,role:E.WRITABLE}));a.push(..._);}return [...a,...o]}function qi(e,t){let n=t[e.programAddressIndex]?.address;if(!n)throw new l(ie,{index:e.programAddressIndex});let r=e.accountIndices?.map(a=>t[a]),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}function Ji(e,t,n){if(!t||!ye(t))return {blockhash:e,lastValidBlockHeight:n??2n**64n-1n};{let r=t.accounts[0].address;H(r);let o=t.accounts[2].address;return H(o),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:o}}}function qt(e,t){let n=e.staticAccounts[0];if(!n)throw new l(se);let r=ji(e),o="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?Zi(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[],a=[...r,...o],i=e.instructions.map(u=>qi(u,a)),s=i[0],c=Ji(e.lifetimeToken,s,t?.lastValidBlockHeight);return Wt(Vi({version:e.version}),u=>Ki(n,u),u=>i.reduce((d,A)=>Yi(A,d),u),u=>"blockhash"in c?yi(c,u):Hi(c,u))}function Jt(){return b(h([["signatures",C(y(k(),64),{size:N()})],["messageBytes",k()]]),Qi)}function Qi(e){let{messageBytes:t,signatures:n}=e,r=Vt([Me(),Mt(p(),2),C(P(),{size:N()})]),[o,a,i]=r.decode(t),s=i.slice(0,a);if(s.length!==n.length)throw new l(ce,{numRequiredSignatures:a,signaturesLength:n.length,signerAddresses:s});let c={};return s.forEach((u,d)=>{let A=n[d];A.every(_=>_===0)?c[u]=null:c[u]=A;}),{messageBytes:t,signatures:Object.freeze(c)}}async function Ue(e,t,n){if(e.length===0)return {};let r=await Ft(t,e,n);return Bt(r),ge(r),r.reduce((o,a)=>({...o,[a.address]:a.data.addresses}),{})}var $="ComputeBudget111111111111111111111111111111";var V="11111111111111111111111111111111";var Y=(e=>(e[e.CreateAccount=0]="CreateAccount",e[e.Assign=1]="Assign",e[e.TransferSol=2]="TransferSol",e[e.CreateAccountWithSeed=3]="CreateAccountWithSeed",e[e.AdvanceNonceAccount=4]="AdvanceNonceAccount",e[e.WithdrawNonceAccount=5]="WithdrawNonceAccount",e[e.InitializeNonceAccount=6]="InitializeNonceAccount",e[e.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",e[e.Allocate=8]="Allocate",e[e.AllocateWithSeed=9]="AllocateWithSeed",e[e.AssignWithSeed=10]="AssignWithSeed",e[e.TransferSolWithSeed=11]="TransferSolWithSeed",e[e.UpgradeNonceAccount=12]="UpgradeNonceAccount",e))(Y||{});function be(e){let t="data"in e?e.data:e;if(R(t,T().encode(0),0))return 0;if(R(t,T().encode(1),0))return 1;if(R(t,T().encode(2),0))return 2;if(R(t,T().encode(3),0))return 3;if(R(t,T().encode(4),0))return 4;if(R(t,T().encode(5),0))return 5;if(R(t,T().encode(6),0))return 6;if(R(t,T().encode(7),0))return 7;if(R(t,T().encode(8),0))return 8;if(R(t,T().encode(9),0))return 9;if(R(t,T().encode(10),0))return 10;if(R(t,T().encode(11),0))return 11;if(R(t,T().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")}var Qt=0,en=1,tn=2,nn=3,rn=4,on=5,an=6,sn=7,cn=8;process.env.NODE_ENV!=="production"&&({[Qt]:"an account with the same address already exists",[on]:"provided address does not match addressed derived from seed",[nn]:"cannot allocate account data of this length",[tn]:"cannot assign account to this program id",[rn]:"length of requested seed is too long",[sn]:"stored nonce is still in recent_blockhashes",[an]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[cn]:"specified nonce does not match stored nonce",[en]:"account does not have enough SOL to perform the operation"});var un="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";function dn(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var ve="Secp256r1SigVerify1111111111111111111111111",_n=new Set([$,V,MULTI_WALLET_PROGRAM_ADDRESS,ve,un]),X="2c1LgZfCun82niPCgfg2cTMZmAiahraTjY4KNb1BSU4Z";function An(){return {[B(X)]:["ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL","11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb","metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s","Sysvar1nstructions1111111111111111111111111","auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg","SysvarS1otHashes111111111111111111111111111","3C6AdJiD9qxMqZTmB53b5HC5Yfq2Bb57XAzYDzu4YDcj","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY","noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV","cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK","GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy","SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7","35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA","compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU","oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto","cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y","bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi","oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg","cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B","bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb","oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ","cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf","bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8","oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq","cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc","bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2","oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P","cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6","amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx","ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg","r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti","cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m","2cLqZJrYMuCzKdSZBoWxZ3tXoeCMmMyDiuy6UBaKnbmK","5tgzUZaVtfnnSEBgmBDtJj6PdgYCnA1uaEGEUi3y5Njg","2yaSthpW4U4VZvBhwPfGA7HwC9v9Rfq3SNRZvJkKcrNe"].map(B)}}var ln=new Map;async function In(e,t){let n=Date.now(),r=ln.get(e);if(r&&n-r.cachedAt<3e5)return r;let o=t?`${t.origin}?origin=${encodeURIComponent(e)}`:`${e}/.well-known/revibase.json`,a=await fetch(o);if(!a.ok)throw new Error(`Failed to fetch .well-known/revibase.json for ${e}`);let i=await a.json();if(!i?.clientJwk)throw new Error(`Invalid .well-known response from ${e}`);let s={...i,cachedAt:n};return ln.set(e,s),s}function F(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}async function Rn(e,t){try{let n=await importJWK(convertBase64StringToJWK(e.jwk)),r=await compactVerify(e.jws,n);if(!F(r.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Device signature verification failed")}}async function Tn(e,t){if(e)try{let n=await importJWK(convertBase64StringToJWK(e.jwk)),r=await compactVerify(e.jws,n);if(!F(r.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Auth provider signature verification failed")}}async function gn(e,t,n){let r=await In(e.clientOrigin,n);try{let o=await importJWK(convertBase64StringToJWK(r.clientJwk)),a=await compactVerify(e.jws,o);if(!F(a.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Client signature verification failed ")}return r}async function fn(e,t){let{authResponse:n,startRequest:r,slotHash:o,slotNumber:a,device:i,client:s,estimatedSlotHashExpiry:c}=e;if(r.data.type!=="transaction")throw new Error("Invalid request type.");let{response:u}=n,d=base64URLStringToBuffer(u.clientDataJSON),A=JSON.parse(Te().decode(d)),{challenge:_}=await createTransactionChallenge(r.data.payload,s.clientOrigin,i.jwk,r.rid,o,a,c),f=base64URLStringToBuffer(A.challenge);if(!F(f,_))throw new Error("Invalid challenge");let x=getSecp256r1MessageHash(n);if(!F(x,t))throw new Error("Invalid message hash")}async function Fe(e,t){let n=sha256(t);return F(e.finalBufferHash,n)}async function m(e,t,n){if(!e)return [];let r=e.find(a=>a.instructionIndex===t-1)?.data;if(!r)return [];let{payload:o}=getSecp256r1VerifyInstructionDataDecoder().decode(r);return Promise.all(n.map(async a=>{let i=o[a.verifyArgs.signedMessageIndex],s=sha256(i.message);return {signer:new Secp256r1Key(i.publicKey),messageHash:s}}))}function xe(e){return e.map(t=>{if(t.memberKey.keyType===KeyType.Secp256r1){if(t.messageHash.__option==="None")throw new Error("Message hash cannot be found.");return {signer:new Secp256r1Key(convertMemberKeyToString(t.memberKey)),messageHash:t.messageHash.value}}else return {signer:B(convertMemberKeyToString(t.memberKey))}})}async function L(e,t,n,r,o){if(!r)throw new Error("Transaction Auth Response is missing");if(n.filter(s=>s.signer instanceof Secp256r1Key).length!==r.length)throw new Error(`Signer count mismatch. Expected ${n.length} auth responses, got ${r.length}`);let a=await getWalletAddressFromSettings(B(t)),i=await Promise.all(n.map(async({signer:s,messageHash:c})=>{if(s instanceof Secp256r1Key){if(!c)throw new Error("Hash not found.");let u=r.find(Dn=>dn(getSecp256r1MessageHash(Dn.authResponse),c));if(!u)throw new Error("Hash mismatch");let{client:d,device:A,startRequest:_,estimatedSlotHashExpiry:f,authProvider:x}=u;if(_.data.type!=="transaction")throw new Error("Invalid request type.");let je=Math.min(f,_.validTill);if(je<Date.now())throw new Error("Request has expired.");if(_.data.sendTx&&!x)throw new Error("Auth provider is missing");let[Nn]=await Promise.all([gn(d,_.data.sendTx?createClientAuthorizationStartRequestChallenge(_):c,o),fn(u,c),Rn(A,c),Tn(x,c)]);return {signer:s,walletAddress:a,client:{origin:d.clientOrigin,...Nn},device:A.jwk,authProvider:x?.jwk,startRequest:_,estimatedValidTill:je}}return {signer:s,walletAddress:a}}));return {instructions:e,signers:i}}async function U(e,t){let n=e?.data?.data;if(!n||n.__option==="None")throw new Error(t);return getSettingsFromIndex(n.value.index)}async function ze(e,t){let n=vaultTransactionMessageDeserialize(t);return (await Ve(n,e)).instructions}function ke(e,t){if(!e)throw new Error("Invalid instruction accounts.");let n=3+(t.addressTableLookups?.length??0),r=e.slice(n);return t.instructions.map(o=>({accounts:[...o.accountIndices].map(a=>r[a]),data:o.data,programAddress:r[o.programAddressIndex].address}))}async function Ve(e,t){let r="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?e.addressTableLookups.map(a=>a.lookupTableAddress):[],o=r.length>0?await ic(r,t):{};return qt(e,{addressesByLookupTableAddress:o})}async function ic(e,t){if(e.some(r=>r.toString()===X)){let r=e.filter(o=>o.toString()!==X);return {...An(),...await Ue(r,t)}}return Ue(e,t)}async function We(e,t,n,r,o){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts");let a=getChangeConfigCompressedInstructionDataDecoder().decode(e.data),i=await U(a.settingsMutArgs,"Invalid instruction data. Settings not found."),s=await m(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),c=3,u=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[c+d.fields[0]].address}));return L([e],i,s.concat(u),r,o)}async function Ge(e,t,n,r,o){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts.");let a=getChangeConfigInstructionDataDecoder().decode(e.data),i=e.accounts[0].address.toString(),s=await m(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),c=5,u=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[c+d.fields[0]].address}));return L([e],i,s.concat(u),r,o)}async function He(e,t,n,r,o,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let s=(e===MultiWalletInstruction.NativeTransferIntentCompressed?getNativeTransferIntentCompressedInstructionDataDecoder():getTokenTransferIntentCompressedInstructionDataDecoder()).decode(t.data),c=await U(s.settingsMutArgs,"Invalid instruction data. Settings not found."),u=await m(n,r,s.signers.filter(_=>_.__kind==="Secp256r1").map(_=>_.fields[0])),d=e===MultiWalletInstruction.NativeTransferIntentCompressed?6:17,A=s.signers.filter(_=>_.__kind==="Ed25519").map(_=>({signer:t.accounts[d+_.fields[0]].address}));return L([t],c,u.concat(A),o,a)}async function Ke(e,t,n,r,o,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let s=(e===MultiWalletInstruction.NativeTransferIntent?getNativeTransferIntentInstructionDataDecoder():getTokenTransferIntentInstructionDataDecoder()).decode(t.data),c=t.accounts[0].address.toString(),u=await m(n,r,s.signers.filter(_=>_.__kind==="Secp256r1").map(_=>_.fields[0])),d=e===MultiWalletInstruction.NativeTransferIntent?6:18,A=s.signers.filter(_=>_.__kind==="Ed25519").map(_=>({signer:t.accounts[d+_.fields[0]].address}));return L([t],c,u.concat(A),o,a)}function $e(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=getCreateUserAccountsInstructionDataDecoder().decode(e.data);for(let r of n.createUserArgs){if(r.member.toString()!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r.member.toString()}`);if(r.transactionManagerUrl?.__option==="None")throw new Error("Transaction manager URL cannot be empty when creating user accounts");if(r.transactionManagerUrl?.value!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${r.transactionManagerUrl?.value}`)}return null}function Ye(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=getEditTransactionManagerUrlInstructionDataDecoder().decode(e.data),r=convertMemberKeyToString(n.userMutArgs.data.member);if(r!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r}`);if(n.transactionManagerUrl!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${n.transactionManagerUrl}`);return null}async function Xe(e,t,n,r,o,a,i,s,c){if(!t.accounts)throw new Error("Invalid instruction accounts");if(!t.data)throw new Error("Invalid instruction data");Sc(t,r);let u=n===MultiWalletInstruction.TransactionBufferCreate||n===MultiWalletInstruction.TransactionBufferCreateCompressed,d=n===MultiWalletInstruction.TransactionBufferCreateCompressed||n===MultiWalletInstruction.TransactionExecuteSyncCompressed,A;return u?A=await Nc(e,t,d,s):A=await Cc(t,d,i,o),L(A.instructionsToVerify,A.settingsAddress,A.signers,a,c)}function Sc(e,t){let n=e.accounts?.find(r=>r.address.toString()===t.publicKey);if(n&&n.role!==E.READONLY_SIGNER)throw new Error("Transaction Manager should be readonly signer.")}async function Nc(e,t,n,r){if(!r)throw new Error("Missing transaction message bytes");if(!t.data||!t.accounts)throw new Error("Invalid instruction");let o=w().encode(r);return n?Dc(e,t,o):Oc(e,t,o)}async function Dc(e,t,n){let r=getTransactionBufferCreateCompressedInstructionDataDecoder().decode(t.data),o=await U(r.settingsReadonlyArgs,"Settings account is required for compressed transaction buffer create"),a=xe(r.args.expectedSigners);if(!await Fe(r.args,n))throw new Error("Hash mismatch.");let s=await ze(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Oc(e,t,n){let r=getTransactionBufferCreateInstructionDataDecoder().decode(t.data),o=t.accounts[0].address.toString(),a=xe(r.args.expectedSigners);if(!await Fe(r.args,n))throw new Error("Hash mismatch.");let s=await ze(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Cc(e,t,n,r){if(!e.data||!e.accounts)throw new Error("Invalid instruction");return t?mc(e,n,r):pc(e,n,r)}async function mc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=getTransactionExecuteSyncCompressedInstructionDataDecoder().decode(e.data),o=await U(r.settingsMutArgs,"Settings account is required for compressed transaction execute"),a=await m(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),i=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[i+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a.concat(s),instructionsToVerify:c}}async function pc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=getTransactionExecuteSyncInstructionDataDecoder().decode(e.data),o=e.accounts[0].address.toString(),a=await m(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),i=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[i+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a.concat(s),instructionsToVerify:c}}async function Mc(e,t,n,r){let{transaction:o,transactionMessageBytes:a,authResponses:i}=n,{messageBytes:s}=Jt().decode(w().encode(o)),c=Yt().decode(s),{instructions:u}=await Ve(c,e),d=yc(u),A=(await Promise.all(u.map((_,f)=>Uc(e,_,t,f,i,d,a,r)))).filter(_=>_!==null);return {transactionMessage:s,verificationResults:A}}function yc(e){return e.map((t,n)=>({instruction:t,instructionIndex:n})).filter(({instruction:t})=>t.programAddress.toString()===ve).map(({instructionIndex:t,instruction:n})=>({instructionIndex:t,data:n.data}))}async function Uc(e,t,n,r,o,a,i,s){let c=t.programAddress.toString();if(!_n.has(c))throw new Error("Instruction rejected by Transaction Manager.");if(!t.data)throw new Error("Invalid instruction data.");if(c===V.toString()){if(be({data:t.data})!==Y.AdvanceNonceAccount)throw new Error("Instruction rejected by Transaction Manager.");return null}if(c!==MULTI_WALLET_PROGRAM_ADDRESS.toString())return null;let u=identifyMultiWalletInstruction({data:t.data});return bc(e,t,u,n,r,o,a,i,s)}async function bc(e,t,n,r,o,a,i,s,c){switch(n){case MultiWalletInstruction.DecompressSettingsAccount:case MultiWalletInstruction.TransactionBufferClose:case MultiWalletInstruction.TransactionBufferCloseCompressed:return null;case MultiWalletInstruction.ChangeConfig:return Ge(t,i,o,a,c);case MultiWalletInstruction.ChangeConfigCompressed:return We(t,i,o,a,c);case MultiWalletInstruction.CreateUserAccounts:return $e(t,r);case MultiWalletInstruction.EditTransactionManagerUrl:return Ye(t,r);case MultiWalletInstruction.NativeTransferIntent:case MultiWalletInstruction.TokenTransferIntent:return Ke(n,t,i,o,a,c);case MultiWalletInstruction.NativeTransferIntentCompressed:case MultiWalletInstruction.TokenTransferIntentCompressed:return He(n,t,i,o,a,c);case MultiWalletInstruction.TransactionBufferCreate:case MultiWalletInstruction.TransactionBufferCreateCompressed:case MultiWalletInstruction.TransactionExecuteSync:case MultiWalletInstruction.TransactionExecuteSyncCompressed:return Xe(e,t,n,r,o,a,i,s,c);default:throw new Error("Instruction rejected by transaction manager.")}}/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
@noble/curves/utils.js:
|
|
8
8
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|