@revibase/lite 0.0.13 → 0.0.15
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -44
- package/dist/index.d.ts +91 -44
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';var core=require('@revibase/core'),server=require('@simplewebauthn/server');async function Kc(e){e.openBlankPopUp();let t=window.origin,n={phase:"start",data:{type:"message"},redirectOrigin:t},{signature:r,message:o,id:s}=await e.onClientAuthorizationCallback(n),i=await e.sendPayloadToProvider({payload:{...n,data:{...n.data,payload:o}},signature:r});return await e.onClientAuthorizationCallback({...i,data:{...i.data,payload:{...i.data.payload,id:s,message:o}}})}var Hn=1,Kn=2,Yn=3,$n=4,Xn=5,jn=6,Zn=7,qn=8,Jn=9,Qn=10,er=-32700,tr=-32603,nr=-32602,rr=-32601,or=-32600,ir=-32019,ar=-32018,sr=-32017,cr=-32016,dr=-32015,ur=-32014,Ir=-32013,_r=-32012,Ar=-32011,lr=-32010,Er=-32009,Rr=-32008,Tr=-32007,gr=-32006,Dr=-32005,Sr=-32004,Nr=-32003,fr=-32002,Cr=-32001,Ee=28e5,Re=2800001,Or=2800002,Je=2800003,Qe=2800004,et=2800005,tt=2800006,nt=2800007,rt=2800008,ot=2800009,it=2800010,at=2800011,mr=323e4,pr=32300001,hr=3230002,Mr=3230003,yr=3230004,Lr=361e4,Ur=3610001,br=3610002,Pr=3610003,Fr=3610004,Br=3610005,vr=3610006,wr=3610007,zr=3611e3,kr=3704e3,xr=3704001,Wr=3704002,Gr=3704003,Vr=3704004,Hr=4128e3,Kr=4128001,Yr=4128002,$r=4615e3,Xr=4615001,jr=4615002,Zr=4615003,qr=4615004,Jr=4615005,Qr=4615006,eo=4615007,to=4615008,no=4615009,ro=4615010,oo=4615011,io=4615012,ao=4615013,so=4615014,co=4615015,uo=4615016,Io=4615017,_o=4615018,Ao=4615019,lo=4615020,Eo=4615021,Ro=4615022,To=4615023,go=4615024,Do=4615025,So=4615026,No=4615027,fo=4615028,Co=4615029,Oo=4615030,mo=4615031,po=4615032,ho=4615033,Mo=4615034,yo=4615035,Lo=4615036,Uo=4615037,bo=4615038,Po=4615039,Fo=4615040,Bo=4615041,vo=4615042,wo=4615043,zo=4615044,ko=4615045,xo=4615046,Wo=4615047,Go=4615048,Vo=4615049,Ho=4615050,Ko=4615051,Yo=4615052,$o=4615053,Xo=4615054,jo=5508e3,Zo=5508001,qo=5508002,Jo=5508003,Qo=5508004,ei=5508005,ti=5508006,ni=5508007,ri=5508008,oi=5508009,ii=5508010,ai=5508011,Te=5663e3,ee=5663001,ge=5663002,De=5663003,Se=5663004,st=5663005,ct=5663006,dt=5663007,ut=5663008,It=5663009,si=5663010,ci=5663011,_t=5663012,di=5663013,ui=5663014,At=5663015,Ne=5663016,lt=5663017,Et=5663018,Rt=5663019,Tt=5663020,fe=5663021,gt=5663022,Ii=705e4,_i=7050001,Ai=7050002,li=7050003,Ei=7050004,Ri=7050005,Ti=7050006,gi=7050007,Di=7050008,Si=7050009,Ni=7050010,fi=7050011,Ci=7050012,Oi=7050013,mi=7050014,pi=7050015,hi=7050016,Mi=7050017,yi=7050018,Li=7050019,Ui=7050020,bi=7050021,Pi=7050022,Fi=7050023,Bi=7050024,vi=7050025,wi=7050026,zi=7050027,ki=7050028,xi=7050029,Wi=7050030,Gi=7050031,Vi=7050032,Hi=7050033,Ki=7050034,Yi=7050035,$i=7050036,Xi=7618e3,ji=7618001,Zi=7618002,qi=7618003,Ce=8078e3,Oe=8078001,Dt=8078002,St=8078003,Nt=8078004,ft=8078005,Ct=8078006,me=8078007,Ot=8078008,mt=8078009,pt=8078010,pe=8078011,Z=8078012,ht=8078013,Mt=8078014,yt=8078015,Lt=8078016,he=8078017,Ut=8078018,Ji=8078019,bt=8078020,Pt=8078021,Ft=8078022,Bt=8078023,Qi=81e5,ea=8100001,ta=8100002,na=8100003,ra=819e4,oa=8190001,ia=8190002,aa=8190003,sa=8190004,ca=99e5,da=9900001,ua=9900002,Ia=9900003,_a=9900004,Aa=9900005,la=9900006;function vt(e){return Array.isArray(e)?"%5B"+e.map(vt).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function Ea([e,t]){return `${e}=${vt(t)}`}function Ra(e){let t=Object.entries(e).map(Ea).join("&");return Buffer.from(t,"utf8").toString("base64")}var Ta={[mr]:"Account not found at address: $address",[yr]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[Mr]:"Expected decoded account at address: $address",[hr]:"Failed to decode account data at address: $address",[pr]:"Accounts not found at addresses: $addresses",[ot]:"Unable to find a viable program address bump seed.",[Or]:"$putativeAddress is not a base58-encoded address.",[Ee]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[Je]:"The `CryptoKey` must be an `Ed25519` public key.",[at]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[rt]:"Invalid seeds; point must fall off the Ed25519 curve.",[Qe]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[tt]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[nt]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[et]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[it]:"Program address cannot end with PDA marker.",[Re]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[$n]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[Hn]:"The network has progressed past the last block for which this transaction could have been committed.",[Ce]:"Codec [$codecDescription] cannot decode empty byte arrays.",[Ft]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[bt]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[ft]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[Ct]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[Nt]:"Encoder and decoder must either both be fixed-size or variable-size.",[Ot]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[Dt]:"Expected a fixed-size codec, got a variable-size one.",[ht]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[St]:"Expected a variable-size codec, got a fixed-size one.",[Ji]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[Oe]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[Ut]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[mt]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[pt]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[yt]:"Invalid literal union variant. Expected one of [$variants], got $value.",[me]:"Expected [$codecDescription] to have $expected items, got $actual.",[Z]:"Invalid value $value for base $base with alphabet $alphabet.",[Lt]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[pe]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[Mt]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[Pt]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[he]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[Bt]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[zr]:"No random values implementation could be found.",[no]:"instruction requires an uninitialized account",[To]:"instruction tries to borrow reference for an account which is already borrowed",[go]:"instruction left account with an outstanding borrowed reference",[Eo]:"program other than the account's owner changed the size of the account data",[Jr]:"account data too small for instruction",[Ro]:"instruction expected an executable account",[xo]:"An account does not have enough lamports to be rent-exempt",[Go]:"Program arithmetic overflowed",[ko]:"Failed to serialize or deserialize account data: $encodedData",[Xo]:"Builtin programs must consume compute units",[po]:"Cross-program invocation call depth too deep",[bo]:"Computational budget exceeded",[So]:"custom program error: #$code",[Io]:"instruction contains duplicate accounts",[Do]:"instruction modifications of multiply-passed account differ",[Oo]:"executable accounts must be rent exempt",[fo]:"instruction changed executable accounts data",[Co]:"instruction changed the balance of an executable account",[_o]:"instruction changed executable bit of an account",[so]:"instruction modified data of an account it does not own",[ao]:"instruction spent from the balance of an account it does not own",[Xr]:"generic instruction error",[Ho]:"Provided owner is not allowed",[wo]:"Account is immutable",[zo]:"Incorrect authority provided",[eo]:"incorrect program id for instruction",[Qr]:"insufficient funds for instruction",[qr]:"invalid account data for instruction",[Wo]:"Invalid account owner",[jr]:"invalid program argument",[No]:"program returned invalid error code",[Zr]:"invalid instruction data",[Uo]:"Failed to reallocate account data",[Lo]:"Provided seeds do not result in a valid address",[Ko]:"Accounts data allocations exceeded the maximum allowed per transaction",[Yo]:"Max accounts exceeded",[$o]:"Max instruction trace length exceeded",[yo]:"Length of the seed is too long for address generation",[ho]:"An account required by the instruction is missing",[to]:"missing required signature for instruction",[io]:"instruction illegally modified the program id of an account",[lo]:"insufficient account keys for instruction",[Po]:"Cross-program invocation with unauthorized signer or writable account",[Fo]:"Failed to create program execution environment",[vo]:"Program failed to compile",[Bo]:"Program failed to complete",[uo]:"instruction modified data of a read-only account",[co]:"instruction changed the balance of a read-only account",[Mo]:"Cross-program invocation reentrancy not allowed for this instruction",[Ao]:"instruction modified rent epoch of an account",[oo]:"sum of account balances before and after instruction do not match",[ro]:"instruction requires an initialized account",[$r]:"",[mo]:"Unsupported program id",[Vo]:"Unsupported sysvar",[Aa]:"Invalid instruction plan kind: $kind.",[Zi]:"The provided instruction plan is empty.",[qi]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[Xi]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[la]:"Invalid transaction plan kind: $kind.",[ji]:"No more instructions to pack; the message packer has completed the instruction plan.",[Hr]:"The instruction does not have any accounts.",[Kr]:"The instruction does not have any data.",[Yr]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[Xn]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[Kn]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[ua]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[_a]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[da]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[ca]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Ia]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[tr]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[nr]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[or]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[rr]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[er]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[_r]:"$__serverMessage",[Cr]:"$__serverMessage",[Sr]:"$__serverMessage",[ur]:"$__serverMessage",[sr]:"Epoch rewards period still active at slot $slot",[lr]:"$__serverMessage",[Er]:"$__serverMessage",[ir]:"Failed to query long-term storage; please try again",[cr]:"Minimum context slot has not been reached",[Dr]:"Node is unhealthy; behind by $numSlotsBehind slots",[Rr]:"No snapshot",[fr]:"Transaction simulation failed",[ar]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[Tr]:"$__serverMessage",[Ar]:"Transaction history is not available from this node",[gr]:"$__serverMessage",[Ir]:"Transaction signature length mismatch",[Nr]:"Transaction signature verification failure",[dr]:"$__serverMessage",[kr]:"Key pair bytes must be of length 64, got $byteLength.",[xr]:"Expected private key bytes with length 32. Actual length: $actualLength.",[Wr]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Vr]:"The provided private key does not match the provided public key.",[Gr]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[jn]:"Lamports value must be in the range [0, 2e64-1]",[Zn]:"`$value` cannot be parsed as a `BigInt`",[Qn]:"$message",[qn]:"`$value` cannot be parsed as a `Number`",[Yn]:"No nonce account could be found at address `$nonceAccountAddress`",[ra]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[ia]:"WebSocket was closed before payload could be added to the send buffer",[aa]:"WebSocket connection closed",[sa]:"WebSocket failed to connect",[oa]:"Failed to obtain a subscription id from the server",[na]:"Could not find an API plan for RPC method: `$method`",[Qi]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[ta]:"HTTP error ($statusCode): $message",[ea]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[jo]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[Zo]:"The provided value does not implement the `KeyPairSigner` interface",[Jo]:"The provided value does not implement the `MessageModifyingSigner` interface",[Qo]:"The provided value does not implement the `MessagePartialSigner` interface",[qo]:"The provided value does not implement any of the `MessageSigner` interfaces",[ti]:"The provided value does not implement the `TransactionModifyingSigner` interface",[ni]:"The provided value does not implement the `TransactionPartialSigner` interface",[ri]:"The provided value does not implement the `TransactionSendingSigner` interface",[ei]:"The provided value does not implement any of the `TransactionSigner` interfaces",[oi]:"More than one `TransactionSendingSigner` was identified.",[ii]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[ai]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[wr]:"Cannot export a non-extractable key.",[Ur]:"No digest implementation could be found.",[Lr]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[br]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
1
|
+
'use strict';var core=require('@revibase/core'),_=require('zod'),server=require('@simplewebauthn/server');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ___default=/*#__PURE__*/_interopDefault(_);async function Hc(e){e.openBlankPopUp();let t=window.origin,n={phase:"start",data:{type:"message"},redirectOrigin:t},{rid:r}=await e.onClientAuthorizationCallback(n);return await e.sendPayloadToProvider({rid:r}),await e.onClientAuthorizationCallback({phase:"complete",data:{type:"message",rid:r}})}var Gn=1,Vn=2,Hn=3,Kn=4,$n=5,Yn=6,qn=7,jn=8,Xn=9,Zn=10,Jn=-32700,Qn=-32603,er=-32602,tr=-32601,nr=-32600,rr=-32019,ir=-32018,or=-32017,ar=-32016,sr=-32015,cr=-32014,dr=-32013,ur=-32012,Ir=-32011,_r=-32010,Ar=-32009,lr=-32008,Er=-32007,Rr=-32006,Tr=-32005,gr=-32004,Dr=-32003,Sr=-32002,fr=-32001,oe=28e5,ae=2800001,Nr=2800002,Ye=2800003,qe=2800004,je=2800005,Xe=2800006,Ze=2800007,Je=2800008,Qe=2800009,et=2800010,tt=2800011,Cr=323e4,Or=32300001,mr=3230002,pr=3230003,hr=3230004,Mr=361e4,yr=3610001,Lr=3610002,Ur=3610003,br=3610004,Pr=3610005,Br=3610006,Fr=3610007,vr=3611e3,wr=3704e3,zr=3704001,kr=3704002,xr=3704003,Wr=3704004,Gr=4128e3,Vr=4128001,Hr=4128002,Kr=4615e3,$r=4615001,Yr=4615002,qr=4615003,jr=4615004,Xr=4615005,Zr=4615006,Jr=4615007,Qr=4615008,ei=4615009,ti=4615010,ni=4615011,ri=4615012,ii=4615013,oi=4615014,ai=4615015,si=4615016,ci=4615017,di=4615018,ui=4615019,Ii=4615020,_i=4615021,Ai=4615022,li=4615023,Ei=4615024,Ri=4615025,Ti=4615026,gi=4615027,Di=4615028,Si=4615029,fi=4615030,Ni=4615031,Ci=4615032,Oi=4615033,mi=4615034,pi=4615035,hi=4615036,Mi=4615037,yi=4615038,Li=4615039,Ui=4615040,bi=4615041,Pi=4615042,Bi=4615043,Fi=4615044,vi=4615045,wi=4615046,zi=4615047,ki=4615048,xi=4615049,Wi=4615050,Gi=4615051,Vi=4615052,Hi=4615053,Ki=4615054,$i=5508e3,Yi=5508001,qi=5508002,ji=5508003,Xi=5508004,Zi=5508005,Ji=5508006,Qi=5508007,eo=5508008,to=5508009,no=5508010,ro=5508011,se=5663e3,K=5663001,ce=5663002,de=5663003,ue=5663004,nt=5663005,rt=5663006,it=5663007,ot=5663008,at=5663009,io=5663010,oo=5663011,st=5663012,ao=5663013,so=5663014,ct=5663015,Ie=5663016,dt=5663017,ut=5663018,It=5663019,_t=5663020,_e=5663021,At=5663022,co=705e4,uo=7050001,Io=7050002,_o=7050003,Ao=7050004,lo=7050005,Eo=7050006,Ro=7050007,To=7050008,go=7050009,Do=7050010,So=7050011,fo=7050012,No=7050013,Co=7050014,Oo=7050015,mo=7050016,po=7050017,ho=7050018,Mo=7050019,yo=7050020,Lo=7050021,Uo=7050022,bo=7050023,Po=7050024,Bo=7050025,Fo=7050026,vo=7050027,wo=7050028,zo=7050029,ko=7050030,xo=7050031,Wo=7050032,Go=7050033,Vo=7050034,Ho=7050035,Ko=7050036,$o=7618e3,Yo=7618001,qo=7618002,jo=7618003,Ae=8078e3,le=8078001,lt=8078002,Et=8078003,Rt=8078004,Tt=8078005,gt=8078006,Ee=8078007,Dt=8078008,St=8078009,ft=8078010,Re=8078011,G=8078012,Nt=8078013,Ct=8078014,Ot=8078015,mt=8078016,Te=8078017,pt=8078018,Xo=8078019,ht=8078020,Mt=8078021,yt=8078022,Lt=8078023,Zo=81e5,Jo=8100001,Qo=8100002,ea=8100003,ta=819e4,na=8190001,ra=8190002,ia=8190003,oa=8190004,aa=99e5,sa=9900001,ca=9900002,da=9900003,ua=9900004,Ia=9900005,_a=9900006;function Ut(e){return Array.isArray(e)?"%5B"+e.map(Ut).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function Aa([e,t]){return `${e}=${Ut(t)}`}function la(e){let t=Object.entries(e).map(Aa).join("&");return Buffer.from(t,"utf8").toString("base64")}var Ea={[Cr]:"Account not found at address: $address",[hr]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[pr]:"Expected decoded account at address: $address",[mr]:"Failed to decode account data at address: $address",[Or]:"Accounts not found at addresses: $addresses",[Qe]:"Unable to find a viable program address bump seed.",[Nr]:"$putativeAddress is not a base58-encoded address.",[oe]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[Ye]:"The `CryptoKey` must be an `Ed25519` public key.",[tt]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[Je]:"Invalid seeds; point must fall off the Ed25519 curve.",[qe]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[Xe]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[Ze]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[je]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[et]:"Program address cannot end with PDA marker.",[ae]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[Kn]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[Gn]:"The network has progressed past the last block for which this transaction could have been committed.",[Ae]:"Codec [$codecDescription] cannot decode empty byte arrays.",[yt]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[ht]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[Tt]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[gt]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[Rt]:"Encoder and decoder must either both be fixed-size or variable-size.",[Dt]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[lt]:"Expected a fixed-size codec, got a variable-size one.",[Nt]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[Et]:"Expected a variable-size codec, got a fixed-size one.",[Xo]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[le]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[pt]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[St]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[ft]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[Ot]:"Invalid literal union variant. Expected one of [$variants], got $value.",[Ee]:"Expected [$codecDescription] to have $expected items, got $actual.",[G]:"Invalid value $value for base $base with alphabet $alphabet.",[mt]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[Re]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[Ct]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[Mt]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[Te]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[Lt]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[vr]:"No random values implementation could be found.",[ei]:"instruction requires an uninitialized account",[li]:"instruction tries to borrow reference for an account which is already borrowed",[Ei]:"instruction left account with an outstanding borrowed reference",[_i]:"program other than the account's owner changed the size of the account data",[Xr]:"account data too small for instruction",[Ai]:"instruction expected an executable account",[wi]:"An account does not have enough lamports to be rent-exempt",[ki]:"Program arithmetic overflowed",[vi]:"Failed to serialize or deserialize account data: $encodedData",[Ki]:"Builtin programs must consume compute units",[Ci]:"Cross-program invocation call depth too deep",[yi]:"Computational budget exceeded",[Ti]:"custom program error: #$code",[ci]:"instruction contains duplicate accounts",[Ri]:"instruction modifications of multiply-passed account differ",[fi]:"executable accounts must be rent exempt",[Di]:"instruction changed executable accounts data",[Si]:"instruction changed the balance of an executable account",[di]:"instruction changed executable bit of an account",[oi]:"instruction modified data of an account it does not own",[ii]:"instruction spent from the balance of an account it does not own",[$r]:"generic instruction error",[Wi]:"Provided owner is not allowed",[Bi]:"Account is immutable",[Fi]:"Incorrect authority provided",[Jr]:"incorrect program id for instruction",[Zr]:"insufficient funds for instruction",[jr]:"invalid account data for instruction",[zi]:"Invalid account owner",[Yr]:"invalid program argument",[gi]:"program returned invalid error code",[qr]:"invalid instruction data",[Mi]:"Failed to reallocate account data",[hi]:"Provided seeds do not result in a valid address",[Gi]:"Accounts data allocations exceeded the maximum allowed per transaction",[Vi]:"Max accounts exceeded",[Hi]:"Max instruction trace length exceeded",[pi]:"Length of the seed is too long for address generation",[Oi]:"An account required by the instruction is missing",[Qr]:"missing required signature for instruction",[ri]:"instruction illegally modified the program id of an account",[Ii]:"insufficient account keys for instruction",[Li]:"Cross-program invocation with unauthorized signer or writable account",[Ui]:"Failed to create program execution environment",[Pi]:"Program failed to compile",[bi]:"Program failed to complete",[si]:"instruction modified data of a read-only account",[ai]:"instruction changed the balance of a read-only account",[mi]:"Cross-program invocation reentrancy not allowed for this instruction",[ui]:"instruction modified rent epoch of an account",[ni]:"sum of account balances before and after instruction do not match",[ti]:"instruction requires an initialized account",[Kr]:"",[Ni]:"Unsupported program id",[xi]:"Unsupported sysvar",[Ia]:"Invalid instruction plan kind: $kind.",[qo]:"The provided instruction plan is empty.",[jo]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[$o]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[_a]:"Invalid transaction plan kind: $kind.",[Yo]:"No more instructions to pack; the message packer has completed the instruction plan.",[Gr]:"The instruction does not have any accounts.",[Vr]:"The instruction does not have any data.",[Hr]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[$n]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[Vn]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[ca]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[ua]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[sa]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[aa]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[da]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Qn]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[er]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[nr]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[tr]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[Jn]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[ur]:"$__serverMessage",[fr]:"$__serverMessage",[gr]:"$__serverMessage",[cr]:"$__serverMessage",[or]:"Epoch rewards period still active at slot $slot",[_r]:"$__serverMessage",[Ar]:"$__serverMessage",[rr]:"Failed to query long-term storage; please try again",[ar]:"Minimum context slot has not been reached",[Tr]:"Node is unhealthy; behind by $numSlotsBehind slots",[lr]:"No snapshot",[Sr]:"Transaction simulation failed",[ir]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[Er]:"$__serverMessage",[Ir]:"Transaction history is not available from this node",[Rr]:"$__serverMessage",[dr]:"Transaction signature length mismatch",[Dr]:"Transaction signature verification failure",[sr]:"$__serverMessage",[wr]:"Key pair bytes must be of length 64, got $byteLength.",[zr]:"Expected private key bytes with length 32. Actual length: $actualLength.",[kr]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Wr]:"The provided private key does not match the provided public key.",[xr]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[Yn]:"Lamports value must be in the range [0, 2e64-1]",[qn]:"`$value` cannot be parsed as a `BigInt`",[Zn]:"$message",[jn]:"`$value` cannot be parsed as a `Number`",[Hn]:"No nonce account could be found at address `$nonceAccountAddress`",[ta]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[ra]:"WebSocket was closed before payload could be added to the send buffer",[ia]:"WebSocket connection closed",[oa]:"WebSocket failed to connect",[na]:"Failed to obtain a subscription id from the server",[ea]:"Could not find an API plan for RPC method: `$method`",[Zo]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[Qo]:"HTTP error ($statusCode): $message",[Jo]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[$i]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[Yi]:"The provided value does not implement the `KeyPairSigner` interface",[ji]:"The provided value does not implement the `MessageModifyingSigner` interface",[Xi]:"The provided value does not implement the `MessagePartialSigner` interface",[qi]:"The provided value does not implement any of the `MessageSigner` interfaces",[Ji]:"The provided value does not implement the `TransactionModifyingSigner` interface",[Qi]:"The provided value does not implement the `TransactionPartialSigner` interface",[eo]:"The provided value does not implement the `TransactionSendingSigner` interface",[Zi]:"The provided value does not implement any of the `TransactionSigner` interfaces",[to]:"More than one `TransactionSendingSigner` was identified.",[no]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[ro]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[Fr]:"Cannot export a non-extractable key.",[yr]:"No digest implementation could be found.",[Mr]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[Lr]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
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.`,[Pr]:"No signature verification implementation could be found.",[Fr]:"No key generation implementation could be found.",[Br]:"No signing implementation could be found.",[vr]:"No key export implementation could be found.",[Jn]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[hi]:"Transaction processing left an account with an outstanding borrowed reference",[_i]:"Account in use",[Ai]:"Account loaded twice",[li]:"Attempt to debit an account but found no record of a prior credit.",[Fi]:"Transaction loads an address table account that doesn't exist",[gi]:"This transaction has already been processed",[Di]:"Blockhash not found",[Si]:"Loader call chain is too deep",[pi]:"Transactions are currently disabled due to cluster maintenance",[Wi]:"Transaction contains a duplicate instruction ($index) that is not allowed",[Ri]:"Insufficient funds for fee",[Gi]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Ti]:"This account may not be used to pay transaction fees",[fi]:"Transaction contains an invalid account reference",[vi]:"Transaction loads an address table account with invalid data",[wi]:"Transaction address table lookup uses an invalid index",[Bi]:"Transaction loads an address table account with an invalid owner",[Hi]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Oi]:"This program may not be used for executing instructions",[zi]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[Li]:"Transaction loads a writable account that cannot be written",[Vi]:"Transaction exceeded max loaded accounts data size cap",[Ni]:"Transaction requires a fee but has no signature present",[Ei]:"Attempt to load a program that does not exist",[Yi]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Ki]:"ResanitizationNeeded",[mi]:"Transaction failed to sanitize accounts offsets correctly",[Ci]:"Transaction did not pass signature verification",[Pi]:"Transaction locked too many accounts",[$i]:"Sum of account balances before and after transaction do not match",[Ii]:"The transaction failed with the error `$errorName`",[yi]:"Transaction version is unsupported",[bi]:"Transaction would exceed account data limit within the block",[xi]:"Transaction would exceed total account data limit",[Ui]:"Transaction would exceed max account limit within the block",[Mi]:"Transaction would exceed max Block Cost Limit",[ki]:"Transaction would exceed max Vote Cost Limit",[At]:"Attempted to sign a transaction with an address that is not a signer for it",[si]:"Transaction is missing an address at index: $index.",[Ne]:"Transaction has no expected signers therefore it cannot be encoded",[Tt]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ge]:"Transaction does not have a blockhash lifetime",[De]:"Transaction is not a durable nonce transaction",[st]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[ct]:"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",[ut]:"No fee payer set in CompiledTransaction",[dt]:"Could not find program address at index $index",[Et]:"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",[ci]:"Transaction is missing a fee payer.",[_t]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[ui]:"Transaction first instruction is not advance nonce account instruction.",[di]:"Transaction with no instructions cannot be durable nonce transaction.",[Te]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[ee]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[lt]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[It]:"Transaction is missing signatures for addresses: $addresses.",[Se]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[fe]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[gt]:"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."},L="i",y="t";function ga(e,t={}){let n=Ta[e];if(n.length===0)return "";let r;function o(i){if(r[y]===2){let a=n.slice(r[L]+1,i);s.push(a in t?`${t[a]}`:`$${a}`);}else r[y]===1&&s.push(n.slice(r[L],i));}let s=[];return n.split("").forEach((i,a)=>{if(a===0){r={[L]:0,[y]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[y]){case 0:c={[L]:a,[y]:1};break;case 1:i==="\\"?c={[L]:a,[y]:0}:i==="$"&&(c={[L]:a,[y]:2});break;case 2:i==="\\"?c={[L]:a,[y]:0}:i==="$"?c={[L]:a,[y]:2}:i.match(/\w/)||(c={[L]:a,[y]:1});break}c&&(r!==c&&o(a),r=c);}),o(),s.join("")}function Da(e,t={}){if(process.env.NODE_ENV!=="production")return ga(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${Ra(t)}'`),`${n}\``}}var I=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([s,i])=>{s==="cause"?r={cause:i.value}:(n===void 0&&(n={}),Object.defineProperty(n,s,i));});let o=Da(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function Sa(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var Na=(e,t)=>Sa(e.length<=t?e:e.slice(0,t),t);function P(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function l(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(P(t,e));return e.write(t,n,0),n}})}function F(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function p(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function fa(e){return !p(e)}function wt(e,t,n=0){if(t.length-n<=0)throw new I(Ce,{codecDescription:e})}function te(e,t,n,r=0){let o=n.length-r;if(o<t)throw new I(Oe,{bytesLength:o,codecDescription:e,expected:t})}function zt(e,t){let n=(i,a,c)=>{let d=e.encode(i);return c=t.write(d.length,a,c),a.set(d,c),c+d.length};if(p(t)&&p(e))return l({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});let r=p(t)?t.fixedSize:t.maxSize??null,o=p(e)?e.fixedSize:e.maxSize??null,s=r!==null&&o!==null?r+o:null;return l({...e,...s!==null?{maxSize:s}:{},getSizeFromValue:i=>{let a=P(i,e);return P(a,t)+a},write:n})}function G(e,t){return l({fixedSize:t,write:(n,r,o)=>{let s=e.encode(n),i=s.length>t?s.slice(0,t):s;return r.set(i,o),o+t}})}function q(e,t){return F({fixedSize:t,read:(n,r)=>{te("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),p(e)&&(n=Na(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function h(e,t){return l({...fa(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function Ca(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new I(Z,{alphabet:e,base:e.length,value:n})}var Oa=e=>l({getSizeFromValue:t=>{let[n,r]=kt(t,e[0]);if(!r)return t.length;let o=xt(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ca(e,t),t==="")return r;let[o,s]=kt(t,e[0]);if(!s)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let i=xt(s,e),a=[];for(;i>0n;)a.unshift(Number(i%256n)),i/=256n;let c=[...Array(o.length).fill(0),...a];return n.set(c,r),r+c.length}}),ma=e=>F({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 s=e[0].repeat(o);if(o===r.length)return [s,t.length];let i=r.slice(o).reduce((c,d)=>c*256n+BigInt(d),0n),a=pa(i,e);return [s+a,t.length]}});function kt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function xt(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function pa(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var Wt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ne=()=>Oa(Wt),N=()=>ma(Wt);var re=()=>F({read:(e,t=0)=>[Buffer.from(e,t).toString("base64"),e.length]});var Me,ye;function Le(){return Me||(Me=ne()),Me}function Ma(){return ye||(ye=N()),ye}function Gt(e){if(e.length<32||e.length>44)return false;let t=Le();try{return t.encode(e).byteLength===32}catch{return false}}function Ue(e){if(e.length<32||e.length>44)throw new I(Re,{actualLength:e.length});let r=Le().encode(e).byteLength;if(r!==32)throw new I(Ee,{actualLength:r})}function D(e){return Ue(e),e}function V(){return h(G(Le(),32),e=>D(e))}function B(){return q(Ma(),32)}function oe(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:false,localeMatcher:"best fit",numeric:false,sensitivity:"variant",usage:"sort"}).compare}function Vt(e,t,n,r){if(r<t||r>n)throw new I(pe,{codecDescription:e,max:n,min:t,value:r})}function Ht(e){return e?.endian!==1}function be(e){return l({fixedSize:e.size,write(t,n,r){e.range&&Vt(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,Ht(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function ya(e){return F({fixedSize:e.size,read(t,n=0){wt(e.name,t,n),te(e.name,e.size,t,n);let r=new DataView(La(t,n,e.size));return [e.get(r,Ht(e.config)),n+e.size]}})}function La(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var U=()=>l({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Vt("shortU16",0,65535,e);let r=[0];for(let o=0;;o+=1){let s=Number(e)>>o*7;if(s===0)break;let i=127&s;r[o]=i,o>0&&(r[o-1]|=128);}return t.set(r,n),n+r.length}});var ie=(e={})=>be({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4});var ae=(e={})=>be({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,n,r)=>t.setBigUint64(0,BigInt(n),r),size:8}),Pe=(e={})=>ya({config:e,get:(t,n)=>t.getBigUint64(0,n),name:"u64",size:8});var b=()=>be({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 I(me,{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 Kt(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function jt(e){return p(e)?e.fixedSize:null}function Be(e){return p(e)?e.fixedSize:e.maxSize??null}function v(e,t={}){let n=t.size??ie(),r=Yt(n,jt(e)),o=Yt(n,Be(e))??void 0;return l({...r!==null?{fixedSize:r}:{getSizeFromValue:s=>(typeof n=="object"?P(s.length,n):0)+[...s].reduce((a,c)=>a+P(c,e),0),maxSize:o},write:(s,i,a)=>(typeof n=="number"&&Pa("array",n,s.length),typeof n=="object"&&(a=n.write(s.length,i,a)),s.forEach(c=>{a=e.write(c,i,a);}),a)})}function Yt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function J(){return l({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Zt(e){return l({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function qt(e,t){let n=Ba(e),r=(s,i,a)=>{let c=t(s);return $t(e,c),e[c].write(s,i,a)};if(n!==null)return l({fixedSize:n,write:r});let o=va(e);return l({...o!==null?{maxSize:o}:{},getSizeFromValue:s=>{let i=t(s);return $t(e,i),P(s,e[i])},write:r})}function $t(e,t){if(typeof e[t]>"u")throw new I(he,{maxRange:e.length-1,minRange:0,variant:t})}function Ba(e){if(e.length===0)return 0;if(!p(e[0]))return null;let t=e[0].fixedSize;return e.every(r=>p(r)&&r.fixedSize===t)?t:null}function va(e){return Fa(e.map(t=>Be(t)))}function M(e){let t=e.map(([,o])=>o),n=Kt(t.map(jt)),r=Kt(t.map(Be))??void 0;return l({...n===null?{getSizeFromValue:o=>e.map(([s,i])=>P(o[s],i)).reduce((s,i)=>s+i,0),maxSize:r}:{fixedSize:n},write:(o,s,i)=>(e.forEach(([a,c])=>{i=c.write(o[a],s,i);}),i)})}function ve(e,...t){return t.reduce((n,r)=>r(n),e)}var w=(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))(w||{});var wa=1;function z(e){return e>=2}function K(e){return (e&wa)!==0}function we(e,t){return e|t}function Jt(e){return Gt(e)}function Qt(){return B()}function sn(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.blockhash=="string"&&typeof e.lifetimeConstraint.lastValidBlockHeight=="bigint"&&Jt(e.lifetimeConstraint.blockhash)}function cn(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 Wa(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new I(Z,{alphabet:e,base:e.length,value:n})}var Ga=e=>l({getSizeFromValue:t=>{let[n,r]=en(t,e[0]);if(!r)return t.length;let o=tn(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Wa(e,t),t==="")return r;let[o,s]=en(t,e[0]);if(!s)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let i=tn(s,e),a=[];for(;i>0n;)a.unshift(Number(i%256n)),i/=256n;let c=[...Array(o.length).fill(0),...a];return n.set(c,r),r+c.length}});function en(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function tn(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var Va="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ha=()=>Ga(Va);var ze;function Ka(){if(!ze){let e=v(b(),{size:U()});ze=M([["lookupTableAddress",V()],["writableIndexes",e],["readonlyIndexes",e]]);}return ze}var ke;function xe(){return ke||(ke=b()),ke}function Ya(){return M([["numSignerAccounts",xe()],["numReadonlySignerAccounts",xe()],["numReadonlyNonSignerAccounts",xe()]])}var We;function $a(){return We||(We=h(M([["programAddressIndex",b()],["accountIndices",v(b(),{size:U()})],["data",zt(J(),U())]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),We}var Xa=0,ja=128;function Za(){return l({getSizeFromValue:e=>e==="legacy"?0:1,maxSize:1,write:(e,t,n)=>{if(e==="legacy")return n;if(e<0||e>127)throw new I(Se,{actualVersion:e});if(e>Xa)throw new I(fe,{unsupportedVersion:e});return t.set([e|ja],n),n+1}})}function nn(){return M(dn())}function rn(){return h(M([...dn(),["addressTableLookups",qa()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function dn(){let e=qt([Zt(new Uint8Array(32)),G(Ha(),32)],t=>t===void 0?0:1);return [["version",Za()],["header",Ya()],["staticAccounts",v(V(),{size:U()})],["lifetimeToken",e],["instructions",v($a(),{size:U()})]]}function qa(){return v(Ka(),{size:U()})}function un(){return l({getSizeFromValue:e=>e.version==="legacy"?nn().getSizeFromValue(e):rn().getSizeFromValue(e),write:(e,t,n)=>e.version==="legacy"?nn().write(e,t,n):rn().write(e,t,n)})}function on(e,t,n){e[t]=n(e[t]??{role:w.READONLY});}var E=Symbol("AddressMapTypeProperty");function Ja(e,t){let n={[e]:{[E]:0,role:w.WRITABLE_SIGNER}},r=new Set;for(let o of t){on(n,o.programAddress,i=>{if(r.add(o.programAddress),E in i){if(K(i.role))switch(i[E]){case 0:throw new I(Te,{programAddress:o.programAddress});default:throw new I(ee,{programAddress:o.programAddress})}if(i[E]===2)return i}return {[E]:2,role:w.READONLY}});let s;if(o.accounts)for(let i of o.accounts)on(n,i.address,a=>{let{address:c,...d}=i;if(E in a)switch(a[E]){case 0:return a;case 1:{let u=we(a.role,d.role);if("lookupTableAddress"in d){if(a.lookupTableAddress!==d.lookupTableAddress&&(s||=oe())(d.lookupTableAddress,a.lookupTableAddress)<0)return {[E]:1,...d,role:u}}else if(z(d.role))return {[E]:2,role:u};return a.role!==u?{...a,role:u}:a}case 2:{let u=we(a.role,d.role);if(r.has(i.address)){if(K(d.role))throw new I(ee,{programAddress:i.address});return a.role!==u?{...a,role:u}:a}else return "lookupTableAddress"in d&&!z(a.role)?{...d,[E]:1,role:u}:a.role!==u?{...a,role:u}:a}}return "lookupTableAddress"in d?{...d,[E]:1}:{...d,[E]:2}});}return n}function Qa(e){let t;return Object.entries(e).sort(([r,o],[s,i])=>{if(o[E]!==i[E]){if(o[E]===0)return -1;if(i[E]===0)return 1;if(o[E]===2)return -1;if(i[E]===2)return 1}let a=z(o.role);if(a!==z(i.role))return a?-1:1;let c=K(o.role);return c!==K(i.role)?c?-1:1:(t||=oe(),o[E]===1&&i[E]===1&&o.lookupTableAddress!==i.lookupTableAddress?t(o.lookupTableAddress,i.lookupTableAddress):t(r,s))}).map(([r,o])=>({address:r,...o}))}function es(e){let t={};for(let n of e){if(!("lookupTableAddress"in n))continue;let r=t[n.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};n.role===w.WRITABLE?r.writableIndexes.push(n.addressIndex):r.readonlyIndexes.push(n.addressIndex);}return Object.keys(t).sort(oe()).map(n=>({lookupTableAddress:n,...t[n]}))}function ts(e){let t=0,n=0,r=0;for(let o of e){if("lookupTableAddress"in o)break;let s=K(o.role);z(o.role)?(r++,s||n++):s||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function ns(e){let t={};for(let[n,r]of e.entries())t[r.address]=n;return t}function rs(e,t){let n=ns(t);return e.map(({accounts:r,data:o,programAddress:s})=>({programAddressIndex:n[s],...r?{accountIndices:r.map(({address:i})=>n[i])}:null,...o?{data:o}:null}))}function os(e){return "nonce"in e?e.nonce:e.blockhash}function is(e){let t=e.findIndex(r=>"lookupTableAddress"in r);return (t===-1?e:e.slice(0,t)).map(({address:r})=>r)}function In(e){let t=Ja(e.feePayer.address,e.instructions),n=Qa(t),r=e.lifetimeConstraint;return {...e.version!=="legacy"?{addressTableLookups:es(n)}:null,...r?{lifetimeToken:os(r)}:null,header:ts(n),instructions:rs(e.instructions,n),staticAccounts:is(n),version:e.version}}function as(e,t,n){for(let[r,o]of Object.entries(n))for(let s=0;s<o.length;s++)if(e===o[s])return {address:e,addressIndex:s,lookupTableAddress:r,role:t}}function _n(e,t){let n=new Set(e.instructions.map(i=>i.programAddress)),r=new Set(Object.values(t).flatMap(i=>i).filter(i=>!n.has(i))),o=[],s=false;for(let i of e.instructions){if(!i.accounts){o.push(i);continue}let a=[],c=false;for(let d of i.accounts){if("lookupTableAddress"in d||!r.has(d.address)||z(d.role)){a.push(d);continue}let u=as(d.address,d.role,t);a.push(Object.freeze(u)),c=true,s=true;}o.push(Object.freeze(c?{...i,accounts:a}:i));}return Object.freeze(s?{...e,instructions:o}:e)}function An(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var ss="SysvarRecentB1ockHashes11111111111111111111",cs="11111111111111111111111111111111";function ds(e){return e.programAddress===cs&&e.data!=null&&us(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===w.WRITABLE&&e.accounts[1].address===ss&&e.accounts[1].role===w.READONLY&&e.accounts[2].address!=null&&z(e.accounts[2].role)}function us(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Ge(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&ds(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 Is(e){let t=Object.values(e);if(t.length===0)throw new I(Ne);return t.map(n=>n||new Uint8Array(64).fill(0))}function _s(){return h(v(G(J(),64),{size:U()}),Is)}function Ve(){return M([["signatures",_s()],["messageBytes",J()]])}function He(e){let t=In(e),n=un().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(let i of r)o[i]=null;let s;return sn(e)?s={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:Ge(e)&&(s={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...s?{lifetimeConstraint:s}:void 0,messageBytes:n,signatures:Object.freeze(o)})}function Ke(e){let t=Ve().encode(e);return re().decode(t)}function Rn(e,t){Object.freeze(e);let n={...t,feePayer:e};return Object.freeze(n),n}function Tn(e){return Object.freeze({address:e,signMessages:n=>Promise.resolve(n.map(()=>Object.freeze({}))),signTransactions:n=>Promise.resolve(n.map(()=>Object.freeze({})))})}var se="ComputeBudget111111111111111111111111111111";var Ye=2;function $e(){return h(M([["discriminator",b()],["units",ie()]]),e=>({...e,discriminator:Ye}))}function ce(e,t){let n=se,r={...e};return Object.freeze({data:$e().encode(r),programAddress:n})}var Xe=3;function je(){return h(M([["discriminator",b()],["microLamports",ae()]]),e=>({...e,discriminator:Xe}))}function de(e,t){let n=se,r={...e};return Object.freeze({data:je().encode(r),programAddress:n})}var Y="11111111111111111111111111111111";var gn=0,Dn=1,Sn=2,Nn=3,fn=4,Cn=5,On=6,mn=7,pn=8;process.env.NODE_ENV!=="production"&&({[gn]:"an account with the same address already exists",[Cn]:"provided address does not match addressed derived from seed",[Nn]:"cannot allocate account data of this length",[Sn]:"cannot assign account to this program id",[fn]:"length of requested seed is too long",[mn]:"stored nonce is still in recent_blockhashes",[On]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[pn]:"specified nonce does not match stored nonce",[Dn]:"account does not have enough SOL to perform the operation"});var Ze="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";var ue="https://auth.revibase.com",$="https://api.revibase.com",hn="revibase.com",Mn="Gq6VZLi2aNSxB4Ag7L1NKDfuCgNZgUuxy1B8yW28PdEp";function yn(e){let t="";e.domain?t+=`${e.domain} wants you to sign in with your account.`:t+="Sign in with your account.";let 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.`,[Ur]:"No signature verification implementation could be found.",[br]:"No key generation implementation could be found.",[Pr]:"No signing implementation could be found.",[Br]:"No key export implementation could be found.",[Xn]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[mo]:"Transaction processing left an account with an outstanding borrowed reference",[uo]:"Account in use",[Io]:"Account loaded twice",[_o]:"Attempt to debit an account but found no record of a prior credit.",[bo]:"Transaction loads an address table account that doesn't exist",[Ro]:"This transaction has already been processed",[To]:"Blockhash not found",[go]:"Loader call chain is too deep",[Oo]:"Transactions are currently disabled due to cluster maintenance",[ko]:"Transaction contains a duplicate instruction ($index) that is not allowed",[lo]:"Insufficient funds for fee",[xo]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Eo]:"This account may not be used to pay transaction fees",[So]:"Transaction contains an invalid account reference",[Bo]:"Transaction loads an address table account with invalid data",[Fo]:"Transaction address table lookup uses an invalid index",[Po]:"Transaction loads an address table account with an invalid owner",[Go]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[No]:"This program may not be used for executing instructions",[vo]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[Mo]:"Transaction loads a writable account that cannot be written",[Wo]:"Transaction exceeded max loaded accounts data size cap",[Do]:"Transaction requires a fee but has no signature present",[Ao]:"Attempt to load a program that does not exist",[Ho]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Vo]:"ResanitizationNeeded",[Co]:"Transaction failed to sanitize accounts offsets correctly",[fo]:"Transaction did not pass signature verification",[Uo]:"Transaction locked too many accounts",[Ko]:"Sum of account balances before and after transaction do not match",[co]:"The transaction failed with the error `$errorName`",[ho]:"Transaction version is unsupported",[Lo]:"Transaction would exceed account data limit within the block",[zo]:"Transaction would exceed total account data limit",[yo]:"Transaction would exceed max account limit within the block",[po]:"Transaction would exceed max Block Cost Limit",[wo]:"Transaction would exceed max Vote Cost Limit",[ct]:"Attempted to sign a transaction with an address that is not a signer for it",[io]:"Transaction is missing an address at index: $index.",[Ie]:"Transaction has no expected signers therefore it cannot be encoded",[_t]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[ce]:"Transaction does not have a blockhash lifetime",[de]:"Transaction is not a durable nonce transaction",[nt]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[rt]:"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",[ot]:"No fee payer set in CompiledTransaction",[it]:"Could not find program address at index $index",[ut]:"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",[It]:"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",[oo]:"Transaction is missing a fee payer.",[st]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[so]:"Transaction first instruction is not advance nonce account instruction.",[ao]:"Transaction with no instructions cannot be durable nonce transaction.",[se]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[K]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[dt]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[at]:"Transaction is missing signatures for addresses: $addresses.",[ue]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[_e]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[At]:"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."},m="i",C="t";function Ra(e,t={}){let n=Ea[e];if(n.length===0)return "";let r;function i(o){if(r[C]===2){let s=n.slice(r[m]+1,o);a.push(s in t?`${t[s]}`:`$${s}`);}else r[C]===1&&a.push(n.slice(r[m],o));}let a=[];return n.split("").forEach((o,s)=>{if(s===0){r={[m]:0,[C]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[C]){case 0:c={[m]:s,[C]:1};break;case 1:o==="\\"?c={[m]:s,[C]:0}:o==="$"&&(c={[m]:s,[C]:2});break;case 2:o==="\\"?c={[m]:s,[C]:0}:o==="$"?c={[m]:s,[C]:2}:o.match(/\w/)||(c={[m]:s,[C]:1});break}c&&(r!==c&&i(s),r=c);}),i(),a.join("")}function Ta(e,t={}){if(process.env.NODE_ENV!=="production")return Ra(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${la(t)}'`),`${n}\``}}var A=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([a,o])=>{a==="cause"?r={cause:o.value}:(n===void 0&&(n={}),Object.defineProperty(n,a,o));});let i=Ta(e,n);super(i,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function ga(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var Da=(e,t)=>ga(e.length<=t?e:e.slice(0,t),t);function y(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function l(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(y(t,e));return e.write(t,n,0),n}})}function L(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function D(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function Sa(e){return !D(e)}function bt(e,t,n=0){if(t.length-n<=0)throw new A(Ae,{codecDescription:e})}function $(e,t,n,r=0){let i=n.length-r;if(i<t)throw new A(le,{bytesLength:i,codecDescription:e,expected:t})}function Pt(e,t){let n=(o,s,c)=>{let d=e.encode(o);return c=t.write(d.length,s,c),s.set(d,c),c+d.length};if(D(t)&&D(e))return l({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});let r=D(t)?t.fixedSize:t.maxSize??null,i=D(e)?e.fixedSize:e.maxSize??null,a=r!==null&&i!==null?r+i:null;return l({...e,...a!==null?{maxSize:a}:{},getSizeFromValue:o=>{let s=y(o,e);return y(s,t)+s},write:n})}function v(e,t){return l({fixedSize:t,write:(n,r,i)=>{let a=e.encode(n),o=a.length>t?a.slice(0,t):a;return r.set(o,i),i+t}})}function V(e,t){return L({fixedSize:t,read:(n,r)=>{$("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),D(e)&&(n=Da(n,e.fixedSize));let[i]=e.read(n,0);return [i,r+t]}})}function S(e,t){return l({...Sa(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,i)=>e.write(t(n),r,i)})}function fa(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var Na=e=>l({getSizeFromValue:t=>{let[n,r]=Bt(t,e[0]);if(!r)return t.length;let i=Ft(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(fa(e,t),t==="")return r;let[i,a]=Bt(t,e[0]);if(!a)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=Ft(a,e),s=[];for(;o>0n;)s.unshift(Number(o%256n)),o/=256n;let c=[...Array(i.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ca=e=>L({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let i=r.findIndex(c=>c!==0);i=i===-1?r.length:i;let a=e[0].repeat(i);if(i===r.length)return [a,t.length];let o=r.slice(i).reduce((c,d)=>c*256n+BigInt(d),0n),s=Oa(o,e);return [a+s,t.length]}});function Bt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Ft(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}function Oa(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var wt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Y=()=>Na(wt),p=()=>Ca(wt);var q=()=>L({read:(e,t=0)=>[Buffer.from(e,t).toString("base64"),e.length]});var vt=globalThis.TextEncoder,zt=()=>{let e;return l({getSizeFromValue:t=>(e||=new vt).encode(t).length,write:(t,n,r)=>{let i=(e||=new vt).encode(t);return n.set(i,r),r+i.length}})};var ge,De;function Se(){return ge||(ge=Y()),ge}function pa(){return De||(De=p()),De}function kt(e){if(e.length<32||e.length>44)return false;let t=Se();try{return t.encode(e).byteLength===32}catch{return false}}function fe(e){if(e.length<32||e.length>44)throw new A(ae,{actualLength:e.length});let r=Se().encode(e).byteLength;if(r!==32)throw new A(oe,{actualLength:r})}function T(e){return fe(e),e}function w(){return S(v(Se(),32),e=>T(e))}function f(){return V(pa(),32)}function j(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:false,localeMatcher:"best fit",numeric:false,sensitivity:"variant",usage:"sort"}).compare}function xt(e,t,n,r){if(r<t||r>n)throw new A(Re,{codecDescription:e,max:n,min:t,value:r})}function Wt(e){return e?.endian!==1}function Ne(e){return l({fixedSize:e.size,write(t,n,r){e.range&&xt(e.name,e.range[0],e.range[1],t);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,Wt(e.config)),n.set(new Uint8Array(i),r),r+e.size}})}function ha(e){return L({fixedSize:e.size,read(t,n=0){bt(e.name,t,n),$(e.name,e.size,t,n);let r=new DataView(Ma(t,n,e.size));return [e.get(r,Wt(e.config)),n+e.size]}})}function Ma(e,t,n){let r=e.byteOffset+(t??0),i=n??e.byteLength;return e.buffer.slice(r,r+i)}var h=()=>l({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{xt("shortU16",0,65535,e);let r=[0];for(let i=0;;i+=1){let a=Number(e)>>i*7;if(a===0)break;let o=127&a;r[i]=o,i>0&&(r[i-1]|=128);}return t.set(r,n),n+r.length}});var X=(e={})=>Ne({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4});var Z=(e={})=>Ne({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,n,r)=>t.setBigUint64(0,BigInt(n),r),size:8}),Ce=(e={})=>ha({config:e,get:(t,n)=>t.getBigUint64(0,n),name:"u64",size:8});var M=()=>Ne({name:"u8",range:[0,255],set:(e,t)=>e.setUint8(0,Number(t)),size:1});function Ua(e,t,n){if(t!==n)throw new A(Ee,{actual:n,codecDescription:e,expected:t})}function ba(e){return e.reduce((t,n)=>t===null||n===null?null:Math.max(t,n),0)}function Gt(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function $t(e){return D(e)?e.fixedSize:null}function me(e){return D(e)?e.fixedSize:e.maxSize??null}function U(e,t={}){let n=t.size??X(),r=Vt(n,$t(e)),i=Vt(n,me(e))??void 0;return l({...r!==null?{fixedSize:r}:{getSizeFromValue:a=>(typeof n=="object"?y(a.length,n):0)+[...a].reduce((s,c)=>s+y(c,e),0),maxSize:i},write:(a,o,s)=>(typeof n=="number"&&Ua("array",n,a.length),typeof n=="object"&&(s=n.write(a.length,o,s)),a.forEach(c=>{s=e.write(c,o,s);}),s)})}function Vt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function H(){return l({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Yt(e){return l({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function qt(e,t){let n=Pa(e),r=(a,o,s)=>{let c=t(a);return Ht(e,c),e[c].write(a,o,s)};if(n!==null)return l({fixedSize:n,write:r});let i=Ba(e);return l({...i!==null?{maxSize:i}:{},getSizeFromValue:a=>{let o=t(a);return Ht(e,o),y(a,e[o])},write:r})}function Ht(e,t){if(typeof e[t]>"u")throw new A(Te,{maxRange:e.length-1,minRange:0,variant:t})}function Pa(e){if(e.length===0)return 0;if(!D(e[0]))return null;let t=e[0].fixedSize;return e.every(r=>D(r)&&r.fixedSize===t)?t:null}function Ba(e){return ba(e.map(t=>me(t)))}function N(e){let t=e.map(([,i])=>i),n=Gt(t.map($t)),r=Gt(t.map(me))??void 0;return l({...n===null?{getSizeFromValue:i=>e.map(([a,o])=>y(i[a],o)).reduce((a,o)=>a+o,0),maxSize:r}:{fixedSize:n},write:(i,a,o)=>(e.forEach(([s,c])=>{o=c.write(i[s],a,o);}),o)})}function pe(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 Fa=1;function P(e){return e>=2}function k(e){return (e&Fa)!==0}function he(e,t){return e|t}function jt(e){return kt(e)}function Xt(){return f()}function rn(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.blockhash=="string"&&typeof e.lifetimeConstraint.lastValidBlockHeight=="bigint"&&jt(e.lifetimeConstraint.blockhash)}function on(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 ka(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new A(G,{alphabet:e,base:e.length,value:n})}var xa=e=>l({getSizeFromValue:t=>{let[n,r]=Zt(t,e[0]);if(!r)return t.length;let i=Jt(r,e);return n.length+Math.ceil(i.toString(16).length/2)},write(t,n,r){if(ka(e,t),t==="")return r;let[i,a]=Zt(t,e[0]);if(!a)return n.set(new Uint8Array(i.length).fill(0),r),r+i.length;let o=Jt(a,e),s=[];for(;o>0n;)s.unshift(Number(o%256n)),o/=256n;let c=[...Array(i.length).fill(0),...s];return n.set(c,r),r+c.length}});function Zt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Jt(e,t){let n=BigInt(t.length),r=0n;for(let i of e)r*=n,r+=BigInt(t.indexOf(i));return r}var Wa="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ga=()=>xa(Wa);var Me;function Va(){if(!Me){let e=U(M(),{size:h()});Me=N([["lookupTableAddress",w()],["writableIndexes",e],["readonlyIndexes",e]]);}return Me}var ye;function Le(){return ye||(ye=M()),ye}function Ha(){return N([["numSignerAccounts",Le()],["numReadonlySignerAccounts",Le()],["numReadonlyNonSignerAccounts",Le()]])}var Ue;function Ka(){return Ue||(Ue=S(N([["programAddressIndex",M()],["accountIndices",U(M(),{size:h()})],["data",Pt(H(),h())]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),Ue}var $a=0,Ya=128;function qa(){return l({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(ue,{actualVersion:e});if(e>$a)throw new A(_e,{unsupportedVersion:e});return t.set([e|Ya],n),n+1}})}function Qt(){return N(an())}function en(){return S(N([...an(),["addressTableLookups",ja()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function an(){let e=qt([Yt(new Uint8Array(32)),v(Ga(),32)],t=>t===void 0?0:1);return [["version",qa()],["header",Ha()],["staticAccounts",U(w(),{size:h()})],["lifetimeToken",e],["instructions",U(Ka(),{size:h()})]]}function ja(){return U(Va(),{size:h()})}function sn(){return l({getSizeFromValue:e=>e.version==="legacy"?Qt().getSizeFromValue(e):en().getSizeFromValue(e),write:(e,t,n)=>e.version==="legacy"?Qt().write(e,t,n):en().write(e,t,n)})}function tn(e,t,n){e[t]=n(e[t]??{role:b.READONLY});}var E=Symbol("AddressMapTypeProperty");function Xa(e,t){let n={[e]:{[E]:0,role:b.WRITABLE_SIGNER}},r=new Set;for(let i of t){tn(n,i.programAddress,o=>{if(r.add(i.programAddress),E in o){if(k(o.role))switch(o[E]){case 0:throw new A(se,{programAddress:i.programAddress});default:throw new A(K,{programAddress:i.programAddress})}if(o[E]===2)return o}return {[E]:2,role:b.READONLY}});let a;if(i.accounts)for(let o of i.accounts)tn(n,o.address,s=>{let{address:c,...d}=o;if(E in s)switch(s[E]){case 0:return s;case 1:{let u=he(s.role,d.role);if("lookupTableAddress"in d){if(s.lookupTableAddress!==d.lookupTableAddress&&(a||=j())(d.lookupTableAddress,s.lookupTableAddress)<0)return {[E]:1,...d,role:u}}else if(P(d.role))return {[E]:2,role:u};return s.role!==u?{...s,role:u}:s}case 2:{let u=he(s.role,d.role);if(r.has(o.address)){if(k(d.role))throw new A(K,{programAddress:o.address});return s.role!==u?{...s,role:u}:s}else return "lookupTableAddress"in d&&!P(s.role)?{...d,[E]:1,role:u}:s.role!==u?{...s,role:u}:s}}return "lookupTableAddress"in d?{...d,[E]:1}:{...d,[E]:2}});}return n}function Za(e){let t;return Object.entries(e).sort(([r,i],[a,o])=>{if(i[E]!==o[E]){if(i[E]===0)return -1;if(o[E]===0)return 1;if(i[E]===2)return -1;if(o[E]===2)return 1}let s=P(i.role);if(s!==P(o.role))return s?-1:1;let c=k(i.role);return c!==k(o.role)?c?-1:1:(t||=j(),i[E]===1&&o[E]===1&&i.lookupTableAddress!==o.lookupTableAddress?t(i.lookupTableAddress,o.lookupTableAddress):t(r,a))}).map(([r,i])=>({address:r,...i}))}function Ja(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 Qa(e){let t=0,n=0,r=0;for(let i of e){if("lookupTableAddress"in i)break;let a=k(i.role);P(i.role)?(r++,a||n++):a||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function es(e){let t={};for(let[n,r]of e.entries())t[r.address]=n;return t}function ts(e,t){let n=es(t);return e.map(({accounts:r,data:i,programAddress:a})=>({programAddressIndex:n[a],...r?{accountIndices:r.map(({address:o})=>n[o])}:null,...i?{data:i}:null}))}function ns(e){return "nonce"in e?e.nonce:e.blockhash}function rs(e){let t=e.findIndex(r=>"lookupTableAddress"in r);return (t===-1?e:e.slice(0,t)).map(({address:r})=>r)}function cn(e){let t=Xa(e.feePayer.address,e.instructions),n=Za(t),r=e.lifetimeConstraint;return {...e.version!=="legacy"?{addressTableLookups:Ja(n)}:null,...r?{lifetimeToken:ns(r)}:null,header:Qa(n),instructions:ts(e.instructions,n),staticAccounts:rs(n),version:e.version}}function is(e,t,n){for(let[r,i]of Object.entries(n))for(let a=0;a<i.length;a++)if(e===i[a])return {address:e,addressIndex:a,lookupTableAddress:r,role:t}}function dn(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=[],a=false;for(let o of e.instructions){if(!o.accounts){i.push(o);continue}let s=[],c=false;for(let d of o.accounts){if("lookupTableAddress"in d||!r.has(d.address)||P(d.role)){s.push(d);continue}let u=is(d.address,d.role,t);s.push(Object.freeze(u)),c=true,a=true;}i.push(Object.freeze(c?{...o,accounts:s}:o));}return Object.freeze(a?{...e,instructions:i}:e)}function un(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var os="SysvarRecentB1ockHashes11111111111111111111",as="11111111111111111111111111111111";function ss(e){return e.programAddress===as&&e.data!=null&&cs(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===b.WRITABLE&&e.accounts[1].address===os&&e.accounts[1].role===b.READONLY&&e.accounts[2].address!=null&&P(e.accounts[2].role)}function cs(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function be(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&ss(e.instructions[0])}function In(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function _n(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function ds(e){let t=Object.values(e);if(t.length===0)throw new A(Ie);return t.map(n=>n||new Uint8Array(64).fill(0))}function us(){return S(U(v(H(),64),{size:h()}),ds)}function Pe(){return N([["signatures",us()],["messageBytes",H()]])}function Be(e){let t=cn(e),n=sn().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),i={};for(let o of r)i[o]=null;let a;return rn(e)?a={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:be(e)&&(a={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...a?{lifetimeConstraint:a}:void 0,messageBytes:n,signatures:Object.freeze(i)})}function Fe(e){let t=Pe().encode(e);return q().decode(t)}function An(e,t){Object.freeze(e);let n={...t,feePayer:e};return Object.freeze(n),n}function ve(e){return Object.freeze({address:e,signMessages:n=>Promise.resolve(n.map(()=>Object.freeze({}))),signTransactions:n=>Promise.resolve(n.map(()=>Object.freeze({})))})}var J="ComputeBudget111111111111111111111111111111";var we=2;function ze(){return S(N([["discriminator",M()],["units",X()]]),e=>({...e,discriminator:we}))}function Q(e,t){let n=J,r={...e};return Object.freeze({data:ze().encode(r),programAddress:n})}var ke=3;function xe(){return S(N([["discriminator",M()],["microLamports",Z()]]),e=>({...e,discriminator:ke}))}function ee(e,t){let n=J,r={...e};return Object.freeze({data:xe().encode(r),programAddress:n})}async function Kd(e,t){e.openBlankPopUp();let{instructions:n,signer:r,addressesByLookupTableAddress:i}=t,a=core.prepareTransactionMessage({payer:T(r.walletAddress),instructions:n,addressesByLookupTableAddress:i}),o=window.origin,c={phase:"start",data:{type:"transaction",payload:{transactionMessageBytes:core.bufferToBase64URLString(new Uint8Array(a))}},redirectOrigin:o,signer:r},{rid:d}=await e.onClientAuthorizationCallback(c);return await e.sendPayloadToProvider({rid:d}),await e.onClientAuthorizationCallback({phase:"complete",data:{type:"transaction",rid:d}})}var x="11111111111111111111111111111111";var ln=0,En=1,Rn=2,Tn=3,gn=4,Dn=5,Sn=6,fn=7,Nn=8;process.env.NODE_ENV!=="production"&&({[ln]:"an account with the same address already exists",[Dn]:"provided address does not match addressed derived from seed",[Tn]:"cannot allocate account data of this length",[Rn]:"cannot assign account to this program id",[gn]:"length of requested seed is too long",[fn]:"stored nonce is still in recent_blockhashes",[Sn]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[Nn]:"specified nonce does not match stored nonce",[En]:"account does not have enough SOL to perform the operation"});var We="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";async function NM(e,t){if(t.amount<=0)throw new Error("Transfer amount must be greater than 0");if(!t.destination||typeof t.destination!="string")throw new Error("Destination address is required");e.openBlankPopUp();let{mint:n,tokenProgram:r=We,amount:i,destination:a,signer:o}=t,s=window.origin,d={phase:"start",data:{type:"transaction",payload:{transactionActionType:"transfer_intent",transactionAddress:n?r:x,transactionMessageBytes:core.bufferToBase64URLString(new Uint8Array([...Z().encode(i),...w().encode(T(a)),...w().encode(T(n??x))]))}},redirectOrigin:s,signer:o},{rid:u}=await e.onClientAuthorizationCallback(d);return await e.sendPayloadToProvider({rid:u}),await e.onClientAuthorizationCallback({phase:"complete",data:{type:"transaction",rid:u}})}var B="https://auth.revibase.com",Cn="https://api.revibase.com",On="revibase.com";var mn="9wmtQxMMFWDdeK64QqTs4BK95acdatpbbwDP4csxs3Yn";function Ge(e){if(typeof window>"u")throw new Error("Function can only be called in a browser environment");let t=window.innerWidth||window.screen.availWidth,n=window.innerHeight||window.screen.availHeight,r=t<=768,i,a,o,s;if(r)i=t,a=n,o=0,s=0;else {let d=window.screenLeft??window.screenX??0,u=window.screenTop??window.screenY??0,I=window.innerWidth??document.documentElement.clientWidth??window.screen.width,R=window.innerHeight??document.documentElement.clientHeight??window.screen.height;i=500,a=600,s=Math.round(d+(I-i)/2),o=Math.round(u+(R-a)/2);}let c=["popup=yes",`width=${i}`,`height=${a}`,`top=${o}`,`left=${s}`,"toolbar=no","location=no","status=no","menubar=no","scrollbars=yes","resizable=yes"].join(",");return window.open(e??"","_blank",c)}var pn=class{pending=new Map;onClientAuthorizationCallback;providerOrigin;popUp=null;constructor(t){this.onClientAuthorizationCallback=t.onClientAuthorizationCallback,this.providerOrigin=t.providerOrigin??B;}openBlankPopUp(){if(this.popUp=Ge(),!this.popUp)throw new Error("Popup blocked. Please enable popups.")}async sendPayloadToProvider({rid:t,timeoutMs:n=3e5}){if(typeof window>"u")throw new Error("Provider can only be used in a browser environment");if(this.pending.size>0)throw new Error("An authorization flow is already in progress");let r=new URL(this.providerOrigin);return r.searchParams.set("rid",t),r.searchParams.set("redirectOrigin",window.location.origin),new Promise((i,a)=>{let o=setTimeout(()=>{let s=this.pending.get(t);s&&(s.cancel?s.cancel(new Error("Authentication timed out")):(this.pending.delete(t),a(new Error("Authentication timed out"))));},n);this.pending.set(t,{rid:t,resolve:i,reject:a,timeoutId:o}),this.openWebPopup({startUrl:r.toString(),origin:r.origin,rid:t,timeoutMs:n});})}openWebPopup(t){let{startUrl:n,origin:r,rid:i,timeoutMs:a}=t,o=this.pending.get(i);if(!o)return;let s=this.popUp??null,c=null,d=false,u=false,I=()=>{window.removeEventListener("message",ie);try{c?.close();}catch{}c=null;try{s&&!s.closed&&s.close();}catch{}this.popUp=null,clearInterval(Wn);},R=g=>{d||(d=true,clearTimeout(o.timeoutId),this.pending.delete(i),I(),o.reject(g));},O=()=>{d||(d=true,clearTimeout(o.timeoutId),this.pending.delete(i),I(),o.resolve({rid:i}));};o.cancel=R;let re=()=>{if(!s)s=Ge(n);else try{s.location.href!==n&&s.location.replace(n);}catch{try{s.location.replace(n);}catch{throw new Error("Unable to navigate popup to provider URL")}}if(!s)throw new Error("Popup blocked. Please enable popups.");return s};try{s=re();}catch(g){R(g instanceof Error?g:new Error(String(g)));return}let Wn=setInterval(()=>{s?.closed&&(u||(u=true,R(new Error("Popup was closed by the user"))));},2e3),ie=g=>{if(g.origin!==r||g.source!==s)return;let Ke=g.data;Ke?.type==="popup-connect"&&Ke.rid===i&&g.ports?.[0]&&(c=g.ports[0],c.start(),c.postMessage({type:"popup-init"}),c.onmessage=$e=>{switch($e.data.type){case "popup-complete":O();break;case "popup-error":R(new Error($e.data.error));break;case "popup-closed":{R(new Error("Lost connection with the popup."));break}}},window.removeEventListener("message",ie));};window.addEventListener("message",ie);}};async function hn(e){let t=await fetch(`${e}/getRandomPayer`);if(!t.ok)throw new Error(`Failed to fetch random payer: ${t.status} ${t.statusText}`);let{randomPayer:n}=await t.json();if(!n)throw new Error("Invalid response: randomPayer is missing");return {address:T(n),async signTransactions(r){let i={publicKey:n,transactions:r.map(s=>q().decode(Pe().encode(s)))},a=await fetch(`${e}/sign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok)throw new Error(`Failed to sign transactions: ${a.status} ${a.statusText}`);let o=await a.json();if("error"in o)throw new Error(`Transaction signing failed: ${o.error}`);if(!Array.isArray(o.signatures))throw new Error("Invalid response: signatures must be an array");return o.signatures.map(s=>({[T(n)]:Y().encode(s)}))}}}var ac=___default.default.object({publicKey:___default.default.string(),walletAddress:___default.default.string(),settingsIndexWithAddress:___default.default.object({index:___default.default.number(),settingsAddressTreeIndex:___default.default.number()}),username:___default.default.string(),image:___default.default.string()}),Mn=___default.default.object({phase:___default.default.literal("start"),redirectOrigin:___default.default.string(),signer:ac.optional(),data:___default.default.object({type:___default.default.literal("transaction"),payload:core.TransactionPayloadWithBase64MessageBytesSchema.extend({transactionActionType:core.TransactionActionTypeSchema.optional(),transactionAddress:___default.default.string().optional()})}).strict()}).strict(),yn=___default.default.object({phase:___default.default.literal("complete"),data:___default.default.object({type:___default.default.literal("message"),rid:___default.default.string()})}),Ln=___default.default.object({phase:___default.default.literal("complete"),data:___default.default.object({type:___default.default.literal("transaction"),rid:___default.default.string()})});function Un(e){let t=e.domain?`${e.domain} wants you to sign in with your account.`:"Sign in with your account.",n=[];return e.nonce&&n.push(`Nonce: ${e.nonce}`),n.length>0?`${t}
|
|
6
6
|
|
|
7
7
|
${n.join(`
|
|
8
|
-
`)}`),t}async function k(e,t){let n;if(e.data.payload.additionalInfo.settingsIndexWithAddress)n=e.data.payload.additionalInfo.settingsIndexWithAddress;else {let r=await core.fetchUserAccountData(new core.Secp256r1Key(e.data.payload.signer),e.data.payload.userAddressTreeIndex,t);if(r.delegatedTo.__option==="None")throw Error("User has no delegated wallet");n=r.delegatedTo.value;}return n}function Ln(e,t){let n=ve(An({version:0}),o=>ln(e,o),o=>Rn(Tn(B().decode(crypto.getRandomValues(new Uint8Array(32)))),o),o=>cn({blockhash:Qt().decode(crypto.getRandomValues(new Uint8Array(32))),lastValidBlockHeight:BigInt(Number.MAX_SAFE_INTEGER)},o),o=>t?_n(o,t):o,o=>En([ce({units:8e5}),de({microLamports:1e3})],o),o=>He(o)),r=Ke(n).length;return console.log("Estimated Tx Size: ",r),r>1644*.7}async function Un(e=core.getJitoTipsConfig()){let{getJitoTipsUrl:t,priority:n}=e,o=await(await fetch(t)).json();return Math.round(o[0][n]*10**9)}function x(){return {[D(Mn)]:["ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL","11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s","Sysvar1nstructions1111111111111111111111111","auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg","SysvarS1otHashes111111111111111111111111111","TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb","3C6AdJiD9qxMqZTmB53b5HC5Yfq2Bb57XAzYDzu4YDcj","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY","noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV","cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK","GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy","SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7","35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA","compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT","nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148","amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2","aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F","cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m","6MZszp7ihPjUeoi8RJs9NNC4jBxi7beiqvXHJhxd7fe","smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho","nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X","smt3AFtReRGVcrP11D6bSLEaKdUmrGfaTNowMVccJeu","nfq3de4qt9d3wHxXWy1wcge3EXhid25mCr12bNWFdtV","smt4vjXvdjDFzvRMUxwTWnSy4c7cKkMaHuPrGsdDH7V","nfq4Ncp1vk3mFnCQ9cvwidp9k2L6fxEyCo2nerYD25A","smt5uPaQT9n6b1qAkgyonmzRxtuazA53Rddwntqistc","nfq5b5xEguPtdD6uPetZduyrB5EUqad7gcUE46rALau","smt6ukQDSPPYHSshQovmiRUjG9jGFq2hW9vgrDFk5Yz","nfq6uzaNZ5n3EWF4t64M93AWzLGt5dXTikEA9fFRktv","smt7onMFkvi3RbyhQCMajudYQkB1afAFt9CDXBQTLz6","nfq7yytdKkkLabu1KpvLsa5VPkvCT4jPWus5Yi74HTH","smt8TYxNy8SuhAdKJ8CeLtDkr2w6dgDmdz5ruiDw9Y9","nfq8vExDykci3VUSpj9R1totVst87hJfFWevNK4hiFb","smt9ReAYRF5eFjTd5gBJMn5aKwNRcmp3ub2CQr2vW7j","nfq9KFpNQL45ppP6ZG7zBpUeN18LZrNGkKyvV1kjTX2","smtAvYA5UbTRyKAkAj5kHs1CmrA42t6WkVLi4c6mA1f","nfqAroCRkcZBgsAJDNkptKpsSWyM6cgB9XpWNNiCEC4","2cLqZJrYMuCzKdSZBoWxZ3tXoeCMmMyDiuy6UBaKnbmK","5tgzUZaVtfnnSEBgmBDtJj6PdgYCnA1uaEGEUi3y5Njg"].map(D)}}async function pM(e,t){e.openBlankPopUp();let{instructions:n,signer:r,addressesByLookupTableAddress:o}=t,s=core.prepareTransactionMessage({payer:D(r.walletAddress),instructions:n,addressesByLookupTableAddress:o}),i=Ln(n,o),a=await core.getSettingsFromIndex(r.settingsIndexWithAddress.index),c=window.origin,d={transactionActionType:i?r.hasTxManager?"execute":"create_with_preauthorized_execution":"sync",transactionAddress:a,transactionMessageBytes:core.bufferToBase64URLString(new Uint8Array(s))},u={phase:"start",data:{type:"transaction",payload:d},redirectOrigin:c,signer:r.publicKey},{signature:_}=await e.onClientAuthorizationCallback(u),A=await e.sendPayloadToProvider({payload:u,signature:_});return await e.onClientAuthorizationCallback({...A,data:{...A.data,payload:{...A.data.payload,transactionPayload:d}}})}async function UM(e,t){e.openBlankPopUp();let{mint:n,tokenProgram:r=Ze,amount:o,destination:s,signer:i}=t,a=window.origin,c={transactionActionType:"transfer_intent",transactionAddress:n?r:Y,transactionMessageBytes:core.bufferToBase64URLString(new Uint8Array([...ae().encode(o),...V().encode(D(s)),...V().encode(D(n??Y))]))},d={phase:"start",data:{type:"transaction",payload:c},redirectOrigin:a,signer:i},{signature:u}=await e.onClientAuthorizationCallback(d),_=await e.sendPayloadToProvider({payload:d,signature:u});return await e.onClientAuthorizationCallback({..._,data:{..._.data,payload:{..._.data.payload,transactionPayload:c}}})}function qe(e){if(typeof window>"u")throw new Error("Function can only be called in a browser environment");let t=window.innerWidth||window.screen.availWidth,n=window.innerHeight||window.screen.availHeight,r=t<=768,o,s,i,a;if(r)o=t,s=n,i=0,a=0;else {let d=window.screenLeft??window.screenX??0,u=window.screenTop??window.screenY??0,_=window.innerWidth??document.documentElement.clientWidth??window.screen.width,A=window.innerHeight??document.documentElement.clientHeight??window.screen.height;o=500,s=600,a=Math.round(d+(_-o)/2),i=Math.round(u+(A-s)/2);}let c=["popup=yes",`width=${o}`,`height=${s}`,`top=${i}`,`left=${a}`,"toolbar=no","location=no","status=no","menubar=no","scrollbars=yes","resizable=yes"].join(",");return window.open(e??"","_blank",c)}var Fn=class{pending=new Map;onClientAuthorizationCallback;providerOrigin;providerFetchResultUrl;popUp;constructor(t){this.onClientAuthorizationCallback=t.onClientAuthorizationCallback,this.providerOrigin=t.providerOrigin??ue,this.providerFetchResultUrl=t.providerFetchResultUrl??`${this.providerOrigin}/api/getResult`,this.popUp=null;}openBlankPopUp(){if(this.popUp=qe(),!this.popUp)throw new Error("Popup blocked. Please enable popups.")}async sendPayloadToProvider({payload:t,signature:n,timeoutMs:r=3e5}){if(typeof window>"u")throw new Error("Provider can only be used in a browser environment");if(this.pending.size>0)throw new Error("An authorization flow is already in progress");let o=core.bufferToBase64URLString(crypto.getRandomValues(new Uint8Array(16))),s=new URL(this.providerOrigin);return s.searchParams.set("rid",o),s.searchParams.set("payload",core.bufferToBase64URLString(new TextEncoder().encode(JSON.stringify(t)))),s.searchParams.set("sig",n),new Promise((i,a)=>{let c=setTimeout(()=>{let d=this.pending.get(o);d&&(d.cancel?d.cancel(new Error("Authentication timed out")):(this.pending.delete(o),a(new Error("Authentication timed out"))));},r);this.pending.set(o,{rid:o,resolve:i,reject:a,timeoutId:c}),this.openWebPopup({startUrl:s.toString(),origin:s.origin,rid:o,timeoutMs:r});})}openWebPopup(t){let{startUrl:n,origin:r,rid:o,timeoutMs:s}=t,i=this.pending.get(o);if(!i)return;let a=this.popUp??null,c=null,d=false,u=false,_=false,A=null,T=null,g=null,f=false,S=Date.now()+s,C=()=>{try{g?.abort();}catch{}g=null;},O=()=>{A&&(clearTimeout(A),A=null);},Q=()=>{window.removeEventListener("message",Ae),O(),C();try{c?.close();}catch{}c=null;try{a&&!a.closed&&a.close();}catch{}this.popUp=null,clearInterval(Gn);},m=R=>{d||(d=true,clearTimeout(i.timeoutId),this.pending.delete(o),Q(),i.reject(R));},j=R=>{d||(d=true,clearTimeout(i.timeoutId),this.pending.delete(o),Q(),i.resolve(R));};i.cancel=m;let Ie=()=>{if(!a)a=qe(n);else try{a.location.href!==n&&a.location.replace(n);}catch{try{a.location.replace(n);}catch{throw new Error("Unable to navigate popup to provider URL")}}if(!a)throw new Error("Popup blocked. Please enable popups.");return f=true,a},_e=(R=S)=>d||!f||u?Promise.resolve():T||(T=(async()=>{try{C(),g=new AbortController;let W=await this.pollForResult({rid:o,deadlineMs:R,signal:g.signal});if(d)return;W.status==="complete"?j(W.payload):W.status==="error"&&m(new Error(W.error));}finally{T=null;}})(),T);try{a=Ie();}catch(R){m(R instanceof Error?R:new Error(String(R)));return}A=setTimeout(()=>{d||u||_e().catch(()=>{});},3e3);let Gn=setInterval(()=>{if(!a?.closed||_)return;_=true;let R=Math.min(S,Date.now()+3e4);_e(R).then(()=>{d||m(new Error("User closed the authentication window"));}).catch(()=>m(new Error("User closed the authentication window")));},2e3),Ae=R=>{if(R.origin!==r||R.source!==a)return;let W=R.data;W?.type==="popup-connect"&&W.rid===o&&R.ports?.[0]&&(u=true,O(),C(),c=R.ports[0],c.start(),c.postMessage({type:"popup-init"}),c.onmessage=le=>{switch(le.data.type){case "popup-complete":j(le.data.payload);break;case "popup-error":m(new Error(le.data.error));break;case "popup-closed":{u=false,C();let Vn=Math.min(S,Date.now()+3e4);_e(Vn).then(()=>{d||m(new Error("User closed the authentication window"));}).catch(()=>m(new Error("User closed the authentication window")));break}}},window.removeEventListener("message",Ae));};window.addEventListener("message",Ae);}async pollForResult({rid:t,deadlineMs:n,signal:r}){let o=1e3,s=async()=>{let i=new URL(this.providerFetchResultUrl);i.searchParams.set("rid",t);let a=await fetch(i.toString(),{method:"GET",headers:{accept:"application/json"},signal:r,cache:"no-store",credentials:"omit"});if(!a.ok)return {status:"pending"};let c=null;try{c=await a.json();}catch{return {status:"pending"}}return c?.status==="complete"?{status:"complete",payload:c.payload}:c?.status==="error"?{status:"error",error:String(c.error??"Unknown error")}:{status:"pending"}};for(;Date.now()<n;){if(r?.aborted)return {status:"pending"};try{let c=await s();if(c.status==="complete"||c.status==="error")return c}catch{}let i=n-Date.now(),a=Math.min(o,Math.max(0,i));await new Promise(c=>setTimeout(c,lc(a))),o=Math.min(4e3,Math.round(o*1.7));}return {status:"timeout"}}};function lc(e,t=.3){let n=e*t,r=e+(Math.random()*2-1)*n;return Math.max(0,Math.round(r))}async function X(e){let t=await fetch(`${e}/getRandomPayer`),{randomPayer:n}=await t.json();return {address:D(n),async signTransactions(r){let o={publicKey:n,transactions:r.map(a=>re().decode(Ve().encode(a)))},i=await(await fetch(`${e}/sign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).json();if("error"in i)throw new Error(i.error);return i.signatures.map(a=>({[D(n)]:ne().encode(a)}))}}}async function vn(e,t,n){let{transactionActionType:r,transactionMessageBytes:o}=e.data.payload.transactionPayload;if(r!=="execute"&&r!=="create_with_preauthorized_execution")throw new Error("Transaction Action not allowed.");let s=core.createClientAuthorizationCompleteRequestChallenge(e),i=N().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(s)))),a={...e.data.payload,clientSignature:{...e.data.payload.clientSignature,signature:i}},c=new Map,d=await k(e,c),[u,_,A,T]=await Promise.all([n??await X($),core.fetchSettingsAccountData(d.index,d.settingsAddressTreeIndex,c),core.getSignedSecp256r1Key(a),Un()]),{transactionManagerAddress:g,userAddressTreeIndex:f}=core.retrieveTransactionManager(e.data.payload.signer,_),S=await core.getSignedTransactionManager({authResponses:[a],transactionManagerAddress:g,transactionMessageBytes:new Uint8Array(core.base64URLStringToBuffer(o)),userAddressTreeIndex:f,cachedAccounts:c}),C=await core.prepareTransactionBundle({compressed:_.isCompressed,index:d.index,settingsAddressTreeIndex:d.settingsAddressTreeIndex,transactionMessageBytes:new Uint8Array(core.base64URLStringToBuffer(o)),creator:S??A,executor:S?A:void 0,jitoBundlesTipAmount:T,payer:u,cachedAccounts:c});return core.signAndSendBundledTransactions(C.map(O=>({...O,addressesByLookupTableAddress:O.addressesByLookupTableAddress?{...O.addressesByLookupTableAddress,...x()}:x()})))}async function wn(e,t=ue,n=hn){let{payload:r}=e.data,o=r.message,s=core.createMessageChallenge(o,r.clientSignature.clientOrigin,r.deviceSignature.publicKey,r.nonce),{verified:i}=await server.verifyAuthenticationResponse({response:r.authResponse,expectedChallenge:core.bufferToBase64URLString(s),expectedRPID:n,expectedOrigin:t,requireUserVerification:false,credential:{counter:0,id:r.authResponse.id,publicKey:core.convertPubkeyCompressedToCose(r.signer)}});if(!i)throw new Error("Unable to verify message");let a=await k(e),c=await core.getWalletAddressFromIndex(a.index),u=(await core.fetchSettingsAccountData(a.index,a.settingsAddressTreeIndex)).members.some(A=>A.role===core.UserRole.TransactionManager);return {publicKey:r.signer,walletAddress:c,settingsIndexWithAddress:a,hasTxManager:u,...r.additionalInfo}}async function kn(e,t,n){let{transactionActionType:r,transactionMessageBytes:o}=e.data.payload.transactionPayload;if(r!=="sync")throw new Error("Transaction Action not allowed.");let s=core.createClientAuthorizationCompleteRequestChallenge(e),i=N().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(s)))),a={...e.data.payload,clientSignature:{...e.data.payload.clientSignature,signature:i}},c=new Map,d=await k(e,c),[u,_,A]=await Promise.all([n??await X($),core.fetchSettingsAccountData(d.index,d.settingsAddressTreeIndex,c),core.getSignedSecp256r1Key(a)]),{transactionManagerAddress:T,userAddressTreeIndex:g}=core.retrieveTransactionManager(e.data.payload.signer,_),f=await core.getSignedTransactionManager({authResponses:[a],transactionManagerAddress:T,transactionMessageBytes:new Uint8Array(core.base64URLStringToBuffer(o)),userAddressTreeIndex:g,cachedAccounts:c}),S=f?[A,f]:[A],{instructions:C,addressesByLookupTableAddress:O}=await core.prepareTransactionSync({compressed:_.isCompressed,signers:S,payer:u,transactionMessageBytes:new Uint8Array(core.base64URLStringToBuffer(o)),index:d.index,settingsAddressTreeIndex:d.settingsAddressTreeIndex,cachedAccounts:c});return core.signAndSendTransaction({instructions:C,payer:u,addressesByLookupTableAddress:O?{...O,...x()}:x()})}async function xn(e,t,n){let{transactionActionType:r,transactionMessageBytes:o,transactionAddress:s}=e.data.payload.transactionPayload;if(r!=="transfer_intent")throw new Error("Transaction Action not allowed.");let i=core.createClientAuthorizationCompleteRequestChallenge(e),a=N().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(i)))),c={...e.data.payload,clientSignature:{...e.data.payload.clientSignature,signature:a}},d=new Uint8Array(core.base64URLStringToBuffer(o)),u=Pe().decode(d.slice(0,8)),_=B().decode(d.slice(8,40)),A=B().decode(d.slice(40,72)),T=new Map,g=await k(e,T),[f,S,C]=await Promise.all([n??await X($),core.fetchSettingsAccountData(g.index,g.settingsAddressTreeIndex,T),core.getSignedSecp256r1Key(c)]),{transactionManagerAddress:O,userAddressTreeIndex:Q}=core.retrieveTransactionManager(e.data.payload.signer,S),m=await core.getSignedTransactionManager({authResponses:[c],transactionManagerAddress:O,userAddressTreeIndex:Q,cachedAccounts:T}),j=m?[C,m]:[C],Ie=A!==Y?await core.tokenTransferIntent({payer:f,index:g.index,settingsAddressTreeIndex:g.settingsAddressTreeIndex,amount:u,signers:j,destination:_,mint:A,tokenProgram:D(s),compressed:S.isCompressed,cachedAccounts:T}):await core.nativeTransferIntent({payer:f,index:g.index,settingsAddressTreeIndex:g.settingsAddressTreeIndex,amount:u,signers:j,destination:_,compressed:S.isCompressed,cachedAccounts:T});return core.signAndSendTransaction({instructions:Ie,payer:f,addressesByLookupTableAddress:x()})}async function Cy(e,t,n,r,o){if(e.phase==="start"){let{data:i}=e;if(i.type==="message"){let a=i.payload??yn({nonce:crypto.randomUUID()}),c=core.createClientAuthorizationStartRequestChallenge({...e,data:{...i,payload:a}});return {signature:N().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(c)))),message:a}}else {let a=core.createClientAuthorizationStartRequestChallenge(e);return {signature:N().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(a))))}}}if(e.data.type==="message")return {user:await wn({data:e.data},r,o)};let{transactionActionType:s}=e.data.payload.transactionPayload;if(s==="transfer_intent")return {txSig:await xn({phase:"complete",data:e.data},t,n)};if(s==="sync")return {txSig:await kn({phase:"complete",data:e.data},t,n)};if(s==="execute"||s==="create_with_preauthorized_execution")return {txSig:await vn({phase:"complete",data:e.data},t,n)};throw new Error("Transaction action type not allowed.")}Object.defineProperty(exports,"initialize",{enumerable:true,get:function(){return core.initialize}});exports.RevibaseProvider=Fn;exports.executeTransaction=pM;exports.getRandomPayer=X;exports.processClientAuthCallback=Cy;exports.signIn=Kc;exports.transferTokens=UM;//# sourceMappingURL=index.cjs.map
|
|
8
|
+
`)}`:t}async function te(e,t){let{additionalInfo:n}=e.data.payload;if(n.settingsIndexWithAddress)return n.settingsIndexWithAddress;let r=await core.fetchUserAccountData(new core.Secp256r1Key(e.data.payload.signer),e.data.payload.userAddressTreeIndex,t);if(r.delegatedTo.__option==="None")throw new Error("User has no delegated wallet");return r.delegatedTo.value}async function bn({payer:e,index:t,settingsAddressTreeIndex:n,transactionMessageBytes:r,signers:i,compressed:a,addressesByLookupTableAddress:o,cachedAccounts:s}){let c=await core.prepareTransactionSync({payer:e,index:t,settingsAddressTreeIndex:n,transactionMessageBytes:r,signers:i,compressed:a,simulateProof:true,addressesByLookupTableAddress:o,cachedAccounts:s}),d=pe(un({version:0}),I=>In(c.instructions,I),I=>An(c.payer,I),I=>on({blockhash:Xt().decode(crypto.getRandomValues(new Uint8Array(32))),lastValidBlockHeight:BigInt(Number.MAX_SAFE_INTEGER)},I),I=>c.addressesByLookupTableAddress?dn(I,c.addressesByLookupTableAddress):I,I=>_n([Q({units:8e5}),ee({microLamports:1e3})],I),I=>Be(I)),u=Fe(d).length;return console.log("Estimated Tx Size: ",u),u>1644}function Pn(){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:f().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 Bn(e=core.getJitoTipsConfig()){let{getJitoTipsUrl:t,priority:n}=e,r=await fetch(t);if(!r.ok)throw new Error(`Failed to fetch Jito tips: ${r.status} ${r.statusText}`);let i=await r.json();if(!Array.isArray(i)||!i[0]||typeof i[0][n]!="number")throw new Error("Invalid Jito tips response format");return Math.round(i[0][n]*1e9)}function F(){return {[T(mn)]:["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(T)}}async function Dc(e,t){let n=core.createClientAuthorizationCompleteRequestChallenge(e),r=p().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(n))));return {...e.data.payload,clientSignature:{...e.data.payload.clientSignature,signature:r}}}async function W(e,t,n){let r=await Dc(e,t),i=new Map,a=await te(e,i),[o,s,c]=await Promise.all([n??await hn(Cn),core.fetchSettingsAccountData(a.index,a.settingsAddressTreeIndex,i),core.getSignedSecp256r1Key(r)]),{transactionManagerAddress:d,userAddressTreeIndex:u}=core.retrieveTransactionManager(e.data.payload.signer,s),I=new Uint8Array(core.base64URLStringToBuffer(e.data.payload.transactionPayload.transactionMessageBytes)),R=await core.getSignedTransactionManager({authResponses:[r],transactionManagerAddress:d,transactionMessageBytes:I,userAddressTreeIndex:u,cachedAccounts:i});return {settingsIndexWithAddress:a,settingsData:s,signedSigner:c,transactionManagerSigner:R,payer:o}}function ne(e,t){return t?[e,t]:[e]}async function Fn(e,t,n){let{transactionActionType:r,transactionMessageBytes:i}=e.data.payload.transactionPayload;if(r!=="execute"&&r!=="create_with_preauthorized_execution")throw new Error("Transaction action type must be 'execute' or 'create_with_preauthorized_execution'");let a=await W(e,t,n),[o]=await Promise.all([Bn()]),s=new Uint8Array(core.base64URLStringToBuffer(i)),c=new Map,d=await core.prepareTransactionBundle({compressed:a.settingsData.isCompressed,index:a.settingsIndexWithAddress.index,settingsAddressTreeIndex:a.settingsIndexWithAddress.settingsAddressTreeIndex,transactionMessageBytes:s,creator:a.transactionManagerSigner??a.signedSigner,executor:a.transactionManagerSigner?a.signedSigner:void 0,jitoBundlesTipAmount:o,payer:a.payer,cachedAccounts:c}),u=F(),I=d.map(O=>({...O,addressesByLookupTableAddress:O.addressesByLookupTableAddress?{...O.addressesByLookupTableAddress,...u}:u})),R=await core.signAndSendBundledTransactions(I);return core.pollJitoBundleConfirmation(R)}async function vn({rid:e,privateKey:t,providerOrigin:n=B}){let r=p().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},t,new Uint8Array(zt().encode(e))))),i=await fetch(`${n}/getResult`,{method:"POST",body:JSON.stringify({rid:e,signature:r})});if(!i.ok)throw new Error((await i.json()).error);return await i.json()}async function wn(e,t=B,n=On){let{payload:r}=e.data,i=r.message,a=core.createMessageChallenge(i,r.clientSignature.clientOrigin,r.deviceSignature.publicKey,r.nonce),{verified:o}=await server.verifyAuthenticationResponse({response:r.authResponse,expectedChallenge:core.bufferToBase64URLString(a),expectedRPID:n,expectedOrigin:t,requireUserVerification:false,credential:{counter:0,id:r.authResponse.id,publicKey:core.convertPubkeyCompressedToCose(r.signer)}});if(!o)throw new Error("WebAuthn message verification failed");let s=await te(e),c=await core.getWalletAddressFromIndex(s.index);return {publicKey:r.signer,walletAddress:c,settingsIndexWithAddress:s,...r.additionalInfo}}async function He({privateKey:e,request:t,providerOrigin:n=B}){let r=core.createClientAuthorizationStartRequestChallenge(t),i=p().decode(new Uint8Array(await crypto.subtle.sign({name:"Ed25519"},e,new Uint8Array(r)))),a=await fetch(`${n}/startRequest`,{method:"POST",body:JSON.stringify({signature:i,request:t})});if(!a.ok)throw new Error((await a.json()).error);return await a.json()}async function zn(e,t,n){let{transactionActionType:r,transactionMessageBytes:i}=e.data.payload.transactionPayload;if(r!=="sync")throw new Error("Transaction action type must be 'sync'");let a=await W(e,t,n),o=ne(a.signedSigner,a.transactionManagerSigner),s=new Uint8Array(core.base64URLStringToBuffer(i)),c=new Map,{instructions:d,addressesByLookupTableAddress:u}=await core.prepareTransactionSync({compressed:a.settingsData.isCompressed,signers:o,payer:a.payer,transactionMessageBytes:s,index:a.settingsIndexWithAddress.index,settingsAddressTreeIndex:a.settingsIndexWithAddress.settingsAddressTreeIndex,cachedAccounts:c}),I=F(),R=u?{...u,...I}:I;return core.signAndSendTransaction({instructions:d,payer:a.payer,addressesByLookupTableAddress:R})}async function kn(e,t,n){let{transactionActionType:r,transactionMessageBytes:i,transactionAddress:a}=e.data.payload.transactionPayload;if(r!=="transfer_intent")throw new Error("Transaction action type must be 'transfer_intent'");let o=await W(e,t,n),s=new Uint8Array(core.base64URLStringToBuffer(i)),c=Ce().decode(s.slice(0,8)),d=f().decode(s.slice(8,40)),u=f().decode(s.slice(40,72)),I=ne(o.signedSigner,o.transactionManagerSigner),R=new Map,O=u!==x?await core.tokenTransferIntent({payer:o.payer,index:o.settingsIndexWithAddress.index,settingsAddressTreeIndex:o.settingsIndexWithAddress.settingsAddressTreeIndex,amount:c,signers:I,destination:d,mint:u,tokenProgram:T(a),compressed:o.settingsData.isCompressed,cachedAccounts:R}):await core.nativeTransferIntent({payer:o.payer,index:o.settingsIndexWithAddress.index,settingsAddressTreeIndex:o.settingsIndexWithAddress.settingsAddressTreeIndex,amount:c,signers:I,destination:d,compressed:o.settingsData.isCompressed,cachedAccounts:R});return core.signAndSendTransaction({instructions:O,payer:o.payer,addressesByLookupTableAddress:F()})}async function wy({request:e,privateKey:t,feePayer:n,providerOrigin:r,rpId:i}){let a=___default.default.union([Mn,core.StartMessageRequestSchema,Ln,yn]).parse(e);if(a.phase==="start"){let{data:d,signer:u}=a;if(d.type==="message"){let O=d.payload??Un({nonce:crypto.randomUUID()}),re={...a,signer:xn(a),data:{...d,payload:O}};return await He({request:re,privateKey:t,providerOrigin:r})}if(d.type!=="transaction")throw new Error(`Unsupported request type: ${d.type}`);if(!u||typeof u!="object"||!("settingsIndexWithAddress"in u))throw new Error("Transaction start request requires a User signer object");let{transactionPayload:I}=await Vc(d,u),R={phase:"start",redirectOrigin:a.redirectOrigin,signer:xn(a),data:{type:"transaction",payload:I}};return await He({request:R,providerOrigin:r,privateKey:t})}let o=await vn({rid:a.data.rid,providerOrigin:r,privateKey:t});if(o.data.type==="message")return {user:await wn({data:o.data},r,i)};let{transactionActionType:s}=o.data.payload.transactionPayload,c={phase:"complete",data:o.data};switch(s){case "transfer_intent":return {txSig:await kn(c,t,n)};case "sync":return {txSig:await zn(c,t,n)};case "execute":case "create_with_preauthorized_execution":return {txSig:await Fn(c,t,n)};default:throw new Error(`Unsupported transaction action type: ${s}`)}}function xn(e){return e.signer?typeof e.signer=="string"?e.signer:e.signer.publicKey:void 0}async function Vc(e,t){if(!e.payload||typeof e.payload!="object")throw new Error("Invalid transaction payload: payload must be an object");if(!e.payload.transactionMessageBytes||typeof e.payload.transactionMessageBytes!="string")throw new Error("Invalid transaction payload: transactionMessageBytes is required and must be a string");if(e.payload.transactionAddress&&e.payload.transactionActionType)return {transactionPayload:e.payload};if(!t.settingsIndexWithAddress||typeof t.settingsIndexWithAddress!="object")throw new Error("Invalid signer: settingsIndexWithAddress is required");let n=e.payload,r=t.settingsIndexWithAddress,i;try{i=new Uint8Array(core.base64URLStringToBuffer(n.transactionMessageBytes));}catch(I){throw new Error(`Invalid transaction message bytes: ${I instanceof Error?I.message:"Failed to decode base64"}`)}let[a,o]=await Promise.all([core.fetchSettingsAccountData(r.index,r.settingsAddressTreeIndex),core.getSettingsFromIndex(r.index)]),s=a.members.find(I=>I.role===core.UserRole.TransactionManager),d=await bn({signers:[Pn(),...s?[ve(f().decode(s.pubkey.key))]:[]],compressed:a.isCompressed,payer:ve(f().decode(crypto.getRandomValues(new Uint8Array(32)))),index:r.index,settingsAddressTreeIndex:r.settingsAddressTreeIndex,transactionMessageBytes:i,addressesByLookupTableAddress:F()})?s?"execute":"create_with_preauthorized_execution":"sync";return {transactionPayload:{transactionMessageBytes:n.transactionMessageBytes,transactionActionType:d,transactionAddress:o.toString()}}}Object.defineProperty(exports,"initialize",{enumerable:true,get:function(){return core.initialize}});exports.CompleteMessageRequestSchema=yn;exports.CompleteTransactionRequestSchema=Ln;exports.RevibaseProvider=pn;exports.StartTransactionRequestWithOptionalTypeSchema=Mn;exports.UserSchema=ac;exports.executeTransaction=Kd;exports.getRandomPayer=hn;exports.processClientAuthCallback=wy;exports.signIn=Hc;exports.transferTokens=NM;//# sourceMappingURL=index.cjs.map
|
|
9
9
|
//# sourceMappingURL=index.cjs.map
|