@wormhole-foundation/wormhole-connect 0.3.17 → 0.3.18-beta.0-development
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/assets/{ccip-ClzeMJ_j.js → ccip-Dkj0_PH1.js} +1 -1
- package/dist/assets/{evm-naJ7fLYH.js → evm-BDi9bPHV.js} +31 -31
- package/dist/assets/{index-IW_wClRI.js → index-BYhDDvwO.js} +1 -1
- package/dist/assets/index-CiEQK8J0.js +2 -0
- package/dist/assets/{index.es-EmnxJ1lb.js → index.es-D2AQfZFz.js} +2 -2
- package/dist/main.js +3 -3
- package/dist/src/utils/wallet/evm.d.ts.map +1 -1
- package/lib/{algorand-CkjY5D1K.mjs → algorand-DQDPJ26a.mjs} +4 -4
- package/lib/{algorand-DDnN_ID4.js → algorand-DVFRLYKg.js} +1 -1
- package/lib/{aptos-Z3iITKq8.mjs → aptos-4Buk4ifX.mjs} +4 -4
- package/lib/{aptos-6cTTvSk4.mjs → aptos-CUMbFUEx.mjs} +1 -1
- package/lib/{aptos-DB0RPcha.js → aptos-Cl1IkOfq.js} +2 -2
- package/lib/{aptos-D9ca5jNq.js → aptos-DvZHyaGi.js} +1 -1
- package/lib/{browser-AXXShtLO.mjs → browser-D7Z49wZ4.mjs} +2 -2
- package/lib/{browser-BvtYqM0e.js → browser-qdNhrgkB.js} +1 -1
- package/lib/{ccip-B52yS2oB.mjs → ccip-5tJ4iGbd.mjs} +1 -1
- package/lib/{ccip-Dp5-rp5Q.js → ccip-BKmEJ0zH.js} +1 -1
- package/lib/{chain-D9bp2EtQ.mjs → chain-B1FOQWsW.mjs} +1 -1
- package/lib/{chain-CPTe1tkD.js → chain-y7sg4yrp.js} +1 -1
- package/lib/{cosmos-BSz_B76G.mjs → cosmos-DW-Gxe0a.mjs} +6 -6
- package/lib/cosmos-DdK2yQGY.js +37 -0
- package/lib/{cosmwasm-CaHs2sxc.mjs → cosmwasm-Bh0-_wDY.mjs} +6 -6
- package/lib/{cosmwasm-Cv8Wo8qx.js → cosmwasm-CStFJLHq.js} +2 -2
- package/lib/{create-QAfMcr9_.js → create-BKtLWPjt.js} +1 -1
- package/lib/{create-BoVtddSH.mjs → create-B_LDrlra.mjs} +1 -1
- package/lib/{ens-validation.es6-ww_x-SMH.js → ens-validation.es6-B-mETPjs.js} +1 -1
- package/lib/{ens-validation.es6-DfAlPWse.mjs → ens-validation.es6-Cia-mNrr.mjs} +2 -2
- package/lib/{evm-BhVYgjXc.js → evm-CAQWUINN.js} +29 -29
- package/lib/{evm-DT3j3aq9.mjs → evm-CU-B8toy.mjs} +6 -6
- package/lib/{evm-CoPf1imE.js → evm-D0eVTsjc.js} +2 -2
- package/lib/{evm-CBuTwR-T.mjs → evm-DHOCCyVW.mjs} +1734 -1717
- package/lib/{index-gQ5agivz.mjs → index-B0L8gSK7.mjs} +4 -4
- package/lib/{index-2REgoevm.mjs → index-B1m57rRr.mjs} +2 -2
- package/lib/{index-DHpMqzxK.mjs → index-BGs-r2zq.mjs} +2 -2
- package/lib/{index-Bgifa0rO.js → index-BJoVvo22.js} +1 -1
- package/lib/index-BPu5tyJL.js +3 -0
- package/lib/{index-BGdIdofx.js → index-BQG8FYaZ.js} +1 -1
- package/lib/{index-C4CEddS7.mjs → index-BUmh6veA.mjs} +6 -6
- package/lib/{index-CKWTloVb.js → index-BXA5PZNU.js} +1 -1
- package/lib/{index-CZvnNuux.js → index-BZQPVPp1.js} +1 -1
- package/lib/{index-COMtOf9F.mjs → index-BgeAXYll.mjs} +3 -3
- package/lib/{index-BVYQzNvU.mjs → index-BoQrBK1v.mjs} +4 -4
- package/lib/{index-DebiDC3v.mjs → index-BsbdJZ3C.mjs} +86 -88
- package/lib/{index-DAGHPE-U.mjs → index-Bt_H55hU.mjs} +4 -4
- package/lib/{index-D6BOvMee.mjs → index-Bv2LxtBn.mjs} +4 -4
- package/lib/{index-Bxy33sJ9.js → index-BwXnmYxY.js} +1 -1
- package/lib/{index-D7PEJvME.mjs → index-C4Fm85ru.mjs} +5 -5
- package/lib/{index-3Zvo5oFL.mjs → index-C4_Mkq6F.mjs} +4 -4
- package/lib/{index-BH2yQPAH.js → index-C990TILJ.js} +1 -1
- package/lib/{index-CHReo22c.js → index-CGQQm-uD.js} +1 -1
- package/lib/{index-Qf6KscPe.js → index-CLTi6Axr.js} +1 -1
- package/lib/{index-Bem-zTo9.mjs → index-CRZAVeIL.mjs} +4 -4
- package/lib/{index-0QeIkLNc.mjs → index-CRb6g19u.mjs} +3 -3
- package/lib/{index-B6-c6P4Q.js → index-CczdQqB1.js} +1 -1
- package/lib/{index-D8KRWXVM.js → index-CerXrspf.js} +1 -1
- package/lib/{index-CZTcbGX2.mjs → index-CfV2repP.mjs} +4 -4
- package/lib/{index-B0l5_Q9J.js → index-Cl0Q32gB.js} +1 -1
- package/lib/{index-B2vcAnwF.mjs → index-Clfmas--.mjs} +5 -5
- package/lib/{index-GVnr7WyU.mjs → index-CnejtY47.mjs} +4 -4
- package/lib/{index-s1ZuI8l6.js → index-CyXba-yP.js} +1 -1
- package/lib/{index-DvPjni-v.js → index-D1bcMAs6.js} +8 -8
- package/lib/{index-TwqQtaM2.js → index-D1bwJjqp.js} +1 -1
- package/lib/{index-DApVqEXu.js → index-D7N3abQJ.js} +1 -1
- package/lib/{index-DfM7GTS8.js → index-DNiXK70O.js} +1 -1
- package/lib/{index-C3Zck5Rw.js → index-DRZymJsG.js} +1 -1
- package/lib/{index-5hwKi82D.mjs → index-DSkKbEm6.mjs} +4 -4
- package/lib/index-DTJXuc64.js +1 -0
- package/lib/{index-1Eo1l_aF.mjs → index-DZxCgz6D.mjs} +3 -3
- package/lib/{index-CCGipVdX.js → index-DgOzoVuQ.js} +1 -1
- package/lib/{index-BdEy6H3x.mjs → index-DnsX0bqc.mjs} +4 -4
- package/lib/{index-Bb-fizMd.mjs → index-DugpMXHv.mjs} +5 -5
- package/lib/{index-CbulvJtP.mjs → index-Dy60c9bL.mjs} +72 -72
- package/lib/{index-BkJT27UH.mjs → index-DyuvKSii.mjs} +2 -2
- package/lib/{index-pSA89lvn.js → index-OPTA8sRP.js} +1 -1
- package/lib/{index-jbKWljQq.js → index-UneRjAxx.js} +1 -1
- package/lib/{index-Vz6yRzMm.js → index-d2eR5hEX.js} +1 -1
- package/lib/{index-BuGANYoC.mjs → index-gmV4k3Io.mjs} +1 -1
- package/lib/{index.es-Be-95F-D.js → index.es-D0De3MOj.js} +2 -2
- package/lib/{index.es-DY974klV.mjs → index.es-DcCpnayP.mjs} +4 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-Cz4RSKFI.js → libsodium-wrappers-BgNKJA-N.js} +1 -1
- package/lib/{libsodium-wrappers-DdBVKoIT.mjs → libsodium-wrappers-D-Q49aE_.mjs} +1 -1
- package/lib/{sei-549wQo5R.mjs → sei-BoViQvrz.mjs} +2 -2
- package/lib/{sei-gjedWqjd.js → sei-DgZ6J40I.js} +1 -1
- package/lib/{solana-BTT9n5lW.js → solana-Bdi1CyTf.js} +1 -1
- package/lib/{solana-CLvKWwns.mjs → solana-Cj-WXpIF.mjs} +3 -3
- package/lib/{solana-jJHTew4W.js → solana-DWLxhhWn.js} +2 -2
- package/lib/{solana-BpvtC9Y9.mjs → solana-W4XruJeE.mjs} +6 -6
- package/lib/{solanaEmbed.esm-Bqx3MQQh.mjs → solanaEmbed.esm-CKfg1ioH.mjs} +2 -2
- package/lib/{solanaEmbed.esm-D-AOxyK6.js → solanaEmbed.esm-WXkst5_I.js} +1 -1
- package/lib/src/utils/wallet/evm.d.ts.map +1 -1
- package/lib/{sui-B-4YWOEj.js → sui-4Ygokvkl.js} +2 -2
- package/lib/{sui-DCCGAsfg.mjs → sui-BwXBW1lD.mjs} +1 -1
- package/lib/{sui-DYHKoyiY.js → sui-DFQxJJBA.js} +1 -1
- package/lib/{sui-DKRldaWr.mjs → sui-fzNqSygY.mjs} +4 -4
- package/lib/{unsignedTransaction-Cs6URPzx.js → unsignedTransaction-BcitBDHn.js} +1 -1
- package/lib/{unsignedTransaction-Byv6FNac.mjs → unsignedTransaction-Bh0f0Mvb.mjs} +2 -2
- package/package.json +1 -1
- package/dist/assets/index-CZxcLdx-.js +0 -2
- package/lib/cosmos-DQcVb2Ho.js +0 -37
- package/lib/index--52-Qo6j.js +0 -3
- package/lib/index-DzCniKbo.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ir=Object.defineProperty;var xr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>(xr(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index-DvPjni-v.js"),S=require("./sui-B-4YWOEj.js");require("./index-CZvnNuux.js");const Ar=require("./chain-CPTe1tkD.js");class _r{constructor(t,r,n,i,s=!1){V(this,"transaction");V(this,"network");V(this,"chain");V(this,"description");V(this,"parallelizable");this.transaction=t,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function Br(e){return K(e)&&typeof e[Symbol.iterator]=="function"}function K(e){return typeof e=="object"&&e!=null}function J(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function $r(e){const{done:t,value:r}=e.next();return t?void 0:r}function Ur(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Vt(e,t,r,n){Br(e)||(e=[e]);for(const i of e){const s=Ur(i,t,r,n);s&&(yield s)}}function*ut(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&K(t.schema)&&K(e)&&!Array.isArray(e)))for(const d in e)t.schema[d]===void 0&&delete e[d];let c="valid";for(const d of t.validator(e,a))d.explanation=r.message,c="not_valid",yield[d,void 0];for(let[d,l,g]of t.entries(e,a)){const m=ut(l,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const y of m)y[0]?(c=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(l=y[1],d===void 0?e=l:e instanceof Map?e.set(d,l):e instanceof Set?e.add(l):K(e)&&(l!==void 0||d in e)&&(e[d]=l))}if(c!=="not_valid")for(const d of t.refiner(e,a))d.explanation=r.message,c="not_refined",yield[d,void 0];c==="valid"&&(yield[void 0,e])}class te{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,d)=>{const l=i(c,d);return Vt(l,d,this,c)}:this.validator=()=>[],s?this.refiner=(c,d)=>{const l=s(c,d);return Vt(l,d,this,c)}:this.refiner=()=>[]}assert(t,r){return tt(t,this,r)}create(t,r){return Kt(t,this,r)}is(t){return L(t,this)}mask(t,r){return Jt(t,this,r)}validate(t,r={}){return Ie(t,this,r)}}function tt(e,t,r){const n=Ie(e,t,{message:r});if(n[0])throw n[0]}function Kt(e,t,r){const n=Ie(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Jt(e,t,r){const n=Ie(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(e,t){return!Ie(e,t)[0]}function Ie(e,t,r={}){const n=ut(e,t,r),i=$r(n);return i[0]?[new Cr(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function je(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Rr(n):p(n)}function W(e,t){return new te({type:e,schema:null,validator:t})}function rt(){return W("any",()=>!0)}function E(e){return new te({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${J(t)}`}})}function Mr(){return W("bigint",e=>typeof e=="bigint")}function z(){return W("boolean",e=>typeof e=="boolean")}function ee(){return W("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${J(e)}`)}function v(e){const t=J(e),r=typeof e;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${J(n)}`}})}function qt(){return W("never",()=>!1)}function $(e){return new te({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function le(){return W("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${J(e)}`)}function p(e){const t=e?Object.keys(e):[],r=qt();return new te({type:"object",schema:e||null,*entries(n){if(e&&K(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function T(e){return new te({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Q(e,t){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",e=>typeof e=="string"||`Expected a string, but received: ${J(e)}`)}function Ht(e){const t=qt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(e){const t=Object.keys(e);return new te({type:"type",schema:e,*entries(r){if(K(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(e){const t=e.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=ut(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${J(r)}`,...i]}})}function Xt(){return W("unknown",()=>!0)}const dt=U([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),v("Immutable")]);W("SuiJsonValue",()=>!0);const Pr=U([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Pr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});U([h(),v("package")]);const oe=p({digest:h(),objectId:h(),version:U([le(),h(),Mr()])});p({owner:dt,reference:oe});p({objectId:h(),sequenceNumber:h()});p({payment:E(oe),owner:h(),price:h(),budget:h()});const Nr=je(oe,p({type:h(),owner:dt,previousTransaction:h()})),Dr=Q(h(),rt()),zr=Q(h(),Xt()),Vr=p({type:h(),fields:Dr,hasPublicTransfer:z()}),Fr=p({disassembled:zr}),Gr=U([je(Vr,p({dataType:v("moveObject")})),je(Fr,p({dataType:v("package")}))]),Lr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Wr=p({id:h(),moduleMap:Q(h(),h())}),Kr=U([je(Lr,p({dataType:v("moveObject")})),je(Wr,p({dataType:v("package")}))]);BigInt(1e9);const Zt=p({code:h(),error:T(h()),object_id:T(h()),parent_object_id:T(h()),version:T(h()),digest:T(h())}),Jr=p({data:$(T(Q(h(),h()))),error:$(T(Zt))}),qr=U([Jr,T(Q(h(),h()))]),Yt=p({objectId:h(),version:h(),digest:h(),type:$(T(h())),content:$(T(Gr)),bcs:$(T(Kr)),owner:$(T(dt)),previousTransaction:$(T(h())),storageRebate:$(T(h())),display:$(T(qr))});p({showType:$(T(z())),showContent:$(T(z())),showBcs:$(T(z())),showOwner:$(T(z())),showPreviousTransaction:$(T(z())),showStorageRebate:$(T(z())),showDisplay:$(T(z()))});U([v("Exists"),v("notExists"),v("Deleted")]);E(Nr);const Hr=p({data:$(T(Yt)),error:$(T(Zt))});function Xr(e){return e.data}function Zr(e){if(e.error&&"object_id"in e.error&&"version"in e.error&&"digest"in e.error){const t=e.error;return{objectId:t.object_id,version:t.version,digest:t.digest}}}function Ft(e){if("reference"in e)return e.reference;const t=Xr(e);return t?{objectId:t.objectId,version:t.version,digest:t.digest}:Zr(e)}p({objectId:h(),atCheckpoint:T(le())});p({data:E(Hr),nextCursor:T($(h())),hasNextPage:z()});U([p({details:Yt,status:v("VersionFound")}),p({details:h(),status:v("ObjectNotExists")}),p({details:oe,status:v("ObjectDeleted")}),p({details:Ht([h(),le()]),status:v("VersionNotFound")}),p({details:p({asked_version:le(),latest_version:le(),object_id:h()}),status:v("VersionTooHigh")})]);const Yr=U([h(),p({Object:h()})]);E(Yr);const Qr=p({address:h(),name:h()}),en=U([v("Private"),v("Public"),v("Friend")]),lt=p({abilities:E(h())}),tn=p({constraints:lt,isPhantom:z()}),rn=p({TypeParameter:le()}),qe=Ht([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(qe),rank7Days:E(qe),rank30Days:E(qe)});function Qt(e){if(!e)return!1;if(typeof e=="string"||L(e,rn)||er(e))return!0;if(typeof e!="object")return!1;const t=e;return!!(L(t.Reference,pe)||L(t.MutableReference,pe)||L(t.Vector,pe))}const pe=W("SuiMoveNormalizedType",Qt);function er(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.Struct||typeof t.Struct!="object")return!1;const r=t.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>Qt(n)))}W("SuiMoveNormalizedStructType",er);const nn=p({visibility:en,isEntry:z(),typeParameters:E(lt),parameters:E(pe),return:E(pe)}),sn=p({name:h(),type:pe}),an=p({abilities:lt,typeParameters:E(tn),fields:E(sn)}),on=p({fileFormatVersion:le(),address:h(),name:h(),friends:E(Qr),structs:Q(h(),an),exposedFunctions:Q(h(),nn)});Q(h(),on);function nt(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function tr(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function ft(e){if(typeof e=="object"&&"Struct"in e)return e;const t=tr(e),r=nt(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function cn(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,b=0,f=0,x=y.length;f!==x&&y[f]===0;)f++,w++;for(var C=(x-f)*d+1>>>0,P=new Uint8Array(C);f!==x;){for(var A=y[f],k=0,N=C-1;(A!==0||k<b)&&N!==-1;N--,k++)A+=256*P[N]>>>0,P[N]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");b=k,f++}for(var q=C-b;q!==C&&P[q]===0;)q++;for(var he=a.repeat(w);q<C;++q)he+=e.charAt(P[q]);return he}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var w=0,b=0,f=0;y[w]===a;)b++,w++;for(var x=(y.length-w)*c+1>>>0,C=new Uint8Array(x);y[w];){var P=t[y.charCodeAt(w)];if(P===255)return;for(var A=0,k=x-1;(P!==0||A<f)&&k!==-1;k--,A++)P+=o*C[k]>>>0,C[k]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,w++}for(var N=x-f;N!==x&&C[N]===0;)N++;for(var q=new Uint8Array(b+(x-N)),he=b;N!==x;)q[he++]=C[N++];return q}function m(y){var w=g(y);if(w)return w;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:g,decode:m}}var un=cn;const dn=un,ln="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var fn=dn(ln);const rr=B.getDefaultExportFromCjs(fn),xe=e=>rr.encode(e),ht=e=>rr.decode(e);function ce(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const He=8192;function Ae(e){if(e.length<He)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=He){const n=e.slice(r,r+He);t+=String.fromCharCode(...n)}return btoa(t)}function Ke(e){var i;const t=e.startsWith("0x")?e.slice(2):e,n=((i=(t.length%2===0?t:`0${t}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function _e(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function gt(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function hn(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class nr{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function gn(e,t){switch(t){case"base58":return xe(e);case"base64":return Ae(e);case"hex":return _e(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function pn(e,t){switch(t){case"base58":return ht(e);case"base64":return ce(e);case"hex":return Ke(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ir(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class sr{constructor({size:t=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r||t,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return Xe(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Xe(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Xe(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return gt(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return gn(this.toBytes(),t)}}function Xe(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var ar=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},X=(e,t,r)=>(ar(e,t,"read from private field"),r?r.call(e):t.get(e)),ze=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ve=(e,t,r,n)=>(ar(e,t,"write to private field"),t.set(e,r),r),ge,be,Me,ae;const or=class{constructor(e){ze(this,ge,void 0),ze(this,be,void 0),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),Ve(this,ge,e.write),Ve(this,be,e.serialize??((t,r)=>{const n=new sr({size:this.serializedSize(t)??void 0,...r});return X(this,ge).call(this,t,n),n.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),X(this,ge).call(this,e,t)}serialize(e,t){return this.validate(e),new yn(this,X(this,be).call(this,e,t))}parse(e){const t=new nr(e);return this.read(t)}transform({name:e,input:t,output:r}){return new or({name:e??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ge).call(this,t(n),i),serializedSize:n=>this.serializedSize(t(n)),serialize:(n,i)=>X(this,be).call(this,t(n),i),validate:n=>this.validate(t(n))})}};let Z=or;ge=new WeakMap;be=new WeakMap;const cr=Symbol.for("@mysten/serialized-bcs");function pt(e){return!!e&&typeof e=="object"&&e[cr]===!0}class yn{constructor(t,r){ze(this,Me,void 0),ze(this,ae,void 0),Ve(this,Me,t),Ve(this,ae,r)}get[cr](){return!0}toBytes(){return X(this,ae)}toHex(){return _e(X(this,ae))}toBase64(){return Ae(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Fe({size:e,...t}){return new Z({...t,serializedSize:()=>e})}function Ze({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ye({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function mn({serialize:e,...t}){const r=new Z({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function wn({toBytes:e,fromBytes:t,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=gt(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function bn(e){let t=null;function r(){return t||(t=e()),t}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const u={u8(e){return Ze({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Ze({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Ze({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ye({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ye({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ye({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Fe({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return mn({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(gt(t)),...e})},bytes(e,t){return Fe({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{for(let i=0;i<e;i++)n.write8(r[i]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return wn({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Z({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return u.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>"Some"in t?t.Some:null})},vector(e,t){return new Z({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Z({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Z({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Z({name:e,read:i=>{const s=i.readULEB(),[o,a]=n[s];return{[o]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[o,a]=Object.entries(i)[0];for(let c=0;c<n.length;c++){const[d,l]=n[c];if(d===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return u.vector(u.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(e,t){return(...r)=>t(...r).transform({name:`${t.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(e){return bn(e)}},Sn=32,Se=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Se){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Se.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Tn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new Se(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
1
|
+
"use strict";var Ir=Object.defineProperty;var xr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>(xr(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index-D1bcMAs6.js"),S=require("./sui-4Ygokvkl.js");require("./index-BZQPVPp1.js");const Ar=require("./chain-y7sg4yrp.js");class _r{constructor(t,r,n,i,s=!1){V(this,"transaction");V(this,"network");V(this,"chain");V(this,"description");V(this,"parallelizable");this.transaction=t,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function Br(e){return K(e)&&typeof e[Symbol.iterator]=="function"}function K(e){return typeof e=="object"&&e!=null}function J(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function $r(e){const{done:t,value:r}=e.next();return t?void 0:r}function Ur(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Vt(e,t,r,n){Br(e)||(e=[e]);for(const i of e){const s=Ur(i,t,r,n);s&&(yield s)}}function*ut(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&K(t.schema)&&K(e)&&!Array.isArray(e)))for(const d in e)t.schema[d]===void 0&&delete e[d];let c="valid";for(const d of t.validator(e,a))d.explanation=r.message,c="not_valid",yield[d,void 0];for(let[d,l,g]of t.entries(e,a)){const m=ut(l,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const y of m)y[0]?(c=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(l=y[1],d===void 0?e=l:e instanceof Map?e.set(d,l):e instanceof Set?e.add(l):K(e)&&(l!==void 0||d in e)&&(e[d]=l))}if(c!=="not_valid")for(const d of t.refiner(e,a))d.explanation=r.message,c="not_refined",yield[d,void 0];c==="valid"&&(yield[void 0,e])}class te{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,d)=>{const l=i(c,d);return Vt(l,d,this,c)}:this.validator=()=>[],s?this.refiner=(c,d)=>{const l=s(c,d);return Vt(l,d,this,c)}:this.refiner=()=>[]}assert(t,r){return tt(t,this,r)}create(t,r){return Kt(t,this,r)}is(t){return L(t,this)}mask(t,r){return Jt(t,this,r)}validate(t,r={}){return Ie(t,this,r)}}function tt(e,t,r){const n=Ie(e,t,{message:r});if(n[0])throw n[0]}function Kt(e,t,r){const n=Ie(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Jt(e,t,r){const n=Ie(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(e,t){return!Ie(e,t)[0]}function Ie(e,t,r={}){const n=ut(e,t,r),i=$r(n);return i[0]?[new Cr(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function je(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Rr(n):p(n)}function W(e,t){return new te({type:e,schema:null,validator:t})}function rt(){return W("any",()=>!0)}function E(e){return new te({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${J(t)}`}})}function Mr(){return W("bigint",e=>typeof e=="bigint")}function z(){return W("boolean",e=>typeof e=="boolean")}function ee(){return W("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${J(e)}`)}function v(e){const t=J(e),r=typeof e;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${J(n)}`}})}function qt(){return W("never",()=>!1)}function $(e){return new te({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function le(){return W("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${J(e)}`)}function p(e){const t=e?Object.keys(e):[],r=qt();return new te({type:"object",schema:e||null,*entries(n){if(e&&K(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function T(e){return new te({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Q(e,t){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",e=>typeof e=="string"||`Expected a string, but received: ${J(e)}`)}function Ht(e){const t=qt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(e){const t=Object.keys(e);return new te({type:"type",schema:e,*entries(r){if(K(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(e){const t=e.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=ut(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${J(r)}`,...i]}})}function Xt(){return W("unknown",()=>!0)}const dt=U([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),v("Immutable")]);W("SuiJsonValue",()=>!0);const Pr=U([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Pr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});U([h(),v("package")]);const oe=p({digest:h(),objectId:h(),version:U([le(),h(),Mr()])});p({owner:dt,reference:oe});p({objectId:h(),sequenceNumber:h()});p({payment:E(oe),owner:h(),price:h(),budget:h()});const Nr=je(oe,p({type:h(),owner:dt,previousTransaction:h()})),Dr=Q(h(),rt()),zr=Q(h(),Xt()),Vr=p({type:h(),fields:Dr,hasPublicTransfer:z()}),Fr=p({disassembled:zr}),Gr=U([je(Vr,p({dataType:v("moveObject")})),je(Fr,p({dataType:v("package")}))]),Lr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Wr=p({id:h(),moduleMap:Q(h(),h())}),Kr=U([je(Lr,p({dataType:v("moveObject")})),je(Wr,p({dataType:v("package")}))]);BigInt(1e9);const Zt=p({code:h(),error:T(h()),object_id:T(h()),parent_object_id:T(h()),version:T(h()),digest:T(h())}),Jr=p({data:$(T(Q(h(),h()))),error:$(T(Zt))}),qr=U([Jr,T(Q(h(),h()))]),Yt=p({objectId:h(),version:h(),digest:h(),type:$(T(h())),content:$(T(Gr)),bcs:$(T(Kr)),owner:$(T(dt)),previousTransaction:$(T(h())),storageRebate:$(T(h())),display:$(T(qr))});p({showType:$(T(z())),showContent:$(T(z())),showBcs:$(T(z())),showOwner:$(T(z())),showPreviousTransaction:$(T(z())),showStorageRebate:$(T(z())),showDisplay:$(T(z()))});U([v("Exists"),v("notExists"),v("Deleted")]);E(Nr);const Hr=p({data:$(T(Yt)),error:$(T(Zt))});function Xr(e){return e.data}function Zr(e){if(e.error&&"object_id"in e.error&&"version"in e.error&&"digest"in e.error){const t=e.error;return{objectId:t.object_id,version:t.version,digest:t.digest}}}function Ft(e){if("reference"in e)return e.reference;const t=Xr(e);return t?{objectId:t.objectId,version:t.version,digest:t.digest}:Zr(e)}p({objectId:h(),atCheckpoint:T(le())});p({data:E(Hr),nextCursor:T($(h())),hasNextPage:z()});U([p({details:Yt,status:v("VersionFound")}),p({details:h(),status:v("ObjectNotExists")}),p({details:oe,status:v("ObjectDeleted")}),p({details:Ht([h(),le()]),status:v("VersionNotFound")}),p({details:p({asked_version:le(),latest_version:le(),object_id:h()}),status:v("VersionTooHigh")})]);const Yr=U([h(),p({Object:h()})]);E(Yr);const Qr=p({address:h(),name:h()}),en=U([v("Private"),v("Public"),v("Friend")]),lt=p({abilities:E(h())}),tn=p({constraints:lt,isPhantom:z()}),rn=p({TypeParameter:le()}),qe=Ht([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(qe),rank7Days:E(qe),rank30Days:E(qe)});function Qt(e){if(!e)return!1;if(typeof e=="string"||L(e,rn)||er(e))return!0;if(typeof e!="object")return!1;const t=e;return!!(L(t.Reference,pe)||L(t.MutableReference,pe)||L(t.Vector,pe))}const pe=W("SuiMoveNormalizedType",Qt);function er(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.Struct||typeof t.Struct!="object")return!1;const r=t.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>Qt(n)))}W("SuiMoveNormalizedStructType",er);const nn=p({visibility:en,isEntry:z(),typeParameters:E(lt),parameters:E(pe),return:E(pe)}),sn=p({name:h(),type:pe}),an=p({abilities:lt,typeParameters:E(tn),fields:E(sn)}),on=p({fileFormatVersion:le(),address:h(),name:h(),friends:E(Qr),structs:Q(h(),an),exposedFunctions:Q(h(),nn)});Q(h(),on);function nt(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function tr(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function ft(e){if(typeof e=="object"&&"Struct"in e)return e;const t=tr(e),r=nt(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function cn(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,b=0,f=0,x=y.length;f!==x&&y[f]===0;)f++,w++;for(var C=(x-f)*d+1>>>0,P=new Uint8Array(C);f!==x;){for(var A=y[f],k=0,N=C-1;(A!==0||k<b)&&N!==-1;N--,k++)A+=256*P[N]>>>0,P[N]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");b=k,f++}for(var q=C-b;q!==C&&P[q]===0;)q++;for(var he=a.repeat(w);q<C;++q)he+=e.charAt(P[q]);return he}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var w=0,b=0,f=0;y[w]===a;)b++,w++;for(var x=(y.length-w)*c+1>>>0,C=new Uint8Array(x);y[w];){var P=t[y.charCodeAt(w)];if(P===255)return;for(var A=0,k=x-1;(P!==0||A<f)&&k!==-1;k--,A++)P+=o*C[k]>>>0,C[k]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,w++}for(var N=x-f;N!==x&&C[N]===0;)N++;for(var q=new Uint8Array(b+(x-N)),he=b;N!==x;)q[he++]=C[N++];return q}function m(y){var w=g(y);if(w)return w;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:g,decode:m}}var un=cn;const dn=un,ln="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var fn=dn(ln);const rr=B.getDefaultExportFromCjs(fn),xe=e=>rr.encode(e),ht=e=>rr.decode(e);function ce(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const He=8192;function Ae(e){if(e.length<He)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=He){const n=e.slice(r,r+He);t+=String.fromCharCode(...n)}return btoa(t)}function Ke(e){var i;const t=e.startsWith("0x")?e.slice(2):e,n=((i=(t.length%2===0?t:`0${t}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function _e(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function gt(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function hn(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class nr{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function gn(e,t){switch(t){case"base58":return xe(e);case"base64":return Ae(e);case"hex":return _e(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function pn(e,t){switch(t){case"base58":return ht(e);case"base64":return ce(e);case"hex":return Ke(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ir(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class sr{constructor({size:t=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r||t,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return Xe(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Xe(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Xe(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return gt(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return gn(this.toBytes(),t)}}function Xe(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var ar=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},X=(e,t,r)=>(ar(e,t,"read from private field"),r?r.call(e):t.get(e)),ze=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ve=(e,t,r,n)=>(ar(e,t,"write to private field"),t.set(e,r),r),ge,be,Me,ae;const or=class{constructor(e){ze(this,ge,void 0),ze(this,be,void 0),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),Ve(this,ge,e.write),Ve(this,be,e.serialize??((t,r)=>{const n=new sr({size:this.serializedSize(t)??void 0,...r});return X(this,ge).call(this,t,n),n.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),X(this,ge).call(this,e,t)}serialize(e,t){return this.validate(e),new yn(this,X(this,be).call(this,e,t))}parse(e){const t=new nr(e);return this.read(t)}transform({name:e,input:t,output:r}){return new or({name:e??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ge).call(this,t(n),i),serializedSize:n=>this.serializedSize(t(n)),serialize:(n,i)=>X(this,be).call(this,t(n),i),validate:n=>this.validate(t(n))})}};let Z=or;ge=new WeakMap;be=new WeakMap;const cr=Symbol.for("@mysten/serialized-bcs");function pt(e){return!!e&&typeof e=="object"&&e[cr]===!0}class yn{constructor(t,r){ze(this,Me,void 0),ze(this,ae,void 0),Ve(this,Me,t),Ve(this,ae,r)}get[cr](){return!0}toBytes(){return X(this,ae)}toHex(){return _e(X(this,ae))}toBase64(){return Ae(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Fe({size:e,...t}){return new Z({...t,serializedSize:()=>e})}function Ze({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ye({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function mn({serialize:e,...t}){const r=new Z({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function wn({toBytes:e,fromBytes:t,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=gt(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function bn(e){let t=null;function r(){return t||(t=e()),t}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const u={u8(e){return Ze({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Ze({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Ze({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ye({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ye({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ye({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Fe({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return mn({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(gt(t)),...e})},bytes(e,t){return Fe({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{for(let i=0;i<e;i++)n.write8(r[i]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return wn({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Z({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return u.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>"Some"in t?t.Some:null})},vector(e,t){return new Z({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Z({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Z({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Z({name:e,read:i=>{const s=i.readULEB(),[o,a]=n[s];return{[o]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[o,a]=Object.entries(i)[0];for(let c=0;c<n.length;c++){const[d,l]=n[c];if(d===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return u.vector(u.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(e,t){return(...r)=>t(...r).transform({name:`${t.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(e){return bn(e)}},Sn=32,Se=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Se){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Se.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Tn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new Se(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
2
2
|
${JSON.stringify(e)}`)}de(e,t,r){if(typeof t=="string")if(r)t=pn(t,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).decode(this,t,i)}if(typeof e=="object"){const n=new Se(this),i=this.tempKey();return n.registerStructType(i,e).de(i,t,r)}throw new Error(`Incorrect type passed into the '.de()' function.
|
|
3
3
|
${JSON.stringify(e)}`)}hasType(e){return this.types.has(e)}registerAlias(e,t){return this.types.set(e,t),this}registerType(e,t,r,n=()=>!0){const{name:i,params:s}=this.parseTypeName(e);return this.types.set(i,{encode(o,a,c,d){const l=s.reduce((g,m,y)=>Object.assign(g,{[m]:d[y]}),{});return this._encodeRaw.call(o,new sr(c),a,d,l)},decode(o,a,c){const d=s.reduce((l,g,m)=>Object.assign(l,{[g]:c[m]}),{});return this._decodeRaw.call(o,new nr(a),c,d)},_encodeRaw(o,a,c,d){if(n(a))return t.call(this,o,a,c,d);throw new Error(`Validation failed for type ${i}, data: ${a}`)},_decodeRaw(o,a,c){return r.call(this,o,a,c)}}),this}registerBcsType(e,t){return this.registerType(e,(r,n,i)=>{const s=i.map(o=>new Z({name:String(o),write:(a,c)=>{const{name:d,params:l}=this.parseTypeName(o),g=this.getTypeInterface(d),m=l.reduce((y,w,b)=>Object.assign(y,{[w]:i[b]}),{});return g._encodeRaw.call(this,c,a,l,m)},read:()=>{throw new Error("Not implemented")}}));return t(...s).write(n,r),r},(r,n)=>{const i=n.map(s=>new Z({name:String(s),write:(o,a)=>{throw new Error("Not implemented")},read:o=>{const{name:a,params:c}=this.parseTypeName(s),d=this.getTypeInterface(a),l=c.reduce((g,m,y)=>Object.assign(g,{[m]:n[y]}),{});return d._decodeRaw.call(this,o,c,l)}}));return t(...i).read(r)}),this}registerAddressType(e,t,r="hex"){switch(r){case"base64":return this.registerType(e,function(i,s){return ce(s).reduce((o,a)=>o.write8(a),i)},function(i){return Ae(i.readBytes(t))});case"hex":return this.registerType(e,function(i,s){return Ke(s).reduce((o,a)=>o.write8(a),i)},function(i){return _e(i.readBytes(t))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(e){let{name:t,params:r}=this.parseTypeName(e);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+t);return this.registerType(e,function(i,s,o,a){return i.writeVec(s,(c,d)=>{let l=o[0];if(!l)throw new Error(`Incorrect number of type parameters passed a to vector '${e}'`);let{name:g,params:m}=this.parseTypeName(l);if(this.hasType(g))return this.getTypeInterface(g)._encodeRaw.call(this,c,d,m,a);if(!(g in a))throw new Error(`Unable to find a matching type definition for ${g} in vector; make sure you passed a generic`);let{name:y,params:w}=this.parseTypeName(a[g]);return this.getTypeInterface(y)._encodeRaw.call(this,c,d,w,a)})},function(i,s,o){return i.readVec(a=>{let c=s[0];if(!c)throw new Error(`Incorrect number of type parameters passed to a vector '${e}'`);let{name:d,params:l}=this.parseTypeName(c);if(this.hasType(d))return this.getTypeInterface(d)._decodeRaw.call(this,a,l,o);if(!(d in o))throw new Error(`Unable to find a matching type definition for ${d} in vector; make sure you passed a generic`);let{name:g,params:m}=this.parseTypeName(o[d]);return this.getTypeInterface(g)._decodeRaw.call(this,a,m,o)})})}registerStructType(e,t){for(let o in t){let a=this.tempKey(),c=t[o];!Array.isArray(c)&&typeof c!="string"&&(t[o]=a,this.registerStructType(a,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(e);return this.registerType(e,function(a,c,d,l){if(!c||c.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${c}`);if(d.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${d.length}`);for(let g of n){if(!(g in c))throw new Error(`Struct ${i} requires field ${g}:${r[g]}`);const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))this.getTypeInterface(m)._encodeRaw.call(this,a,c[g],y,l);else{const w=s.indexOf(m);let{name:b,params:f}=this.parseTypeName(d[w]);if(this.hasType(b)){this.getTypeInterface(b)._encodeRaw.call(this,a,c[g],f,l);continue}if(!(b in l))throw new Error(`Unable to find a matching type definition for ${b} in ${i}; make sure you passed a generic`);let{name:x,params:C}=this.parseTypeName(l[b]);this.getTypeInterface(x)._encodeRaw.call(this,a,c[g],C,l)}}return a},function(a,c,d){if(c.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${c.length}`);let l={};for(let g of n){const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))l[g]=this.getTypeInterface(m)._decodeRaw.call(this,a,y,d);else{const w=s.indexOf(m);let{name:b,params:f}=this.parseTypeName(c[w]);if(this.hasType(b)){l[g]=this.getTypeInterface(b)._decodeRaw.call(this,a,f,d);continue}if(!(b in d))throw new Error(`Unable to find a matching type definition for ${b} in ${i}; make sure you passed a generic`);let{name:x,params:C}=this.parseTypeName(d[b]);l[g]=this.getTypeInterface(x)._decodeRaw.call(this,a,C,d)}}return l})}registerEnumType(e,t){for(let o in t){let a=this.tempKey(),c=t[o];c!==null&&!Array.isArray(c)&&typeof c!="string"&&(t[o]=a,this.registerStructType(a,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(e);return this.registerType(e,function(a,c,d,l){if(!c)throw new Error(`Unable to write enum "${i}", missing data.
|
|
4
4
|
Received: "${c}"`);if(typeof c!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-DTJXuc64.js"),Mr=require("./dijkstra-CtFxn7S9.js"),Sr=require("./index-D1bcMAs6.js");var Or=function(t){for(var o=[],n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var a=t.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(i-55296)*1024+a-56320+65536,r+=1)}if(i<128){o.push(i);continue}if(i<2048){o.push(i>>6|192),o.push(i&63|128);continue}if(i<55296||i>=57344&&i<65536){o.push(i>>12|224),o.push(i>>6&63|128),o.push(i&63|128);continue}if(i>=65536&&i<=1114111){o.push(i>>18|240),o.push(i>>12&63|128),o.push(i>>6&63|128),o.push(i&63|128);continue}o.push(239,191,189)}return new Uint8Array(o).buffer};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Dr = Object.defineProperty;
|
|
2
2
|
var zr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var D = (e, t, r) => (zr(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import { g as Vr, b3 as Fr, by as Gr, c5 as Je, c6 as Lr, au as Wr, az as Kt, bp as Ae, bM as Kr, bO as Jt, c7 as Jr, b_ as Ht, b4 as Hr, at as Xr } from "./index-
|
|
5
|
-
import { i as rr, g as ft, a as qr, b as nr, c as ir, d as nt, t as it, S as Zr, e as _e, p as Yr, f as Qr, h as He, j as en, u as Xe, k as tn, l as rn, m as Xt, n as nn, _ as sn } from "./sui-
|
|
6
|
-
import "./index-
|
|
7
|
-
import { r as an } from "./chain-
|
|
4
|
+
import { g as Vr, b3 as Fr, by as Gr, c5 as Je, c6 as Lr, au as Wr, az as Kt, bp as Ae, bM as Kr, bO as Jt, c7 as Jr, b_ as Ht, b4 as Hr, at as Xr } from "./index-BsbdJZ3C.mjs";
|
|
5
|
+
import { i as rr, g as ft, a as qr, b as nr, c as ir, d as nt, t as it, S as Zr, e as _e, p as Yr, f as Qr, h as He, j as en, u as Xe, k as tn, l as rn, m as Xt, n as nn, _ as sn } from "./sui-fzNqSygY.mjs";
|
|
6
|
+
import "./index-DnsX0bqc.mjs";
|
|
7
|
+
import { r as an } from "./chain-B1FOQWsW.mjs";
|
|
8
8
|
class on {
|
|
9
9
|
constructor(t, r, n, i, s = !1) {
|
|
10
10
|
D(this, "transaction");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)};var H={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,REACT_APP_CONNECT_VERSION:"0.3.18-beta.0-development"};const F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(k=>{if(Object.getOwnPropertyDescriptor(w,k))return;const L=Reflect.get(n,k),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,k,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let k=f[1];const L=(a=++f[1])=>(k!==a&&!v.size&&(k=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],N)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const R=o[3](M(N));b.set(N,[o,R])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],N)=>{h&&(h(),b.set(N,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const N=Reflect.has(a,i),R=Reflect.get(a,i,h);if(N&&(e(R,o)||m.has(o)&&e(R,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,R]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},O=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:O,subscribe(e){return D(O,()=>e(O))},setChains(e){O.chains=e},setWalletConnectUri(e){O.walletConnectUri=e},setIsCustomDesktop(e){O.isCustomDesktop=e},setIsCustomMobile(e){O.isCustomMobile=e},setIsDataLoaded(e){O.isDataLoaded=e},setIsUiLoaded(e){O.isUiLoaded=e},setIsAuth(e){O.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),P={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ee.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",P.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${P.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${P.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),E=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=P.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),E.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await U.getMobileListings(m):await U.getDesktopListings(m);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=P.state,{recomendedWallets:l}=E;if(r==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return E[g]={listings:[...E[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},_=j({open:!1}),z={state:_,subscribe(e){return D(_,()=>e(_))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)_.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),_.open=!0,t())},200)}})},close(){_.open=!1}};var Ue=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Pe.call(t,s)&&de(e,s,t[s]);return e};function ke(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=j({themeMode:ke()?"dark":"light"}),Z={state:T,subscribe(e){return D(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),Ne={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class _e{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),P.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-DRZymJsG.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Re=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:_e},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Re;exports.ne=Z;exports.oe=Ne;exports.p=y;exports.se=z;exports.te=Me;exports.y=P;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var T = Object.defineProperty;
|
|
2
2
|
var B = (i, e, t) => e in i ? T(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var a = (i, e, t) => (B(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { cf as g, ck as b, b5 as I, cl as x, bp as A, c5 as v, c6 as S, au as U, bO as f, d as $, c7 as F, b_ as d, az as m, at as c, cm as E } from "./index-
|
|
5
|
-
import { a as h, A as C, c as O, b as k, d as w, i as W } from "./aptos-
|
|
6
|
-
import { r as R } from "./chain-
|
|
4
|
+
import { cf as g, ck as b, b5 as I, cl as x, bp as A, c5 as v, c6 as S, au as U, bO as f, d as $, c7 as F, b_ as d, az as m, at as c, cm as E } from "./index-BsbdJZ3C.mjs";
|
|
5
|
+
import { a as h, A as C, c as O, b as k, d as w, i as W } from "./aptos-4Buk4ifX.mjs";
|
|
6
|
+
import { r as R } from "./chain-B1FOQWsW.mjs";
|
|
7
7
|
class N {
|
|
8
8
|
constructor(e, t, s, n, r = !1) {
|
|
9
9
|
a(this, "transaction");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var yt=Object.defineProperty;var pt=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var V=(r,e,t)=>(pt(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-DvPjni-v.js"),ht=require("./chain-CPTe1tkD.js"),$=require("./solana-jJHTew4W.js"),Le=require("./index-DnneI5--.js");class bt extends TypeError{constructor(e,t){let s;const{message:i,...a}=e,{path:u}=e,m=u.length===0?i:"At path: "+u.join(".")+" -- "+i;super(m),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var l;return(l=s)!=null?l:s=[e,...t()]}}}function St(r){return q(r)&&typeof r[Symbol.iterator]=="function"}function q(r){return typeof r=="object"&&r!=null}function W(r){return typeof r=="string"?JSON.stringify(r):""+r}function kt(r){const{done:e,value:t}=r.next();return e?void 0:t}function Mt(r,e,t,s){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:a}=e,{type:u}=t,{refinement:m,message:l="Expected a value of type `"+u+"`"+(m?" with refinement `"+m+"`":"")+", but received: `"+W(s)+"`"}=r;return{value:s,type:u,refinement:m,key:i[i.length-1],path:i,branch:a,...r,message:l}}function*Re(r,e,t,s){St(r)||(r=[r]);for(const i of r){const a=Mt(i,e,t,s);a&&(yield a)}}function*ke(r,e,t={}){const{path:s=[],branch:i=[r],coerce:a=!1,mask:u=!1}=t,m={path:s,branch:i};if(a&&(r=e.coercer(r,m),u&&e.type!=="type"&&q(e.schema)&&q(r)&&!Array.isArray(r)))for(const b in r)e.schema[b]===void 0&&delete r[b];let l=!0;for(const b of e.validator(r,m))l=!1,yield[b,void 0];for(let[b,k,M]of e.entries(r,m)){const I=ke(k,M,{path:b===void 0?s:[...s,b],branch:b===void 0?i:[...i,k],coerce:a,mask:u});for(const v of I)v[0]?(l=!1,yield[v[0],void 0]):a&&(k=v[1],b===void 0?r=k:r instanceof Map?r.set(b,k):r instanceof Set?r.add(k):q(r)&&(r[b]=k))}if(l)for(const b of e.refiner(r,m))l=!1,yield[b,void 0];l&&(yield[void 0,r])}let U=class{constructor(e){const{type:t,schema:s,validator:i,refiner:a,coercer:u=l=>l,entries:m=function*(){}}=e;this.type=t,this.schema=s,this.entries=m,this.coercer=u,i?this.validator=(l,b)=>{const k=i(l,b);return Re(k,b,this,l)}:this.validator=()=>[],a?this.refiner=(l,b)=>{const k=a(l,b);return Re(k,b,this,l)}:this.refiner=()=>[]}assert(e){return wt(e,this)}create(e){return re(e,this)}is(e){return Ue(e,this)}mask(e){return Pt(e,this)}validate(e,t={}){return oe(e,this,t)}};function wt(r,e){const t=oe(r,e);if(t[0])throw t[0]}function re(r,e){const t=oe(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function Pt(r,e){const t=oe(r,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Ue(r,e){return!oe(r,e)[0]}function oe(r,e,t={}){const s=ke(r,e,t),i=kt(s);return i[0]?[new bt(i[0],function*(){for(const u of s)u[0]&&(yield u[0])}),void 0]:[void 0,i[1]]}function H(r,e){return new U({type:r,schema:null,validator:e})}function At(){return H("any",()=>!0)}function g(r){return new U({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,s]of e.entries())yield[t,s,r]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+W(e)}})}function L(){return H("boolean",r=>typeof r=="boolean")}function Me(r){return H("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+W(e))}function A(r){const e=W(r),t=typeof r;return new U({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator(s){return s===r||"Expected the literal `"+e+"`, but received: "+W(s)}})}function It(){return H("never",()=>!1)}function f(r){return new U({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function o(){return H("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+W(r))}function p(r){return new U({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function qe(r,e){return new U({type:"record",schema:null,*entries(t){if(q(t))for(const s in t){const i=t[s];yield[s,s,r],yield[s,i,e]}},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function d(){return H("string",r=>typeof r=="string"||"Expected a string, but received: "+W(r))}function we(r){const e=It();return new U({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const s=Math.max(r.length,t.length);for(let i=0;i<s;i++)yield[i,t[i],r[i]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+W(t)}})}function c(r){const e=Object.keys(r);return new U({type:"type",schema:r,*entries(t){if(q(t))for(const s of e)yield[s,t[s],r[s]]},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function R(r){const e=r.map(t=>t.type).join(" | ");return new U({type:"union",schema:null,validator(t,s){const i=[];for(const a of r){const[...u]=ke(t,a,s),[m]=u;if(m[0])for(const[l]of u)l&&i.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+W(t),...i]}})}function ue(){return H("unknown",()=>!0)}function ce(r,e,t){return new U({...r,coercer:(s,i)=>Ue(s,e)?r.coercer(t(s,i),i):r.coercer(s,i)})}const Ee=()=>{const r=n.ed25519.utils.randomPrivateKey(),e=he(r),t=new Uint8Array(64);return t.set(r),t.set(e,32),{publicKey:e,secretKey:t}},he=n.ed25519.getPublicKey;function Ce(r){try{return n.ed25519.ExtendedPoint.fromHex(r),!0}catch{return!1}}const vt=(r,e)=>n.ed25519.sign(r,e.slice(0,32)),Tt=n.ed25519.verify,K=r=>n.bufferPolyfill.Buffer.isBuffer(r)?r:r instanceof Uint8Array?n.bufferPolyfill.Buffer.from(r.buffer,r.byteOffset,r.byteLength):n.bufferPolyfill.Buffer.from(r);class xt{constructor(e){Object.assign(this,e)}encode(){return n.bufferPolyfill.Buffer.from(n.serialize_1(de,this))}static decode(e){return n.deserialize_1(de,this,e)}static decodeUnchecked(e){return n.deserializeUnchecked_1(de,this,e)}}const de=new Map;var Fe;let Ve;const Bt=32,ne=32;function Kt(r){return r._bn!==void 0}let Oe=1;Ve=Symbol.toStringTag;class y extends xt{constructor(e){if(super({}),this._bn=void 0,Kt(e))this._bn=e._bn;else{if(typeof e=="string"){const t=n.bs58.decode(e);if(t.length!=ne)throw new Error("Invalid public key input");this._bn=new n.BN(t)}else this._bn=new n.BN(e);if(this._bn.byteLength()>ne)throw new Error("Invalid public key input")}}static unique(){const e=new y(Oe);return Oe+=1,new y(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return n.bs58.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(n.bufferPolyfill.Buffer);if(e.length===ne)return e;const t=n.bufferPolyfill.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,s){const i=n.bufferPolyfill.Buffer.concat([e.toBuffer(),n.bufferPolyfill.Buffer.from(t),s.toBuffer()]),a=n.sha256(i);return new y(a)}static createProgramAddressSync(e,t){let s=n.bufferPolyfill.Buffer.alloc(0);e.forEach(function(a){if(a.length>Bt)throw new TypeError("Max seed length exceeded");s=n.bufferPolyfill.Buffer.concat([s,K(a)])}),s=n.bufferPolyfill.Buffer.concat([s,t.toBuffer(),n.bufferPolyfill.Buffer.from("ProgramDerivedAddress")]);const i=n.sha256(s);if(Ce(i))throw new Error("Invalid seeds, address must fall off the curve");return new y(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let s=255,i;for(;s!=0;){try{const a=e.concat(n.bufferPolyfill.Buffer.from([s]));i=this.createProgramAddressSync(a,t)}catch(a){if(a instanceof TypeError)throw a;s--;continue}return[i,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){const t=new y(e);return Ce(t.toBytes())}}Fe=y;y.default=new Fe("11111111111111111111111111111111");de.set(y,{kind:"struct",fields:[["_bn","u256"]]});new y("BPFLoader1111111111111111111111111111111111");const be=1232,Rt=127,He=64;class Ne{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const s=new Map;this.keySegments().flat().forEach((a,u)=>{s.set(a.toBase58(),u)});const i=a=>{const u=s.get(a.toBase58());if(u===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return u};return e.map(a=>({programIdIndex:i(a.programId),accountKeyIndexes:a.keys.map(u=>i(u.pubkey)),data:a.data}))}}const S=(r="publicKey")=>n.blob(32,r),J=(r="string")=>{const e=n.struct([n.u32("length"),n.u32("lengthPadding"),n.blob(n.offset(n.u32(),-8),"chars")],r),t=e.decode.bind(e),s=e.encode.bind(e),i=e;return i.decode=(a,u)=>t(a,u).chars.toString(),i.encode=(a,u,m)=>{const l={chars:n.bufferPolyfill.Buffer.from(a,"utf8")};return s(l,u,m)},i.alloc=a=>n.u32().span+n.u32().span+n.bufferPolyfill.Buffer.from(a,"utf8").length,i},Et=(r="authorized")=>n.struct([S("staker"),S("withdrawer")],r),Ct=(r="lockup")=>n.struct([n.ns64("unixTimestamp"),n.ns64("epoch"),S("custodian")],r),Ot=(r="voteInit")=>n.struct([S("nodePubkey"),S("authorizedVoter"),S("authorizedWithdrawer"),n.u8("commission")],r),Nt=(r="voteAuthorizeWithSeedArgs")=>n.struct([n.u32("voteAuthorizationType"),S("currentAuthorityDerivedKeyOwnerPubkey"),J("currentAuthorityDerivedKeySeed"),S("newAuthorized")],r);function je(r,e){const t=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){const a=e[i.property];if(Array.isArray(a))return a.length*t(i.elementLayout)}else if("fields"in i)return je({layout:i},e[i.property]);return 0};let s=0;return r.layout.fields.forEach(i=>{s+=t(i)}),s}function Q(r){let e=0,t=0;for(;;){let s=r.shift();if(e|=(s&127)<<t*7,t+=1,!(s&128))break}return e}function ee(r,e){let t=e;for(;;){let s=t&127;if(t>>=7,t==0){r.push(s);break}else s|=128,r.push(s)}}function C(r,e){if(!r)throw new Error(e||"Assertion failed")}class Pe{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const s=new Map,i=u=>{const m=u.toBase58();let l=s.get(m);return l===void 0&&(l={isSigner:!1,isWritable:!1,isInvoked:!1},s.set(m,l)),l},a=i(t);a.isSigner=!0,a.isWritable=!0;for(const u of e){i(u.programId).isInvoked=!0;for(const m of u.keys){const l=i(m.pubkey);l.isSigner||(l.isSigner=m.isSigner),l.isWritable||(l.isWritable=m.isWritable)}}return new Pe(t,s)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];C(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,l])=>l.isSigner&&l.isWritable),s=e.filter(([,l])=>l.isSigner&&!l.isWritable),i=e.filter(([,l])=>!l.isSigner&&l.isWritable),a=e.filter(([,l])=>!l.isSigner&&!l.isWritable),u={numRequiredSignatures:t.length+s.length,numReadonlySignedAccounts:s.length,numReadonlyUnsignedAccounts:a.length};{C(t.length>0,"Expected at least one writable signer key");const[l]=t[0];C(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const m=[...t.map(([l])=>new y(l)),...s.map(([l])=>new y(l)),...i.map(([l])=>new y(l)),...a.map(([l])=>new y(l))];return[u,m]}extractTableLookup(e){const[t,s]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&u.isWritable),[i,a]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&!u.isWritable);if(!(t.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:s,readonly:a}]}drainKeysFoundInLookupTable(e,t){const s=new Array,i=new Array;for(const[a,u]of this.keyMetaMap.entries())if(t(u)){const m=new y(a),l=e.findIndex(b=>b.equals(m));l>=0&&(C(l<256,"Max lookup table index exceeded"),s.push(l),i.push(m),this.keyMetaMap.delete(a))}return[s,i]}}const Ge="Reached end of buffer unexpectedly";function le(r){if(r.length===0)throw new Error(Ge);return r.shift()}function te(r,...e){const[t]=e;if(e.length===2?t+(e[1]??0)>r.length:t>=r.length)throw new Error(Ge);return r.splice(...e)}class ie{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new y(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:n.bs58.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Ne(this.staticAccountKeys)}static compile(e){const t=Pe.compile(e.instructions,e.payerKey),[s,i]=t.getMessageComponents(),u=new Ne(i).compileInstructions(e.instructions).map(m=>({programIdIndex:m.programIdIndex,accounts:m.accountKeyIndexes,data:n.bs58.encode(m.data)}));return new ie({header:s,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:u})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){const s=e-t,a=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return s<a}else{const s=t-this.header.numReadonlySignedAccounts;return e<s}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];ee(t,e);const s=this.instructions.map(M=>{const{accounts:I,programIdIndex:v}=M,E=Array.from(n.bs58.decode(M.data));let h=[];ee(h,I.length);let w=[];return ee(w,E.length),{programIdIndex:v,keyIndicesCount:n.bufferPolyfill.Buffer.from(h),keyIndices:I,dataLength:n.bufferPolyfill.Buffer.from(w),data:E}});let i=[];ee(i,s.length);let a=n.bufferPolyfill.Buffer.alloc(be);n.bufferPolyfill.Buffer.from(i).copy(a);let u=i.length;s.forEach(M=>{const v=n.struct([n.u8("programIdIndex"),n.blob(M.keyIndicesCount.length,"keyIndicesCount"),n.seq(n.u8("keyIndex"),M.keyIndices.length,"keyIndices"),n.blob(M.dataLength.length,"dataLength"),n.seq(n.u8("userdatum"),M.data.length,"data")]).encode(M,a,u);u+=v}),a=a.slice(0,u);const m=n.struct([n.blob(1,"numRequiredSignatures"),n.blob(1,"numReadonlySignedAccounts"),n.blob(1,"numReadonlyUnsignedAccounts"),n.blob(t.length,"keyCount"),n.seq(S("key"),e,"keys"),S("recentBlockhash")]),l={numRequiredSignatures:n.bufferPolyfill.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.bufferPolyfill.Buffer.from(t),keys:this.accountKeys.map(M=>K(M.toBytes())),recentBlockhash:n.bs58.decode(this.recentBlockhash)};let b=n.bufferPolyfill.Buffer.alloc(2048);const k=m.encode(l,b);return a.copy(b,k),b.slice(0,k+a.length)}static from(e){let t=[...e];const s=le(t);if(s!==(s&Rt))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=le(t),a=le(t),u=Q(t);let m=[];for(let I=0;I<u;I++){const v=te(t,0,ne);m.push(new y(n.bufferPolyfill.Buffer.from(v)))}const l=te(t,0,ne),b=Q(t);let k=[];for(let I=0;I<b;I++){const v=le(t),E=Q(t),h=te(t,0,E),w=Q(t),T=te(t,0,w),F=n.bs58.encode(n.bufferPolyfill.Buffer.from(T));k.push({programIdIndex:v,accounts:h,data:F})}const M={header:{numRequiredSignatures:s,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:a},recentBlockhash:n.bs58.encode(n.bufferPolyfill.Buffer.from(l)),accountKeys:m,instructions:k};return new ie(M)}}const _t=n.bufferPolyfill.Buffer.alloc(He).fill(0);class z{constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.bufferPolyfill.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:s})=>({pubkey:e.toJSON(),isSigner:t,isWritable:s})),programId:this.programId.toJSON(),data:[...this.data]}}}class X{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:s}=e;this.minNonceContextSlot=t,this.nonceInfo=s}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:s}=e;this.recentBlockhash=t,this.lastValidBlockHeight=s}else{const{recentBlockhash:t,nonceInfo:s}=e;s&&(this.nonceInfo=s),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new z(t))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?t=[this.nonceInfo.nonceInstruction,...this.instructions]:t=this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");t.length<1&&console.warn("No instructions provided");let s;if(this.feePayer)s=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)s=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let h=0;h<t.length;h++)if(t[h].programId===void 0)throw new Error(`Transaction instruction index ${h} has undefined program id`);const i=[],a=[];t.forEach(h=>{h.keys.forEach(T=>{a.push({...T})});const w=h.programId.toString();i.includes(w)||i.push(w)}),i.forEach(h=>{a.push({pubkey:new y(h),isSigner:!1,isWritable:!1})});const u=[];a.forEach(h=>{const w=h.pubkey.toString(),T=u.findIndex(F=>F.pubkey.toString()===w);T>-1?(u[T].isWritable=u[T].isWritable||h.isWritable,u[T].isSigner=u[T].isSigner||h.isSigner):u.push(h)}),u.sort(function(h,w){if(h.isSigner!==w.isSigner)return h.isSigner?-1:1;if(h.isWritable!==w.isWritable)return h.isWritable?-1:1;const T={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return h.pubkey.toBase58().localeCompare(w.pubkey.toBase58(),"en",T)});const m=u.findIndex(h=>h.pubkey.equals(s));if(m>-1){const[h]=u.splice(m,1);h.isSigner=!0,h.isWritable=!0,u.unshift(h)}else u.unshift({pubkey:s,isSigner:!0,isWritable:!0});for(const h of this.signatures){const w=u.findIndex(T=>T.pubkey.equals(h.publicKey));if(w>-1)u[w].isSigner||(u[w].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${h.publicKey.toString()}`)}let l=0,b=0,k=0;const M=[],I=[];u.forEach(({pubkey:h,isSigner:w,isWritable:T})=>{w?(M.push(h.toString()),l+=1,T||(b+=1)):(I.push(h.toString()),T||(k+=1))});const v=M.concat(I),E=t.map(h=>{const{data:w,programId:T}=h;return{programIdIndex:v.indexOf(T.toString()),accounts:h.keys.map(F=>v.indexOf(F.pubkey.toString())),data:n.bs58.encode(w)}});return E.forEach(h=>{C(h.programIdIndex>=0),h.accounts.forEach(w=>C(w>=0))}),new ie({header:{numRequiredSignatures:l,numReadonlySignedAccounts:b,numReadonlyUnsignedAccounts:k},accountKeys:v,recentBlockhash:e,instructions:E})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((i,a)=>t[a].equals(i.publicKey))||(this.signatures=t.map(s=>({signature:null,publicKey:s}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(s=>{const i=s.toString();return t.has(i)?!1:(t.add(i),!0)}).map(s=>({signature:null,publicKey:s}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}this.signatures=s.map(a=>({signature:null,publicKey:a.publicKey}));const i=this._compile();this._partialSign(i,...s)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}const i=this._compile();this._partialSign(i,...s)}_partialSign(e,...t){const s=e.serialize();t.forEach(i=>{const a=vt(s,i.secretKey);this._addSignature(i.publicKey,K(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){C(t.length===64);const s=this.signatures.findIndex(i=>e.equals(i.publicKey));if(s<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[s].signature=n.bufferPolyfill.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const s={};for(const{signature:i,publicKey:a}of this.signatures)i===null?t&&(s.missing||(s.missing=[])).push(a):Tt(i,e,a.toBytes())||(s.invalid||(s.invalid=[])).push(a);return s.invalid||s.missing?s:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:s}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(s){const a=this._getMessageSignednessErrors(i,t);if(a){let u="Signature verification failed.";throw a.invalid&&(u+=`
|
|
1
|
+
"use strict";var yt=Object.defineProperty;var pt=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var V=(r,e,t)=>(pt(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-D1bcMAs6.js"),ht=require("./chain-y7sg4yrp.js"),$=require("./solana-DWLxhhWn.js"),Le=require("./index-DnneI5--.js");class bt extends TypeError{constructor(e,t){let s;const{message:i,...a}=e,{path:u}=e,m=u.length===0?i:"At path: "+u.join(".")+" -- "+i;super(m),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var l;return(l=s)!=null?l:s=[e,...t()]}}}function St(r){return q(r)&&typeof r[Symbol.iterator]=="function"}function q(r){return typeof r=="object"&&r!=null}function W(r){return typeof r=="string"?JSON.stringify(r):""+r}function kt(r){const{done:e,value:t}=r.next();return e?void 0:t}function Mt(r,e,t,s){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:a}=e,{type:u}=t,{refinement:m,message:l="Expected a value of type `"+u+"`"+(m?" with refinement `"+m+"`":"")+", but received: `"+W(s)+"`"}=r;return{value:s,type:u,refinement:m,key:i[i.length-1],path:i,branch:a,...r,message:l}}function*Re(r,e,t,s){St(r)||(r=[r]);for(const i of r){const a=Mt(i,e,t,s);a&&(yield a)}}function*ke(r,e,t={}){const{path:s=[],branch:i=[r],coerce:a=!1,mask:u=!1}=t,m={path:s,branch:i};if(a&&(r=e.coercer(r,m),u&&e.type!=="type"&&q(e.schema)&&q(r)&&!Array.isArray(r)))for(const b in r)e.schema[b]===void 0&&delete r[b];let l=!0;for(const b of e.validator(r,m))l=!1,yield[b,void 0];for(let[b,k,M]of e.entries(r,m)){const I=ke(k,M,{path:b===void 0?s:[...s,b],branch:b===void 0?i:[...i,k],coerce:a,mask:u});for(const v of I)v[0]?(l=!1,yield[v[0],void 0]):a&&(k=v[1],b===void 0?r=k:r instanceof Map?r.set(b,k):r instanceof Set?r.add(k):q(r)&&(r[b]=k))}if(l)for(const b of e.refiner(r,m))l=!1,yield[b,void 0];l&&(yield[void 0,r])}let U=class{constructor(e){const{type:t,schema:s,validator:i,refiner:a,coercer:u=l=>l,entries:m=function*(){}}=e;this.type=t,this.schema=s,this.entries=m,this.coercer=u,i?this.validator=(l,b)=>{const k=i(l,b);return Re(k,b,this,l)}:this.validator=()=>[],a?this.refiner=(l,b)=>{const k=a(l,b);return Re(k,b,this,l)}:this.refiner=()=>[]}assert(e){return wt(e,this)}create(e){return re(e,this)}is(e){return Ue(e,this)}mask(e){return Pt(e,this)}validate(e,t={}){return oe(e,this,t)}};function wt(r,e){const t=oe(r,e);if(t[0])throw t[0]}function re(r,e){const t=oe(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function Pt(r,e){const t=oe(r,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Ue(r,e){return!oe(r,e)[0]}function oe(r,e,t={}){const s=ke(r,e,t),i=kt(s);return i[0]?[new bt(i[0],function*(){for(const u of s)u[0]&&(yield u[0])}),void 0]:[void 0,i[1]]}function H(r,e){return new U({type:r,schema:null,validator:e})}function At(){return H("any",()=>!0)}function g(r){return new U({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,s]of e.entries())yield[t,s,r]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+W(e)}})}function L(){return H("boolean",r=>typeof r=="boolean")}function Me(r){return H("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+W(e))}function A(r){const e=W(r),t=typeof r;return new U({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator(s){return s===r||"Expected the literal `"+e+"`, but received: "+W(s)}})}function It(){return H("never",()=>!1)}function f(r){return new U({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function o(){return H("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+W(r))}function p(r){return new U({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function qe(r,e){return new U({type:"record",schema:null,*entries(t){if(q(t))for(const s in t){const i=t[s];yield[s,s,r],yield[s,i,e]}},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function d(){return H("string",r=>typeof r=="string"||"Expected a string, but received: "+W(r))}function we(r){const e=It();return new U({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const s=Math.max(r.length,t.length);for(let i=0;i<s;i++)yield[i,t[i],r[i]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+W(t)}})}function c(r){const e=Object.keys(r);return new U({type:"type",schema:r,*entries(t){if(q(t))for(const s of e)yield[s,t[s],r[s]]},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function R(r){const e=r.map(t=>t.type).join(" | ");return new U({type:"union",schema:null,validator(t,s){const i=[];for(const a of r){const[...u]=ke(t,a,s),[m]=u;if(m[0])for(const[l]of u)l&&i.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+W(t),...i]}})}function ue(){return H("unknown",()=>!0)}function ce(r,e,t){return new U({...r,coercer:(s,i)=>Ue(s,e)?r.coercer(t(s,i),i):r.coercer(s,i)})}const Ee=()=>{const r=n.ed25519.utils.randomPrivateKey(),e=he(r),t=new Uint8Array(64);return t.set(r),t.set(e,32),{publicKey:e,secretKey:t}},he=n.ed25519.getPublicKey;function Ce(r){try{return n.ed25519.ExtendedPoint.fromHex(r),!0}catch{return!1}}const vt=(r,e)=>n.ed25519.sign(r,e.slice(0,32)),Tt=n.ed25519.verify,K=r=>n.bufferPolyfill.Buffer.isBuffer(r)?r:r instanceof Uint8Array?n.bufferPolyfill.Buffer.from(r.buffer,r.byteOffset,r.byteLength):n.bufferPolyfill.Buffer.from(r);class xt{constructor(e){Object.assign(this,e)}encode(){return n.bufferPolyfill.Buffer.from(n.serialize_1(de,this))}static decode(e){return n.deserialize_1(de,this,e)}static decodeUnchecked(e){return n.deserializeUnchecked_1(de,this,e)}}const de=new Map;var Fe;let Ve;const Bt=32,ne=32;function Kt(r){return r._bn!==void 0}let Oe=1;Ve=Symbol.toStringTag;class y extends xt{constructor(e){if(super({}),this._bn=void 0,Kt(e))this._bn=e._bn;else{if(typeof e=="string"){const t=n.bs58.decode(e);if(t.length!=ne)throw new Error("Invalid public key input");this._bn=new n.BN(t)}else this._bn=new n.BN(e);if(this._bn.byteLength()>ne)throw new Error("Invalid public key input")}}static unique(){const e=new y(Oe);return Oe+=1,new y(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return n.bs58.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(n.bufferPolyfill.Buffer);if(e.length===ne)return e;const t=n.bufferPolyfill.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,s){const i=n.bufferPolyfill.Buffer.concat([e.toBuffer(),n.bufferPolyfill.Buffer.from(t),s.toBuffer()]),a=n.sha256(i);return new y(a)}static createProgramAddressSync(e,t){let s=n.bufferPolyfill.Buffer.alloc(0);e.forEach(function(a){if(a.length>Bt)throw new TypeError("Max seed length exceeded");s=n.bufferPolyfill.Buffer.concat([s,K(a)])}),s=n.bufferPolyfill.Buffer.concat([s,t.toBuffer(),n.bufferPolyfill.Buffer.from("ProgramDerivedAddress")]);const i=n.sha256(s);if(Ce(i))throw new Error("Invalid seeds, address must fall off the curve");return new y(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let s=255,i;for(;s!=0;){try{const a=e.concat(n.bufferPolyfill.Buffer.from([s]));i=this.createProgramAddressSync(a,t)}catch(a){if(a instanceof TypeError)throw a;s--;continue}return[i,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){const t=new y(e);return Ce(t.toBytes())}}Fe=y;y.default=new Fe("11111111111111111111111111111111");de.set(y,{kind:"struct",fields:[["_bn","u256"]]});new y("BPFLoader1111111111111111111111111111111111");const be=1232,Rt=127,He=64;class Ne{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const s=new Map;this.keySegments().flat().forEach((a,u)=>{s.set(a.toBase58(),u)});const i=a=>{const u=s.get(a.toBase58());if(u===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return u};return e.map(a=>({programIdIndex:i(a.programId),accountKeyIndexes:a.keys.map(u=>i(u.pubkey)),data:a.data}))}}const S=(r="publicKey")=>n.blob(32,r),J=(r="string")=>{const e=n.struct([n.u32("length"),n.u32("lengthPadding"),n.blob(n.offset(n.u32(),-8),"chars")],r),t=e.decode.bind(e),s=e.encode.bind(e),i=e;return i.decode=(a,u)=>t(a,u).chars.toString(),i.encode=(a,u,m)=>{const l={chars:n.bufferPolyfill.Buffer.from(a,"utf8")};return s(l,u,m)},i.alloc=a=>n.u32().span+n.u32().span+n.bufferPolyfill.Buffer.from(a,"utf8").length,i},Et=(r="authorized")=>n.struct([S("staker"),S("withdrawer")],r),Ct=(r="lockup")=>n.struct([n.ns64("unixTimestamp"),n.ns64("epoch"),S("custodian")],r),Ot=(r="voteInit")=>n.struct([S("nodePubkey"),S("authorizedVoter"),S("authorizedWithdrawer"),n.u8("commission")],r),Nt=(r="voteAuthorizeWithSeedArgs")=>n.struct([n.u32("voteAuthorizationType"),S("currentAuthorityDerivedKeyOwnerPubkey"),J("currentAuthorityDerivedKeySeed"),S("newAuthorized")],r);function je(r,e){const t=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){const a=e[i.property];if(Array.isArray(a))return a.length*t(i.elementLayout)}else if("fields"in i)return je({layout:i},e[i.property]);return 0};let s=0;return r.layout.fields.forEach(i=>{s+=t(i)}),s}function Q(r){let e=0,t=0;for(;;){let s=r.shift();if(e|=(s&127)<<t*7,t+=1,!(s&128))break}return e}function ee(r,e){let t=e;for(;;){let s=t&127;if(t>>=7,t==0){r.push(s);break}else s|=128,r.push(s)}}function C(r,e){if(!r)throw new Error(e||"Assertion failed")}class Pe{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const s=new Map,i=u=>{const m=u.toBase58();let l=s.get(m);return l===void 0&&(l={isSigner:!1,isWritable:!1,isInvoked:!1},s.set(m,l)),l},a=i(t);a.isSigner=!0,a.isWritable=!0;for(const u of e){i(u.programId).isInvoked=!0;for(const m of u.keys){const l=i(m.pubkey);l.isSigner||(l.isSigner=m.isSigner),l.isWritable||(l.isWritable=m.isWritable)}}return new Pe(t,s)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];C(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,l])=>l.isSigner&&l.isWritable),s=e.filter(([,l])=>l.isSigner&&!l.isWritable),i=e.filter(([,l])=>!l.isSigner&&l.isWritable),a=e.filter(([,l])=>!l.isSigner&&!l.isWritable),u={numRequiredSignatures:t.length+s.length,numReadonlySignedAccounts:s.length,numReadonlyUnsignedAccounts:a.length};{C(t.length>0,"Expected at least one writable signer key");const[l]=t[0];C(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const m=[...t.map(([l])=>new y(l)),...s.map(([l])=>new y(l)),...i.map(([l])=>new y(l)),...a.map(([l])=>new y(l))];return[u,m]}extractTableLookup(e){const[t,s]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&u.isWritable),[i,a]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&!u.isWritable);if(!(t.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:s,readonly:a}]}drainKeysFoundInLookupTable(e,t){const s=new Array,i=new Array;for(const[a,u]of this.keyMetaMap.entries())if(t(u)){const m=new y(a),l=e.findIndex(b=>b.equals(m));l>=0&&(C(l<256,"Max lookup table index exceeded"),s.push(l),i.push(m),this.keyMetaMap.delete(a))}return[s,i]}}const Ge="Reached end of buffer unexpectedly";function le(r){if(r.length===0)throw new Error(Ge);return r.shift()}function te(r,...e){const[t]=e;if(e.length===2?t+(e[1]??0)>r.length:t>=r.length)throw new Error(Ge);return r.splice(...e)}class ie{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new y(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:n.bs58.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Ne(this.staticAccountKeys)}static compile(e){const t=Pe.compile(e.instructions,e.payerKey),[s,i]=t.getMessageComponents(),u=new Ne(i).compileInstructions(e.instructions).map(m=>({programIdIndex:m.programIdIndex,accounts:m.accountKeyIndexes,data:n.bs58.encode(m.data)}));return new ie({header:s,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:u})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){const s=e-t,a=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return s<a}else{const s=t-this.header.numReadonlySignedAccounts;return e<s}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];ee(t,e);const s=this.instructions.map(M=>{const{accounts:I,programIdIndex:v}=M,E=Array.from(n.bs58.decode(M.data));let h=[];ee(h,I.length);let w=[];return ee(w,E.length),{programIdIndex:v,keyIndicesCount:n.bufferPolyfill.Buffer.from(h),keyIndices:I,dataLength:n.bufferPolyfill.Buffer.from(w),data:E}});let i=[];ee(i,s.length);let a=n.bufferPolyfill.Buffer.alloc(be);n.bufferPolyfill.Buffer.from(i).copy(a);let u=i.length;s.forEach(M=>{const v=n.struct([n.u8("programIdIndex"),n.blob(M.keyIndicesCount.length,"keyIndicesCount"),n.seq(n.u8("keyIndex"),M.keyIndices.length,"keyIndices"),n.blob(M.dataLength.length,"dataLength"),n.seq(n.u8("userdatum"),M.data.length,"data")]).encode(M,a,u);u+=v}),a=a.slice(0,u);const m=n.struct([n.blob(1,"numRequiredSignatures"),n.blob(1,"numReadonlySignedAccounts"),n.blob(1,"numReadonlyUnsignedAccounts"),n.blob(t.length,"keyCount"),n.seq(S("key"),e,"keys"),S("recentBlockhash")]),l={numRequiredSignatures:n.bufferPolyfill.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.bufferPolyfill.Buffer.from(t),keys:this.accountKeys.map(M=>K(M.toBytes())),recentBlockhash:n.bs58.decode(this.recentBlockhash)};let b=n.bufferPolyfill.Buffer.alloc(2048);const k=m.encode(l,b);return a.copy(b,k),b.slice(0,k+a.length)}static from(e){let t=[...e];const s=le(t);if(s!==(s&Rt))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=le(t),a=le(t),u=Q(t);let m=[];for(let I=0;I<u;I++){const v=te(t,0,ne);m.push(new y(n.bufferPolyfill.Buffer.from(v)))}const l=te(t,0,ne),b=Q(t);let k=[];for(let I=0;I<b;I++){const v=le(t),E=Q(t),h=te(t,0,E),w=Q(t),T=te(t,0,w),F=n.bs58.encode(n.bufferPolyfill.Buffer.from(T));k.push({programIdIndex:v,accounts:h,data:F})}const M={header:{numRequiredSignatures:s,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:a},recentBlockhash:n.bs58.encode(n.bufferPolyfill.Buffer.from(l)),accountKeys:m,instructions:k};return new ie(M)}}const _t=n.bufferPolyfill.Buffer.alloc(He).fill(0);class z{constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.bufferPolyfill.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:s})=>({pubkey:e.toJSON(),isSigner:t,isWritable:s})),programId:this.programId.toJSON(),data:[...this.data]}}}class X{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:s}=e;this.minNonceContextSlot=t,this.nonceInfo=s}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:s}=e;this.recentBlockhash=t,this.lastValidBlockHeight=s}else{const{recentBlockhash:t,nonceInfo:s}=e;s&&(this.nonceInfo=s),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new z(t))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?t=[this.nonceInfo.nonceInstruction,...this.instructions]:t=this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");t.length<1&&console.warn("No instructions provided");let s;if(this.feePayer)s=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)s=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let h=0;h<t.length;h++)if(t[h].programId===void 0)throw new Error(`Transaction instruction index ${h} has undefined program id`);const i=[],a=[];t.forEach(h=>{h.keys.forEach(T=>{a.push({...T})});const w=h.programId.toString();i.includes(w)||i.push(w)}),i.forEach(h=>{a.push({pubkey:new y(h),isSigner:!1,isWritable:!1})});const u=[];a.forEach(h=>{const w=h.pubkey.toString(),T=u.findIndex(F=>F.pubkey.toString()===w);T>-1?(u[T].isWritable=u[T].isWritable||h.isWritable,u[T].isSigner=u[T].isSigner||h.isSigner):u.push(h)}),u.sort(function(h,w){if(h.isSigner!==w.isSigner)return h.isSigner?-1:1;if(h.isWritable!==w.isWritable)return h.isWritable?-1:1;const T={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return h.pubkey.toBase58().localeCompare(w.pubkey.toBase58(),"en",T)});const m=u.findIndex(h=>h.pubkey.equals(s));if(m>-1){const[h]=u.splice(m,1);h.isSigner=!0,h.isWritable=!0,u.unshift(h)}else u.unshift({pubkey:s,isSigner:!0,isWritable:!0});for(const h of this.signatures){const w=u.findIndex(T=>T.pubkey.equals(h.publicKey));if(w>-1)u[w].isSigner||(u[w].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${h.publicKey.toString()}`)}let l=0,b=0,k=0;const M=[],I=[];u.forEach(({pubkey:h,isSigner:w,isWritable:T})=>{w?(M.push(h.toString()),l+=1,T||(b+=1)):(I.push(h.toString()),T||(k+=1))});const v=M.concat(I),E=t.map(h=>{const{data:w,programId:T}=h;return{programIdIndex:v.indexOf(T.toString()),accounts:h.keys.map(F=>v.indexOf(F.pubkey.toString())),data:n.bs58.encode(w)}});return E.forEach(h=>{C(h.programIdIndex>=0),h.accounts.forEach(w=>C(w>=0))}),new ie({header:{numRequiredSignatures:l,numReadonlySignedAccounts:b,numReadonlyUnsignedAccounts:k},accountKeys:v,recentBlockhash:e,instructions:E})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((i,a)=>t[a].equals(i.publicKey))||(this.signatures=t.map(s=>({signature:null,publicKey:s}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(s=>{const i=s.toString();return t.has(i)?!1:(t.add(i),!0)}).map(s=>({signature:null,publicKey:s}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}this.signatures=s.map(a=>({signature:null,publicKey:a.publicKey}));const i=this._compile();this._partialSign(i,...s)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}const i=this._compile();this._partialSign(i,...s)}_partialSign(e,...t){const s=e.serialize();t.forEach(i=>{const a=vt(s,i.secretKey);this._addSignature(i.publicKey,K(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){C(t.length===64);const s=this.signatures.findIndex(i=>e.equals(i.publicKey));if(s<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[s].signature=n.bufferPolyfill.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const s={};for(const{signature:i,publicKey:a}of this.signatures)i===null?t&&(s.missing||(s.missing=[])).push(a):Tt(i,e,a.toBytes())||(s.invalid||(s.invalid=[])).push(a);return s.invalid||s.missing?s:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:s}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(s){const a=this._getMessageSignednessErrors(i,t);if(a){let u="Signature verification failed.";throw a.invalid&&(u+=`
|
|
2
2
|
Invalid signature for public key${a.invalid.length===1?"":"(s)"} [\`${a.invalid.map(m=>m.toBase58()).join("`, `")}\`].`),a.missing&&(u+=`
|
|
3
3
|
Missing signature for public key${a.missing.length===1?"":"(s)"} [\`${a.missing.map(m=>m.toBase58()).join("`, `")}\`].`),new Error(u)}}return this._serialize(i)}_serialize(e){const{signatures:t}=this,s=[];ee(s,t.length);const i=s.length+t.length*64+e.length,a=n.bufferPolyfill.Buffer.alloc(i);return C(t.length<256),n.bufferPolyfill.Buffer.from(s).copy(a,0),t.forEach(({signature:u},m)=>{u!==null&&(C(u.length===64,"signature has invalid length"),n.bufferPolyfill.Buffer.from(u).copy(a,s.length+m*64))}),e.copy(a,s.length+t.length*64),C(a.length<=be,`Transaction too large: ${a.length} > ${be}`),a}get keys(){return C(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return C(this.instructions.length===1),this.instructions[0].programId}get data(){return C(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const s=Q(t);let i=[];for(let a=0;a<s;a++){const u=te(t,0,He);i.push(n.bs58.encode(n.bufferPolyfill.Buffer.from(u)))}return X.populate(ie.from(t),i)}static populate(e,t=[]){const s=new X;return s.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(s.feePayer=e.accountKeys[0]),t.forEach((i,a)=>{const u={signature:i==n.bs58.encode(_t)?null:n.bs58.decode(i),publicKey:e.accountKeys[a]};s.signatures.push(u)}),e.instructions.forEach(i=>{const a=i.accounts.map(u=>{const m=e.accountKeys[u];return{pubkey:m,isSigner:s.signatures.some(l=>l.publicKey.toString()===m.toString())||e.isAccountSigner(u),isWritable:e.isAccountWritable(u)}});s.instructions.push(new z({keys:a,programId:e.accountKeys[i.programIdIndex],data:n.bs58.decode(i.data)}))}),s._message=e,s._json=s.toJSON(),s}}new y("SysvarC1ock11111111111111111111111111111111");new y("SysvarEpochSchedu1e111111111111111111111111");new y("Sysvar1nstructions1111111111111111111111111");const pe=new y("SysvarRecentB1ockHashes11111111111111111111"),_e=new y("SysvarRent111111111111111111111111111111111");new y("SysvarRewards111111111111111111111111111111");new y("SysvarS1otHashes111111111111111111111111111");new y("SysvarS1otHistory11111111111111111111111111");new y("SysvarStakeHistory1111111111111111111111111");function O(r,e){const t=r.layout.span>=0?r.layout.span:je(r,e),s=n.bufferPolyfill.Buffer.alloc(t),i=Object.assign({instruction:r.index},e);return r.layout.encode(i,s),s}const Dt=n.nu64("lamportsPerSignature"),zt=n.struct([n.u32("version"),n.u32("state"),S("authorizedPubkey"),S("nonce"),n.struct([Dt],"feeCalculator")]),De=zt.span,Wt=r=>{const e=r.decode.bind(r),t=r.encode.bind(r);return{decode:e,encode:t}},Lt=r=>e=>{const t=n.blob(r,e),{encode:s,decode:i}=Wt(t),a=t;return a.decode=(u,m)=>{const l=i(u,m);return n.toBigIntLE_1(n.bufferPolyfill.Buffer.from(l))},a.encode=(u,m,l)=>{const b=n.toBufferLE_1(u,r);return s(b,m,l)},a},Y=Lt(8),N=Object.freeze({Create:{index:0,layout:n.struct([n.u32("instruction"),n.ns64("lamports"),n.ns64("space"),S("programId")])},Assign:{index:1,layout:n.struct([n.u32("instruction"),S("programId")])},Transfer:{index:2,layout:n.struct([n.u32("instruction"),Y("lamports")])},CreateWithSeed:{index:3,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),n.ns64("lamports"),n.ns64("space"),S("programId")])},AdvanceNonceAccount:{index:4,layout:n.struct([n.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:n.struct([n.u32("instruction"),S("authorized")])},AuthorizeNonceAccount:{index:7,layout:n.struct([n.u32("instruction"),S("authorized")])},Allocate:{index:8,layout:n.struct([n.u32("instruction"),n.ns64("space")])},AllocateWithSeed:{index:9,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),n.ns64("space"),S("programId")])},AssignWithSeed:{index:10,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),S("programId")])},TransferWithSeed:{index:11,layout:n.struct([n.u32("instruction"),Y("lamports"),J("seed"),S("programId")])},UpgradeNonceAccount:{index:12,layout:n.struct([n.u32("instruction")])}});class ae{constructor(){}static createAccount(e){const t=N.Create,s=O(t,{lamports:e.lamports,space:e.space,programId:K(e.programId.toBuffer())});return new z({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:s})}static transfer(e){let t,s;if("basePubkey"in e){const i=N.TransferWithSeed;t=O(i,{lamports:BigInt(e.lamports),seed:e.seed,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{const i=N.Transfer;t=O(i,{lamports:BigInt(e.lamports)}),s=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}static assign(e){let t,s;if("basePubkey"in e){const i=N.AssignWithSeed;t=O(i,{base:K(e.basePubkey.toBuffer()),seed:e.seed,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const i=N.Assign;t=O(i,{programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=N.CreateWithSeed,s=O(t,{base:K(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:K(e.programId.toBuffer())});let i=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&i.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new z({keys:i,programId:this.programId,data:s})}static createNonceAccount(e){const t=new X;"basePubkey"in e&&"seed"in e?t.add(ae.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:De,programId:this.programId})):t.add(ae.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:De,programId:this.programId}));const s={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(s)),t}static nonceInitialize(e){const t=N.InitializeNonceAccount,s=O(t,{authorized:K(e.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:_e,isSigner:!1,isWritable:!1}],programId:this.programId,data:s};return new z(i)}static nonceAdvance(e){const t=N.AdvanceNonceAccount,s=O(t),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s};return new z(i)}static nonceWithdraw(e){const t=N.WithdrawNonceAccount,s=O(t,{lamports:e.lamports});return new z({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:_e,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static nonceAuthorize(e){const t=N.AuthorizeNonceAccount,s=O(t,{authorized:K(e.newAuthorizedPubkey.toBuffer())});return new z({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static allocate(e){let t,s;if("basePubkey"in e){const i=N.AllocateWithSeed;t=O(i,{base:K(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const i=N.Allocate;t=O(i,{space:e.space}),s=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}}ae.programId=new y("11111111111111111111111111111111");new y("BPFLoader2111111111111111111111111111111111");n.struct([n.u32("typeIndex"),Y("deactivationSlot"),n.nu64("lastExtendedSlot"),n.u8("lastExtendedStartIndex"),n.u8(),n.seq(S(),n.offset(n.u8(),-1),"authority")]);const x=ce(Me(y),d(),r=>new y(r)),$e=we([d(),A("base64")]),Ae=ce(Me(n.bufferPolyfill.Buffer),$e,r=>n.bufferPolyfill.Buffer.from(r[0],"base64"));function Je(r){return R([c({jsonrpc:A("2.0"),id:d(),result:r}),c({jsonrpc:A("2.0"),id:d(),error:c({code:ue(),message:d(),data:p(At())})})])}const Ut=Je(ue());function P(r){return ce(Je(r),Ut,e=>"error"in e?e:{...e,result:re(e.result,r)})}function _(r){return P(c({context:c({slot:o()}),value:r}))}function fe(r){return c({context:c({slot:o()}),value:r})}const qt=c({foundation:o(),foundationTerm:o(),initial:o(),taper:o(),terminal:o()});P(g(f(c({epoch:o(),effectiveSlot:o(),amount:o(),postBalance:o(),commission:p(f(o()))}))));const Ft=g(c({slot:o(),prioritizationFee:o()})),Vt=c({total:o(),validator:o(),foundation:o(),epoch:o()}),Ht=c({epoch:o(),slotIndex:o(),slotsInEpoch:o(),absoluteSlot:o(),blockHeight:p(o()),transactionCount:p(o())}),jt=c({slotsPerEpoch:o(),leaderScheduleSlotOffset:o(),warmup:L(),firstNormalEpoch:o(),firstNormalSlot:o()}),Gt=qe(d(),g(o())),j=f(R([c({}),d()])),$t=c({err:j}),Jt=A("receivedSignature");c({"solana-core":d(),"feature-set":p(o())});_(c({err:f(R([c({}),d()])),logs:f(g(d())),accounts:p(f(g(f(c({executable:L(),owner:d(),lamports:o(),data:g(d()),rentEpoch:p(o())}))))),unitsConsumed:p(o()),returnData:p(f(c({programId:d(),data:we([d(),A("base64")])})))}));_(c({byIdentity:qe(d(),g(o())),range:c({firstSlot:o(),lastSlot:o()})}));P(qt);P(Vt);P(Ft);P(Ht);P(jt);P(Gt);P(o());_(c({total:o(),circulating:o(),nonCirculating:o(),nonCirculatingAccounts:g(x)}));const Xt=c({amount:d(),uiAmount:f(o()),decimals:o(),uiAmountString:p(d())});_(g(c({address:x,amount:d(),uiAmount:f(o()),decimals:o(),uiAmountString:p(d())})));_(g(c({pubkey:x,account:c({executable:L(),owner:x,lamports:o(),data:Ae,rentEpoch:o()})})));const Se=c({program:d(),parsed:ue(),space:o()});_(g(c({pubkey:x,account:c({executable:L(),owner:x,lamports:o(),data:Se,rentEpoch:o()})})));_(g(c({lamports:o(),address:x})));const Ie=c({executable:L(),owner:x,lamports:o(),data:Ae,rentEpoch:o()});c({pubkey:x,account:Ie});const Yt=ce(R([Me(n.bufferPolyfill.Buffer),Se]),R([$e,Se]),r=>Array.isArray(r)?re(r,Ae):r),Zt=c({executable:L(),owner:x,lamports:o(),data:Yt,rentEpoch:o()});c({pubkey:x,account:Zt});c({state:R([A("active"),A("inactive"),A("activating"),A("deactivating")]),active:o(),inactive:o()});P(g(c({signature:d(),slot:o(),err:j,memo:f(d()),blockTime:p(f(o()))})));P(g(c({signature:d(),slot:o(),err:j,memo:f(d()),blockTime:p(f(o()))})));c({subscription:o(),result:fe(Ie)});const Qt=c({pubkey:x,account:Ie});c({subscription:o(),result:fe(Qt)});const en=c({parent:o(),slot:o(),root:o()});c({subscription:o(),result:en});const tn=R([c({type:R([A("firstShredReceived"),A("completed"),A("optimisticConfirmation"),A("root")]),slot:o(),timestamp:o()}),c({type:A("createdBank"),parent:o(),slot:o(),timestamp:o()}),c({type:A("frozen"),slot:o(),timestamp:o(),stats:c({numTransactionEntries:o(),numSuccessfulTransactions:o(),numFailedTransactions:o(),maxTransactionsPerEntry:o()})}),c({type:A("dead"),slot:o(),timestamp:o(),err:d()})]);c({subscription:o(),result:tn});c({subscription:o(),result:fe(R([$t,Jt]))});c({subscription:o(),result:o()});c({pubkey:d(),gossip:f(d()),tpu:f(d()),rpc:f(d()),version:f(d())});const ze=c({votePubkey:d(),nodePubkey:d(),activatedStake:o(),epochVoteAccount:L(),epochCredits:g(we([o(),o(),o()])),commission:o(),lastVote:o(),rootSlot:f(o())});P(c({current:g(ze),delinquent:g(ze)}));const nn=R([A("processed"),A("confirmed"),A("finalized")]),sn=c({slot:o(),confirmations:f(o()),err:j,confirmationStatus:p(nn)});_(g(f(sn)));P(o());const Xe=c({accountKey:x,writableIndexes:g(o()),readonlyIndexes:g(o())}),ve=c({signatures:g(d()),message:c({accountKeys:g(d()),header:c({numRequiredSignatures:o(),numReadonlySignedAccounts:o(),numReadonlyUnsignedAccounts:o()}),instructions:g(c({accounts:g(o()),data:d(),programIdIndex:o()})),recentBlockhash:d(),addressTableLookups:p(g(Xe))})}),Ye=c({pubkey:x,signer:L(),writable:L(),source:p(R([A("transaction"),A("lookupTable")]))}),Ze=c({accountKeys:g(Ye),signatures:g(d())}),Qe=c({parsed:ue(),program:d(),programId:x}),et=c({accounts:g(x),data:d(),programId:x}),rn=R([et,Qe]),an=R([c({parsed:ue(),program:d(),programId:d()}),c({accounts:g(d()),data:d(),programId:d()})]),tt=ce(rn,an,r=>"accounts"in r?re(r,et):re(r,Qe)),nt=c({signatures:g(d()),message:c({accountKeys:g(Ye),instructions:g(tt),recentBlockhash:d(),addressTableLookups:p(f(g(Xe)))})}),me=c({accountIndex:o(),mint:d(),owner:p(d()),uiTokenAmount:Xt}),st=c({writable:g(x),readonly:g(x)}),ge=c({err:j,fee:o(),innerInstructions:p(f(g(c({index:o(),instructions:g(c({accounts:g(o()),data:d(),programIdIndex:o()}))})))),preBalances:g(o()),postBalances:g(o()),logMessages:p(f(g(d()))),preTokenBalances:p(f(g(me))),postTokenBalances:p(f(g(me))),loadedAddresses:p(st),computeUnitsConsumed:p(o())}),Te=c({err:j,fee:o(),innerInstructions:p(f(g(c({index:o(),instructions:g(tt)})))),preBalances:g(o()),postBalances:g(o()),logMessages:p(f(g(d()))),preTokenBalances:p(f(g(me))),postTokenBalances:p(f(g(me))),loadedAddresses:p(st),computeUnitsConsumed:p(o())}),Z=R([A(0),A("legacy")]),G=c({pubkey:d(),lamports:o(),postBalance:f(o()),rewardType:f(d()),commission:p(f(o()))});P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:ve,meta:f(ge),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:Ze,meta:f(ge),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:nt,meta:f(Te),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:Ze,meta:f(Te),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:ve,meta:f(ge)})),rewards:p(g(G)),blockTime:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),signatures:g(d()),blockTime:f(o())})));P(f(c({slot:o(),meta:f(ge),blockTime:p(f(o())),transaction:ve,version:p(Z)})));P(f(c({slot:o(),transaction:nt,meta:f(Te),blockTime:p(f(o())),version:p(Z)})));_(c({blockhash:d(),feeCalculator:c({lamportsPerSignature:o()})}));_(c({blockhash:d(),lastValidBlockHeight:o()}));_(L());const on=c({slot:o(),numTransactions:o(),numSlots:o(),samplePeriodSecs:o()});P(g(on));_(f(c({feeCalculator:c({lamportsPerSignature:o()})})));P(d());P(d());const un=c({err:j,logs:g(d()),signature:d()});c({result:fe(un),subscription:o()});class se{constructor(e){this._keypair=void 0,this._keypair=e??Ee()}static generate(){return new se(Ee())}static fromSecretKey(e,t){if(e.byteLength!==64)throw new Error("bad secret key size");const s=e.slice(32,64);if(!t||!t.skipValidation){const i=e.slice(0,32),a=he(i);for(let u=0;u<32;u++)if(s[u]!==a[u])throw new Error("provided secretKey is invalid")}return new se({publicKey:s,secretKey:e})}static fromSeed(e){const t=he(e),s=new Uint8Array(64);return s.set(e),s.set(t,32),new se({publicKey:t,secretKey:s})}get publicKey(){return new y(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:n.struct([n.u32("instruction"),Y("recentSlot"),n.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:n.struct([n.u32("instruction")])},ExtendLookupTable:{index:2,layout:n.struct([n.u32("instruction"),Y(),n.seq(S(),n.offset(n.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:n.struct([n.u32("instruction")])},CloseLookupTable:{index:4,layout:n.struct([n.u32("instruction")])}});new y("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:n.struct([n.u8("instruction"),n.u32("units"),n.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:n.struct([n.u8("instruction"),n.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:n.struct([n.u8("instruction"),n.u32("units")])},SetComputeUnitPrice:{index:3,layout:n.struct([n.u8("instruction"),Y("microLamports")])}});new y("ComputeBudget111111111111111111111111111111");n.struct([n.u8("numSignatures"),n.u8("padding"),n.u16("signatureOffset"),n.u16("signatureInstructionIndex"),n.u16("publicKeyOffset"),n.u16("publicKeyInstructionIndex"),n.u16("messageDataOffset"),n.u16("messageDataSize"),n.u16("messageInstructionIndex")]);new y("Ed25519SigVerify111111111111111111111111111");n.secp256k1.utils.isValidPrivateKey;n.secp256k1.getPublicKey;n.struct([n.u8("numSignatures"),n.u16("signatureOffset"),n.u8("signatureInstructionIndex"),n.u16("ethAddressOffset"),n.u8("ethAddressInstructionIndex"),n.u16("messageDataOffset"),n.u16("messageDataSize"),n.u8("messageInstructionIndex"),n.blob(20,"ethAddress"),n.blob(64,"signature"),n.u8("recoveryId")]);new y("KeccakSecp256k11111111111111111111111111111");var rt;new y("StakeConfig11111111111111111111111111111111");class it{constructor(e,t,s){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=s}}rt=it;it.default=new rt(0,0,y.default);Object.freeze({Initialize:{index:0,layout:n.struct([n.u32("instruction"),Et(),Ct()])},Authorize:{index:1,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:n.struct([n.u32("instruction")])},Split:{index:3,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},Withdraw:{index:4,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},Deactivate:{index:5,layout:n.struct([n.u32("instruction")])},Merge:{index:7,layout:n.struct([n.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("stakeAuthorizationType"),J("authoritySeed"),S("authorityOwner")])}});new y("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:n.struct([n.u32("instruction"),Ot()])},Authorize:{index:1,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:n.struct([n.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:n.struct([n.u32("instruction"),Nt()])}});new y("Vote111111111111111111111111111111111111111");new y("Va1idator1nfo111111111111111111111111111111");c({name:d(),website:p(d()),details:p(d()),keybaseUsername:p(d())});new y("Vote111111111111111111111111111111111111111");n.struct([S("nodePubkey"),S("authorizedWithdrawer"),n.u8("commission"),n.nu64(),n.seq(n.struct([n.nu64("slot"),n.u32("confirmationCount")]),n.offset(n.u32(),-8),"votes"),n.u8("rootSlotValid"),n.nu64("rootSlot"),n.nu64(),n.seq(n.struct([n.nu64("epoch"),S("authorizedVoter")]),n.offset(n.u32(),-8),"authorizedVoters"),n.struct([n.seq(n.struct([S("authorizedPubkey"),n.nu64("epochOfLastAuthorizedSwitch"),n.nu64("targetEpoch")]),32,"buf"),n.nu64("idx"),n.u8("isEmpty")],"priorVoters"),n.nu64(),n.seq(n.struct([n.nu64("epoch"),n.nu64("credits"),n.nu64("prevCredits")]),n.offset(n.u32(),-8),"epochCredits"),n.struct([n.nu64("slot"),n.nu64("timestamp")],"lastTimestamp")]);const xe=new y("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new y("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const cn=new y("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new y("So11111111111111111111111111111111111111112");new y("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class ln extends Error{constructor(e){super(e)}}class dn extends ln{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const mn=n.struct([n.u32("mintAuthorityOption"),n.publicKey("mintAuthority"),n.u64("supply"),n.u8("decimals"),n.bool("isInitialized"),n.u32("freezeAuthorityOption"),n.publicKey("freezeAuthority")]);mn.span;function fn(r,e,t=!1,s=xe,i=cn){if(!t&&!y.isOnCurve(e.toBuffer()))throw new dn;const[a]=y.findProgramAddressSync([e.toBuffer(),s.toBuffer(),r.toBuffer()],i);return a}function at(r,e){return new n.Program(Be.TokenMessengerIdl,new y(r),e===void 0?{connection:null}:e)}function gn(r,e){return at(r,Le.createReadOnlyProvider(e))}function ot(r,e){return new n.Program(Be.MessageTransmitterIdl,new y(r),e===void 0?{connection:null}:e)}function yn(r,e){return ot(r,Le.createReadOnlyProvider(e))}const B=(r,e,t)=>{const s=[n.dist.Buffer.from(n.index.bytes.utf8.encode(r))];if(t)for(const a of t)typeof a=="string"?s.push(n.dist.Buffer.from(n.index.bytes.utf8.encode(a))):Array.isArray(a)?s.push(n.dist.Buffer.from(a)):n.dist.Buffer.isBuffer(a)?s.push(a):s.push(a.toBuffer());const i=y.findProgramAddressSync(s,e);return{publicKey:i[0],bump:i[1]}};function pn(r,e,t,s,i,a,u,m,l){const b=B("message_transmitter",r),k=B("token_messenger",e),M=B("token_minter",e),I=B("local_token",e,[t]),v=B("remote_token_messenger",e,[s.toString()]),E=B("sender_authority",e),h=at(e),w=B("__event_authority",e);return h.methods.depositForBurn({amount:new n.BN(m.toString()),destinationDomain:s,mintRecipient:new y(u.toUint8Array())}).accounts({owner:i,senderAuthorityPda:E.publicKey,burnTokenAccount:a,messageTransmitter:b.publicKey,tokenMessenger:k.publicKey,remoteTokenMessenger:v.publicKey,tokenMinter:M.publicKey,localToken:I.publicKey,burnTokenMint:t,messageTransmitterProgram:r,tokenMessengerMinterProgram:e,tokenProgram:xe,eventAuthority:w.publicKey,eventRentPayer:i,messageSentEventData:l}).instruction()}const We=6400n;function ut(r){return(r-BigInt(1))/We*We+BigInt(1)}function ct(r,e,t){const s=e.toString();return B("used_nonces",t,[s,ut(r).toString()]).publicKey}async function hn(r,e,t,s,i,a){const u=n.dist.Buffer.from(n.CircleBridge.serialize(s)),m=n.dist.Buffer.from(n.hex.decode(i)),l=new y(t),b=new y(s.payload.burnToken.toUint8Array()),k=new $.SolanaAddress(s.payload.mintRecipient).unwrap(),M=a?new y(a):k,I=s.sourceDomain.toString(),v=B("message_transmitter",r),E=B("token_messenger",e),h=B("token_minter",e),w=B("local_token",e,[l]),T=B("remote_token_messenger",e,[I]),F=B("token_pair",e,[I,b]),lt=B("custody",e,[l]),dt=B("message_transmitter_authority",r,[e]).publicKey,mt=ct(s.nonce,s.sourceDomain,r),ft=B("__event_authority",r),gt=B("__event_authority",e),D=[];D.push({isSigner:!1,isWritable:!1,pubkey:E.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:T.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:h.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:w.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:F.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:k}),D.push({isSigner:!1,isWritable:!0,pubkey:lt.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:xe}),D.push({isSigner:!1,isWritable:!1,pubkey:gt.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:e});const Ke=ot(r);return Ke.methods.receiveMessage({message:u,attestation:m}).accounts({payer:M,caller:M,authorityPda:dt,messageTransmitter:v.publicKey,usedNonces:mt,receiver:e,systemProgram:ae.programId,eventAuthority:ft.publicKey,program:Ke.programId}).remainingAccounts(D).transaction()}class ye{constructor(e,t,s,i){V(this,"network");V(this,"chain");V(this,"connection");V(this,"contracts");V(this,"tokenMessenger");V(this,"messageTransmitter");var m,l;if(this.network=e,this.chain=t,this.connection=s,this.contracts=i,e==="Devnet")throw new Error("CircleBridge not supported on Devnet");const a=(m=i.cctp)==null?void 0:m.messageTransmitter;if(!a)throw new Error(`Circle Messenge Transmitter contract for domain ${t} not found`);this.messageTransmitter=yn(new y(a),this.connection);const u=(l=i.cctp)==null?void 0:l.tokenMessenger;if(!u)throw new Error(`Circle Token Messenger contract for domain ${t} not found`);this.tokenMessenger=gn(new y(u),this.connection)}static async fromRpc(e,t){const[s,i]=await $.SolanaPlatform.chainFromRpc(e),a=t[i];if(a.network!==s)throw new Error(`Network mismatch: ${a.network} != ${s}`);return new ye(s,i,e,a.contracts)}async*redeem(e,t,s){const i=new y(n.usdcContract.get(this.network,this.chain)),a=new $.SolanaAddress(e).unwrap(),u=await hn(this.messageTransmitter.programId,this.tokenMessenger.programId,i,t,s,a),m=new X;m.feePayer=a,m.add(u),yield this.createUnsignedTx({transaction:m},"CircleBridge.Redeem")}async*transfer(e,t,s){const i=new y(n.usdcContract.get(this.network,this.chain)),a=new $.SolanaAddress(e).unwrap(),u=fn(i,a),m=n.circleChainId.get(this.network,t.chain),l=t.address.toUniversalAddress(),b=se.generate(),k=await pn(this.messageTransmitter.programId,this.tokenMessenger.programId,i,m,a,u,l,s,b.publicKey),M=new X;M.feePayer=a,M.add(k),yield this.createUnsignedTx({transaction:M,signers:[b]},"CircleBridge.Transfer")}async isTransferCompleted(e){const t=ct(e.nonce,e.sourceDomain,this.messageTransmitter.programId),s=ut(e.nonce),{usedNonces:i}=await this.messageTransmitter.account.usedNonces.fetch(t),a=Number(e.nonce-s),u=i[Math.floor(a/64)];if(!u)throw new Error("Invalid nonce byte index");const m=a%64,l=new n.BN((BigInt(1)<<BigInt(m)).toString());return!u.and(l).isZero()}async parseTransactionDetails(e){const t=await this.connection.getTransaction(e);if(!t||!t.meta)throw new Error("Transaction not found");const s=t.transaction.message.getAccountKeys();if(s.length<2)throw new Error("No message account found");const i=s.get(1),a=await this.connection.getAccountInfo(i);if(!a)throw new Error("No account data found");const u=new Uint8Array(a.data).slice(44),[m,l]=n.CircleBridge.deserialize(u),{payload:b}=m,k=b.messageSender,M=b.mintRecipient,I=n.toCircleChain(this.network,m.sourceDomain),v=n.toCircleChain(this.network,m.destinationDomain),E={chain:I,address:b.burnToken};return{from:{chain:I,address:k},to:{chain:v,address:M},token:E,amount:b.amount,message:m,id:{hash:l}}}createUnsignedTx(e,t,s=!1){return new $.SolanaUnsignedTransaction(e,this.network,this.chain,t,s)}}const bn={version:"0.1.0",name:"token_messenger_minter",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"upgradeAuthority",isMut:!1,isSigner:!0},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"tokenMessengerMinterProgramData",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"InitializeParams"}}]},{name:"transferOwnership",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"TransferOwnershipParams"}}]},{name:"acceptOwnership",accounts:[{name:"pendingOwner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AcceptOwnershipParams"}}]},{name:"addRemoteTokenMessenger",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AddRemoteTokenMessengerParams"}}]},{name:"removeRemoteTokenMessenger",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"RemoveRemoteTokenMessengerParams"}}]},{name:"depositForBurn",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"burnTokenAccount",isMut:!0,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"burnTokenMint",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DepositForBurnParams"}}],returns:"u64"},{name:"depositForBurnWithCaller",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"burnTokenAccount",isMut:!0,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"burnTokenMint",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DepositForBurnWithCallerParams"}}],returns:"u64"},{name:"replaceDepositForBurn",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReplaceDepositForBurnParams"}}],returns:"u64"},{name:"handleReceiveMessage",accounts:[{name:"authorityPda",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"tokenPair",isMut:!1,isSigner:!1},{name:"recipientTokenAccount",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"HandleReceiveMessageParams"}}]},{name:"setTokenController",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetTokenControllerParams"}}]},{name:"pause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"PauseParams"}}]},{name:"unpause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UnpauseParams"}}]},{name:"updatePauser",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdatePauserParams"}}]},{name:"setMaxBurnAmountPerMessage",accounts:[{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetMaxBurnAmountPerMessageParams"}}]},{name:"addLocalToken",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"localTokenMint",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AddLocalTokenParams"}}]},{name:"removeLocalToken",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"RemoveLocalTokenParams"}}]},{name:"linkTokenPair",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"tokenPair",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"LinkTokenPairParams"}}]},{name:"unlinkTokenPair",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"tokenPair",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UninkTokenPairParams"}}]},{name:"burnTokenCustody",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!1,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"custodyTokenMint",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"BurnTokenCustodyParams"}}]}],accounts:[{name:"tokenMessenger",type:{kind:"struct",fields:[{name:"owner",type:"publicKey"},{name:"pendingOwner",type:"publicKey"},{name:"localMessageTransmitter",type:"publicKey"},{name:"messageBodyVersion",type:"u32"},{name:"authorityBump",type:"u8"}]}},{name:"remoteTokenMessenger",type:{kind:"struct",fields:[{name:"domain",type:"u32"},{name:"tokenMessenger",type:"publicKey"}]}},{name:"tokenMinter",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"},{name:"pauser",type:"publicKey"},{name:"paused",type:"bool"},{name:"bump",type:"u8"}]}},{name:"tokenPair",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"remoteToken",type:"publicKey"},{name:"localToken",type:"publicKey"},{name:"bump",type:"u8"}]}},{name:"localToken",type:{kind:"struct",fields:[{name:"custody",type:"publicKey"},{name:"mint",type:"publicKey"},{name:"burnLimitPerMessage",type:"u64"},{name:"messagesSent",type:"u64"},{name:"messagesReceived",type:"u64"},{name:"amountSent",type:"u128"},{name:"amountReceived",type:"u128"},{name:"bump",type:"u8"},{name:"custodyBump",type:"u8"}]}}],types:[{name:"AcceptOwnershipParams",type:{kind:"struct",fields:[]}},{name:"AddRemoteTokenMessengerParams",type:{kind:"struct",fields:[{name:"domain",type:"u32"},{name:"tokenMessenger",type:"publicKey"}]}},{name:"DepositForBurnWithCallerParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"destinationDomain",type:"u32"},{name:"mintRecipient",type:"publicKey"},{name:"destinationCaller",type:"publicKey"}]}},{name:"DepositForBurnParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"destinationDomain",type:"u32"},{name:"mintRecipient",type:"publicKey"}]}},{name:"HandleReceiveMessageParams",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"sender",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"authorityBump",type:"u8"}]}},{name:"InitializeParams",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"},{name:"localMessageTransmitter",type:"publicKey"},{name:"messageBodyVersion",type:"u32"}]}},{name:"RemoveRemoteTokenMessengerParams",type:{kind:"struct",fields:[]}},{name:"ReplaceDepositForBurnParams",type:{kind:"struct",fields:[{name:"originalMessage",type:"bytes"},{name:"originalAttestation",type:"bytes"},{name:"newDestinationCaller",type:"publicKey"},{name:"newMintRecipient",type:"publicKey"}]}},{name:"TransferOwnershipParams",type:{kind:"struct",fields:[{name:"newOwner",type:"publicKey"}]}},{name:"AddLocalTokenParams",type:{kind:"struct",fields:[]}},{name:"BurnTokenCustodyParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"}]}},{name:"LinkTokenPairParams",type:{kind:"struct",fields:[{name:"localToken",type:"publicKey"},{name:"remoteDomain",type:"u32"},{name:"remoteToken",type:"publicKey"}]}},{name:"PauseParams",type:{kind:"struct",fields:[]}},{name:"RemoveLocalTokenParams",type:{kind:"struct",fields:[]}},{name:"SetMaxBurnAmountPerMessageParams",type:{kind:"struct",fields:[{name:"burnLimitPerMessage",type:"u64"}]}},{name:"SetTokenControllerParams",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"}]}},{name:"UninkTokenPairParams",type:{kind:"struct",fields:[]}},{name:"UnpauseParams",type:{kind:"struct",fields:[]}},{name:"UpdatePauserParams",type:{kind:"struct",fields:[{name:"newPauser",type:"publicKey"}]}},{name:"TokenMinterError",type:{kind:"enum",variants:[{name:"InvalidAuthority"},{name:"InvalidTokenMinterState"},{name:"ProgramPaused"},{name:"InvalidTokenPairState"},{name:"InvalidLocalTokenState"},{name:"InvalidPauser"},{name:"InvalidTokenController"},{name:"BurnAmountExceeded"},{name:"InvalidAmount"}]}}],events:[{name:"OwnershipTransferStarted",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"OwnershipTransferred",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"DepositForBurn",fields:[{name:"nonce",type:"u64",index:!1},{name:"burnToken",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1},{name:"depositor",type:"publicKey",index:!1},{name:"mintRecipient",type:"publicKey",index:!1},{name:"destinationDomain",type:"u32",index:!1},{name:"destinationTokenMessenger",type:"publicKey",index:!1},{name:"destinationCaller",type:"publicKey",index:!1}]},{name:"MintAndWithdraw",fields:[{name:"mintRecipient",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1},{name:"mintToken",type:"publicKey",index:!1}]},{name:"RemoteTokenMessengerAdded",fields:[{name:"domain",type:"u32",index:!1},{name:"tokenMessenger",type:"publicKey",index:!1}]},{name:"RemoteTokenMessengerRemoved",fields:[{name:"domain",type:"u32",index:!1},{name:"tokenMessenger",type:"publicKey",index:!1}]},{name:"SetTokenController",fields:[{name:"tokenController",type:"publicKey",index:!1}]},{name:"PauserChanged",fields:[{name:"newAddress",type:"publicKey",index:!1}]},{name:"SetBurnLimitPerMessage",fields:[{name:"token",type:"publicKey",index:!1},{name:"burnLimitPerMessage",type:"u64",index:!1}]},{name:"LocalTokenAdded",fields:[{name:"custody",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1}]},{name:"LocalTokenRemoved",fields:[{name:"custody",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1}]},{name:"TokenPairLinked",fields:[{name:"localToken",type:"publicKey",index:!1},{name:"remoteDomain",type:"u32",index:!1},{name:"remoteToken",type:"publicKey",index:!1}]},{name:"TokenPairUnlinked",fields:[{name:"localToken",type:"publicKey",index:!1},{name:"remoteDomain",type:"u32",index:!1},{name:"remoteToken",type:"publicKey",index:!1}]},{name:"Pause",fields:[]},{name:"Unpause",fields:[]},{name:"TokenCustodyBurned",fields:[{name:"custodyTokenAccount",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]}],errors:[{code:6e3,name:"InvalidAuthority",msg:"Invalid authority"},{code:6001,name:"InvalidTokenMessengerState",msg:"Invalid token messenger state"},{code:6002,name:"InvalidTokenMessenger",msg:"Invalid token messenger"},{code:6003,name:"InvalidOwner",msg:"Invalid owner"},{code:6004,name:"MalformedMessage",msg:"Malformed message"},{code:6005,name:"InvalidMessageBodyVersion",msg:"Invalid message body version"},{code:6006,name:"InvalidAmount",msg:"Invalid amount"},{code:6007,name:"InvalidDestinationDomain",msg:"Invalid destination domain"},{code:6008,name:"InvalidDestinationCaller",msg:"Invalid destination caller"},{code:6009,name:"InvalidMintRecipient",msg:"Invalid mint recipient"},{code:6010,name:"InvalidSender",msg:"Invalid sender"},{code:6011,name:"InvalidTokenPair",msg:"Invalid token pair"},{code:6012,name:"InvalidTokenMint",msg:"Invalid token mint"}]},Sn={version:"0.1.0",name:"message_transmitter",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"upgradeAuthority",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageTransmitterProgramData",isMut:!1,isSigner:!1},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"InitializeParams"}}]},{name:"transferOwnership",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"TransferOwnershipParams"}}]},{name:"acceptOwnership",accounts:[{name:"pendingOwner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AcceptOwnershipParams"}}]},{name:"updatePauser",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdatePauserParams"}}]},{name:"updateAttesterManager",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdateAttesterManagerParams"}}]},{name:"pause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"PauseParams"}}]},{name:"unpause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UnpauseParams"}}]},{name:"setMaxMessageBodySize",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetMaxMessageBodySizeParams"}}]},{name:"enableAttester",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"EnableAttesterParams"}}]},{name:"disableAttester",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DisableAttesterParams"}}]},{name:"setSignatureThreshold",accounts:[{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetSignatureThresholdParams"}}]},{name:"sendMessage",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SendMessageParams"}}],returns:"u64"},{name:"sendMessageWithCaller",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SendMessageWithCallerParams"}}],returns:"u64"},{name:"replaceMessage",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReplaceMessageParams"}}],returns:"u64"},{name:"receiveMessage",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"caller",isMut:!1,isSigner:!0},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"messageTransmitter",isMut:!1,isSigner:!1},{name:"usedNonces",isMut:!0,isSigner:!1},{name:"receiver",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReceiveMessageParams"}}]},{name:"reclaimEventAccount",accounts:[{name:"payee",isMut:!0,isSigner:!0,docs:["rent SOL receiver, should match original rent payer"]},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!1}],args:[{name:"params",type:{defined:"ReclaimEventAccountParams"}}]},{name:"getNoncePda",accounts:[{name:"messageTransmitter",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"GetNoncePDAParams"}}],returns:"publicKey"},{name:"isNonceUsed",accounts:[{name:"usedNonces",isMut:!1,isSigner:!1,docs:["Account will be explicitly loaded to avoid error when it's not initialized"]}],args:[{name:"params",type:{defined:"IsNonceUsedParams"}}],returns:"bool"}],accounts:[{name:"messageSent",type:{kind:"struct",fields:[{name:"rentPayer",type:"publicKey"},{name:"message",type:"bytes"}]}},{name:"messageTransmitter",docs:["Main state of the MessageTransmitter program"],type:{kind:"struct",fields:[{name:"owner",type:"publicKey"},{name:"pendingOwner",type:"publicKey"},{name:"attesterManager",type:"publicKey"},{name:"pauser",type:"publicKey"},{name:"paused",type:"bool"},{name:"localDomain",type:"u32"},{name:"version",type:"u32"},{name:"signatureThreshold",type:"u32"},{name:"enabledAttesters",type:{vec:"publicKey"}},{name:"maxMessageBodySize",type:"u64"},{name:"nextAvailableNonce",type:"u64"}]}},{name:"usedNonces",docs:["UsedNonces account holds an array of bits that indicate which nonces were already used","so they can't be resused to receive new messages. Array starts with the first_nonce and","holds flags for UsedNonces::MAX_NONCES. Nonces are recorded separately for each remote_domain."],type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"firstNonce",type:"u64"},{name:"usedNonces",type:{array:["u64",100]}}]}}],types:[{name:"AcceptOwnershipParams",type:{kind:"struct",fields:[]}},{name:"DisableAttesterParams",type:{kind:"struct",fields:[{name:"attester",type:"publicKey"}]}},{name:"EnableAttesterParams",type:{kind:"struct",fields:[{name:"newAttester",type:"publicKey"}]}},{name:"GetNoncePDAParams",type:{kind:"struct",fields:[{name:"nonce",type:"u64"},{name:"sourceDomain",type:"u32"}]}},{name:"InitializeParams",type:{kind:"struct",fields:[{name:"localDomain",type:"u32"},{name:"attester",type:"publicKey"},{name:"maxMessageBodySize",type:"u64"},{name:"version",type:"u32"}]}},{name:"IsNonceUsedParams",type:{kind:"struct",fields:[{name:"nonce",type:"u64"}]}},{name:"PauseParams",type:{kind:"struct",fields:[]}},{name:"ReceiveMessageParams",type:{kind:"struct",fields:[{name:"message",type:"bytes"},{name:"attestation",type:"bytes"}]}},{name:"HandleReceiveMessageParams",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"sender",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"authorityBump",type:"u8"}]}},{name:"ReclaimEventAccountParams",type:{kind:"struct",fields:[{name:"attestation",type:"bytes"}]}},{name:"ReplaceMessageParams",type:{kind:"struct",fields:[{name:"originalMessage",type:"bytes"},{name:"originalAttestation",type:"bytes"},{name:"newMessageBody",type:"bytes"},{name:"newDestinationCaller",type:"publicKey"}]}},{name:"SendMessageWithCallerParams",type:{kind:"struct",fields:[{name:"destinationDomain",type:"u32"},{name:"recipient",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"destinationCaller",type:"publicKey"}]}},{name:"SendMessageParams",type:{kind:"struct",fields:[{name:"destinationDomain",type:"u32"},{name:"recipient",type:"publicKey"},{name:"messageBody",type:"bytes"}]}},{name:"SetMaxMessageBodySizeParams",type:{kind:"struct",fields:[{name:"newMaxMessageBodySize",type:"u64"}]}},{name:"SetSignatureThresholdParams",type:{kind:"struct",fields:[{name:"newSignatureThreshold",type:"u32"}]}},{name:"TransferOwnershipParams",type:{kind:"struct",fields:[{name:"newOwner",type:"publicKey"}]}},{name:"UnpauseParams",type:{kind:"struct",fields:[]}},{name:"UpdateAttesterManagerParams",type:{kind:"struct",fields:[{name:"newAttesterManager",type:"publicKey"}]}},{name:"UpdatePauserParams",type:{kind:"struct",fields:[{name:"newPauser",type:"publicKey"}]}},{name:"MathError",type:{kind:"enum",variants:[{name:"MathOverflow"},{name:"MathUnderflow"},{name:"ErrorInDivision"}]}}],events:[{name:"OwnershipTransferStarted",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"OwnershipTransferred",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"PauserChanged",fields:[{name:"newAddress",type:"publicKey",index:!1}]},{name:"AttesterManagerUpdated",fields:[{name:"previousAttesterManager",type:"publicKey",index:!1},{name:"newAttesterManager",type:"publicKey",index:!1}]},{name:"MessageReceived",fields:[{name:"caller",type:"publicKey",index:!1},{name:"sourceDomain",type:"u32",index:!1},{name:"nonce",type:"u64",index:!1},{name:"sender",type:"publicKey",index:!1},{name:"messageBody",type:"bytes",index:!1}]},{name:"SignatureThresholdUpdated",fields:[{name:"oldSignatureThreshold",type:"u32",index:!1},{name:"newSignatureThreshold",type:"u32",index:!1}]},{name:"AttesterEnabled",fields:[{name:"attester",type:"publicKey",index:!1}]},{name:"AttesterDisabled",fields:[{name:"attester",type:"publicKey",index:!1}]},{name:"MaxMessageBodySizeUpdated",fields:[{name:"newMaxMessageBodySize",type:"u64",index:!1}]},{name:"Pause",fields:[]},{name:"Unpause",fields:[]}],errors:[{code:6e3,name:"InvalidAuthority",msg:"Invalid authority"},{code:6001,name:"ProgramPaused",msg:"Instruction is not allowed at this time"},{code:6002,name:"InvalidMessageTransmitterState",msg:"Invalid message transmitter state"},{code:6003,name:"InvalidSignatureThreshold",msg:"Invalid signature threshold"},{code:6004,name:"SignatureThresholdAlreadySet",msg:"Signature threshold already set"},{code:6005,name:"InvalidOwner",msg:"Invalid owner"},{code:6006,name:"InvalidPauser",msg:"Invalid pauser"},{code:6007,name:"InvalidAttesterManager",msg:"Invalid attester manager"},{code:6008,name:"InvalidAttester",msg:"Invalid attester"},{code:6009,name:"AttesterAlreadyEnabled",msg:"Attester already enabled"},{code:6010,name:"TooFewEnabledAttesters",msg:"Too few enabled attesters"},{code:6011,name:"SignatureThresholdTooLow",msg:"Signature threshold is too low"},{code:6012,name:"AttesterAlreadyDisabled",msg:"Attester already disabled"},{code:6013,name:"MessageBodyLimitExceeded",msg:"Message body exceeds max size"},{code:6014,name:"InvalidDestinationCaller",msg:"Invalid destination caller"},{code:6015,name:"InvalidRecipient",msg:"Invalid message recipient"},{code:6016,name:"SenderNotPermitted",msg:"Sender is not permitted"},{code:6017,name:"InvalidSourceDomain",msg:"Invalid source domain"},{code:6018,name:"InvalidDestinationDomain",msg:"Invalid destination domain"},{code:6019,name:"InvalidMessageVersion",msg:"Invalid message version"},{code:6020,name:"InvalidUsedNoncesAccount",msg:"Invalid used nonces account"},{code:6021,name:"InvalidRecipientProgram",msg:"Invalid recipient program"},{code:6022,name:"InvalidNonce",msg:"Invalid nonce"},{code:6023,name:"NonceAlreadyUsed",msg:"Nonce already used"},{code:6024,name:"MessageTooShort",msg:"Message is too short"},{code:6025,name:"MalformedMessage",msg:"Malformed message"},{code:6026,name:"InvalidSignatureOrderOrDupe",msg:"Invalid signature order or dupe"},{code:6027,name:"InvalidAttesterSignature",msg:"Invalid attester signature"},{code:6028,name:"InvalidAttestationLength",msg:"Invalid attestation length"},{code:6029,name:"InvalidSignatureRecoveryId",msg:"Invalid signature recovery ID"},{code:6030,name:"InvalidSignatureSValue",msg:"Invalid signature S value"},{code:6031,name:"InvalidMessageHash",msg:"Invalid message hash"}]};ht.registerProtocol($._platform,"CircleBridge",ye);const Be={TokenMessengerIdl:bn,MessageTransmitterIdl:Sn};exports.SolanaCircleBridge=ye;exports.idl=Be;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var h = (i, e, r) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
|
|
3
3
|
var n = (i, e, r) => (h(i, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
-
import { S as m, o as p, _ as w } from "./sui-
|
|
5
|
-
import { bp as g } from "./index-
|
|
6
|
-
import { c as l } from "./create-
|
|
7
|
-
import { r as u } from "./chain-
|
|
4
|
+
import { S as m, o as p, _ as w } from "./sui-fzNqSygY.mjs";
|
|
5
|
+
import { bp as g } from "./index-BsbdJZ3C.mjs";
|
|
6
|
+
import { c as l } from "./create-B_LDrlra.mjs";
|
|
7
|
+
import { r as u } from "./chain-B1FOQWsW.mjs";
|
|
8
8
|
class c {
|
|
9
9
|
constructor(e, r, t, o) {
|
|
10
10
|
n(this, "network");
|
|
@@ -17,11 +17,11 @@ var b6 = (n, f, e, t) => ({
|
|
|
17
17
|
return d(n, f, t);
|
|
18
18
|
}
|
|
19
19
|
}), N = (n, f, e) => (Lf(n, f, "access private method"), e);
|
|
20
|
-
import { a as K6 } from "./index-
|
|
21
|
-
import "./index-
|
|
22
|
-
import { by as X6, c0 as d6, c1 as l6, at as p6, c2 as Y6, c3 as y6, bp as Je, c4 as Ke } from "./index-
|
|
23
|
-
import { E as Ef, a as Hf, b as K0, c as Z6, _ as Q6 } from "./evm-
|
|
24
|
-
import { r as q6 } from "./chain-
|
|
20
|
+
import { a as K6 } from "./index-Bt_H55hU.mjs";
|
|
21
|
+
import "./index-C4_Mkq6F.mjs";
|
|
22
|
+
import { by as X6, c0 as d6, c1 as l6, at as p6, c2 as Y6, c3 as y6, bp as Je, c4 as Ke } from "./index-BsbdJZ3C.mjs";
|
|
23
|
+
import { E as Ef, a as Hf, b as K0, c as Z6, _ as Q6 } from "./evm-CU-B8toy.mjs";
|
|
24
|
+
import { r as q6 } from "./chain-B1FOQWsW.mjs";
|
|
25
25
|
const Xe = "6.12.1";
|
|
26
26
|
function Ye(n, f, e) {
|
|
27
27
|
const t = f.split("|").map((a) => a.trim());
|