@allbridge/bridge-core-sdk 3.22.1-alpha.1 → 3.22.1-alpha.2
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/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/src/services/bridge/index.js +3 -2
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/utils.js +3 -3
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/liquidity-pool/index.js +3 -2
- package/dist/src/services/liquidity-pool/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/trx/index.d.ts +3 -2
- package/dist/src/services/liquidity-pool/trx/index.js +107 -77
- package/dist/src/services/liquidity-pool/trx/index.js.map +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/ascii/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0x1/bit-vector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/fixed-point32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/string/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/type-name/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/uq32-32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/uq64-64/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/burn-message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/handle-receive-message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/message-transmitter-authenticator/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x346e3233f61eb0055713417bfaddda7dc3bf26816faad1f7606994a368b92917/mint-allowance/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x346e3233f61eb0055713417bfaddda7dc3bf26816faad1f7606994a368b92917/treasury/structs.d.ts +4 -4
- package/dist/src/services/models/sui/_dependencies/source/0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5/message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes20/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed-vaas/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/emitter/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external-address/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/fee-collector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/guardian/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/guardian-set/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/publish-message/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/vaa/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_framework/util.d.ts +3 -30
- package/dist/src/services/models/sui/_framework/vector.d.ts +2 -2
- package/dist/src/services/models/sui/bridge/another-bridge/functions.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/another-bridge/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/bridge/functions.d.ts +31 -31
- package/dist/src/services/models/sui/bridge/bridge/structs.d.ts +4 -4
- package/dist/src/services/models/sui/bridge/bridge-interface/functions.d.ts +54 -54
- package/dist/src/services/models/sui/bridge/events/functions.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/events/structs.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/pool/functions.d.ts +26 -26
- package/dist/src/services/models/sui/bridge/pool/structs.d.ts +3 -3
- package/dist/src/services/models/sui/bridge/pool-rewards/functions.d.ts +10 -10
- package/dist/src/services/models/sui/bridge/pool-rewards/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/pool-state/functions.d.ts +21 -21
- package/dist/src/services/models/sui/bridge/pool-state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/user-deposit/functions.d.ts +7 -7
- package/dist/src/services/models/sui/bridge/user-deposit/structs.d.ts +1 -1
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge/functions.d.ts +19 -19
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge/structs.d.ts +3 -3
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/cctp-bridge/events/functions.d.ts +4 -4
- package/dist/src/services/models/sui/cctp-bridge/events/structs.d.ts +4 -4
- package/dist/src/services/models/sui/cctp-bridge/message-transmitter-authenticator/functions.d.ts +1 -1
- package/dist/src/services/models/sui/cctp-bridge/message-transmitter-authenticator/structs.d.ts +1 -1
- package/dist/src/services/models/sui/gas-oracle/gas-oracle/functions.d.ts +16 -16
- package/dist/src/services/models/sui/gas-oracle/gas-oracle/structs.d.ts +3 -3
- package/dist/src/services/models/sui/gas-oracle/gas-oracle-interface/functions.d.ts +13 -13
- package/dist/src/services/models/sui/messenger/events/functions.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/events/structs.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/messenger/functions.d.ts +18 -18
- package/dist/src/services/models/sui/messenger/messenger/structs.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/messenger-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/sui/address/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/authenticator-state/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/authenticator-state/structs.d.ts +5 -5
- package/dist/src/services/models/sui/sui/bag/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/bag/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/balance/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/balance/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/bcs/functions.d.ts +29 -29
- package/dist/src/services/models/sui/sui/bcs/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/bls12381/functions.d.ts +43 -43
- package/dist/src/services/models/sui/sui/bls12381/structs.d.ts +5 -5
- package/dist/src/services/models/sui/sui/borrow/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/clock/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/clock/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/coin/functions.d.ts +45 -45
- package/dist/src/services/models/sui/sui/coin/structs.d.ts +7 -7
- package/dist/src/services/models/sui/sui/config/functions.d.ts +11 -11
- package/dist/src/services/models/sui/sui/deny-list/functions.d.ts +21 -21
- package/dist/src/services/models/sui/sui/deny-list/structs.d.ts +7 -7
- package/dist/src/services/models/sui/sui/display/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/display/structs.d.ts +3 -3
- package/dist/src/services/models/sui/sui/dynamic-field/functions.d.ts +16 -16
- package/dist/src/services/models/sui/sui/dynamic-object-field/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/ecdsa-k1/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/ecdsa-r1/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/ecvrf/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/ed25519/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/event/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/groth16/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/groth16/structs.d.ts +4 -4
- package/dist/src/services/models/sui/sui/group-ops/functions.d.ts +23 -23
- package/dist/src/services/models/sui/sui/group-ops/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/hash/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/hex/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/hmac/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/kiosk/functions.d.ts +41 -41
- package/dist/src/services/models/sui/sui/kiosk/structs.d.ts +10 -10
- package/dist/src/services/models/sui/sui/kiosk-extension/functions.d.ts +14 -14
- package/dist/src/services/models/sui/sui/kiosk-extension/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/linked-table/functions.d.ts +17 -17
- package/dist/src/services/models/sui/sui/math/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/object/functions.d.ts +24 -24
- package/dist/src/services/models/sui/sui/object/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/object-bag/functions.d.ts +11 -11
- package/dist/src/services/models/sui/sui/object-bag/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/object-table/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/object-table/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/package/functions.d.ts +24 -24
- package/dist/src/services/models/sui/sui/package/structs.d.ts +4 -4
- package/dist/src/services/models/sui/sui/pay/functions.d.ts +8 -8
- package/dist/src/services/models/sui/sui/poseidon/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/priority-queue/functions.d.ts +8 -8
- package/dist/src/services/models/sui/sui/random/functions.d.ts +23 -23
- package/dist/src/services/models/sui/sui/random/structs.d.ts +3 -3
- package/dist/src/services/models/sui/sui/sui/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/sui/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/table/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/table/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/table-vec/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/table-vec/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/token/functions.d.ts +45 -45
- package/dist/src/services/models/sui/sui/token/structs.d.ts +6 -6
- package/dist/src/services/models/sui/sui/transfer/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/transfer/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/transfer-policy/functions.d.ts +18 -18
- package/dist/src/services/models/sui/sui/transfer-policy/structs.d.ts +6 -6
- package/dist/src/services/models/sui/sui/tx-context/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/tx-context/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/types/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/url/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/url/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/vdf/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/vec-map/functions.d.ts +19 -19
- package/dist/src/services/models/sui/sui/vec-set/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/versioned/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/versioned/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/zklogin-verified-id/functions.d.ts +9 -9
- package/dist/src/services/models/sui/sui/zklogin-verified-id/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/zklogin-verified-issuer/functions.d.ts +6 -6
- package/dist/src/services/models/sui/sui/zklogin-verified-issuer/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/bytes32/functions.d.ts +14 -14
- package/dist/src/services/models/sui/utils/bytes32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/fee-collector/functions.d.ts +5 -5
- package/dist/src/services/models/sui/utils/fee-collector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/message/functions.d.ts +9 -9
- package/dist/src/services/models/sui/utils/message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/messenger-protocol/functions.d.ts +3 -3
- package/dist/src/services/models/sui/utils/messenger-protocol/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/set/functions.d.ts +5 -5
- package/dist/src/services/models/sui/utils/set/structs.d.ts +2 -2
- package/dist/src/services/models/sui/utils/version/functions.d.ts +3 -3
- package/dist/src/services/models/sui/utils/version/structs.d.ts +1 -1
- package/dist/src/services/models/sui/wormhole-messenger/events/functions.d.ts +2 -2
- package/dist/src/services/models/sui/wormhole-messenger/events/structs.d.ts +2 -2
- package/dist/src/services/models/sui/wormhole-messenger/wh-messenger-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/wormhole-messenger/wormhole-messenger/functions.d.ts +20 -20
- package/dist/src/services/models/sui/wormhole-messenger/wormhole-messenger/structs.d.ts +2 -2
- package/dist/src/services/token/index.js +3 -2
- package/dist/src/services/token/index.js.map +1 -1
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.d.ts +1 -1
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.js +2 -2
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +8 -8
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`);let o="";for(let s=0;s<r.length;s++){let i=r.charCodeAt(s);i<128?o+=String.fromCharCode(i):i>127&&i<2048?(o+=String.fromCharCode(i>>6|192),o+=String.fromCharCode(i&63|128)):(o+=String.fromCharCode(i>>12|224),o+=String.fromCharCode(i>>6&63|128),o+=String.fromCharCode(i&63|128))}return o}_utf8_decode(r){let o="",s=0,i=0,a=0,c=0;for(;s<r.length;)i=r.charCodeAt(s),i<128?(o+=String.fromCharCode(i),s++):i>191&&i<224?(a=r.charCodeAt(s+1),o+=String.fromCharCode((i&31)<<6|a&63),s+=2):(a=r.charCodeAt(s+1),c=r.charCodeAt(s+2),o+=String.fromCharCode((i&15)<<12|(a&63)<<6|c&63),s+=3);return o}}});var Rc={};Lt(Rc,{base64DecodeFromString:()=>an,base64EncodeToString:()=>Ws,byte2hexStr:()=>Oo,byteArray2hexStr:()=>it,bytesToString:()=>Ei,hextoString:()=>Mc});function Oo(n){if(n<0||n>255)throw new Error("Input must be a byte");let r="0123456789ABCDEF",o="";return o+=r.charAt(n>>4),o+=r.charAt(n&15),o}function Ei(n){let r="";for(let o=0;o<n.length;o++){let s=n[o].toString(2),i=s.match(/^1+?(?=0)/);if(i&&s.length===8){let a=i[0].length,c=n[o].toString(2).slice(7-a);for(let u=1;u<a;u++)c+=n[u+o].toString(2).slice(2);r+=String.fromCharCode(parseInt(c,2)),o+=a-1}else r+=String.fromCharCode(n[o])}return r}function Mc(n){let r=n.replace(/^0x/,"").split(""),o="";for(let s=0;s<r.length/2;s++){let i=`0x${r[s*2]}${r[s*2+1]}`;o+=String.fromCharCode(parseInt(i))}return o}function it(n){let r="";for(let o=0;o<n.length;o++)r+=Oo(n[o]);return r}function an(n){return new Bs().decodeToByteArray(n)}function Ws(n){return new Bs().encodeIgnoreUtf8(n)}var Hn=se(()=>{Ed()});var kc={};Lt(kc,{arrayEquals:()=>bg,base64DecodeFromString:()=>an,base64EncodeToString:()=>Ws,bin2String:()=>yg,byte2hexStr:()=>Oo,byteArray2hexStr:()=>it,bytesToString:()=>Ei,getStringType:()=>wg,hexChar2byte:()=>xd,hexStr2byteArray:()=>gt,hextoString:()=>Mc,isHexChar:()=>Fc,isNumber:()=>Dd,strToDate:()=>Pg,stringToBytes:()=>Tg});function yg(n){return Ei(n)}function bg(n,r,o=!1){if(n.length!=r.length)return!1;for(let s=0;s<n.length;s++)if(o){if(n[s]!=r[s])return!1}else if(JSON.stringify(n[s])!=JSON.stringify(r[s]))return!1;return!0}function Tg(n){let r=[],o=n.length,s;for(let i=0;i<o;i++)s=n.charCodeAt(i),s>=65536&&s<=1114111?(r.push(s>>18&7|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)):s>=2048&&s<=65535?(r.push(s>>12&15|224),r.push(s>>6&63|128),r.push(s&63|128)):s>=128&&s<=2047?(r.push(s>>6&31|192),r.push(s&63|128)):r.push(s&255);return r}function xd(n){let r;if(n>="A"&&n<="F"?r=n.charCodeAt(0)-65+10:n>="a"&&n<="f"?r=n.charCodeAt(0)-97+10:n>="0"&&n<="9"&&(r=n.charCodeAt(0)-48),typeof r=="number")return r;throw new Error("The passed hex char is not a valid hex char")}function Fc(n){return n>="A"&&n<="F"||n>="a"&&n<="f"||n>="0"&&n<="9"?1:0}function gt(n,r=!1){let o=n.length;r&&o%2&&(n=`0${n}`,o++);let s=[],i=0,a=0,c=0;for(let u=0;u<o;u++){let l=n.charAt(u);if(Fc(l))i<<=4,i+=xd(l),a++,a%2===0&&(s[c++]=i,i=0);else throw new Error("The passed hex char is not a valid hex string")}return s}function Pg(n){if(!/^\d{4}-\d{2}-\d{2}( \d{2}-\d{2}-\d{2}|)/.test(n))throw new Error("The passed date string is not valid");let r=n.split(" "),o=r[0].split("-"),s=parseInt(o[0],10),i=parseInt(o[1],10)-1,a=parseInt(o[2],10);if(r.length>1){let c=r[1].split("-"),u=parseInt(c[0],10),l=parseInt(c[1],10),p=parseInt(c[2],10);return new Date(s,i,a,u,l,p)}return new Date(s,i,a)}function Dd(n){return n>="0"&&n<="9"?1:0}function wg(n){if(n==null||n.length==0||n=="")return-1;let r=0;if(n.length==40)for(;r<40;r++){let o=n.charAt(r);if(!Fc(o))break}if(r==40)return 1;for(r=0;r<n.length;r++){let o=n.charAt(r);if(!Dd(o))break}if(r==n.length)return 2;for(r=0;r<n.length;r++)if(n.charAt(r)>" ")return 3;return-1}var Eo=se(()=>{Hn()});var xc={};Lt(xc,{hasProperties:()=>Ec,hasProperty:()=>_d,isArray:()=>Kn,isBigNumber:()=>Bg,isBoolean:()=>Oc,isFunction:()=>Wg,isHex:()=>cn,isInteger:()=>Hr,isJson:()=>Cg,isNotNullOrUndefined:()=>yt,isObject:()=>vn,isString:()=>at,isValidURL:()=>Ss,mapEvent:()=>Sg,padLeft:()=>Ig,parseEvent:()=>vg,sleep:()=>Mg});function Ss(n){return typeof n!="string"?!1:Ud.default.isURL(n.toString(),{protocols:["http","https"],require_tld:!1})}function vn(n){return n===Object(n)&&Object.prototype.toString.call(n)!=="[object Array]"}function Kn(n){return Array.isArray(n)}function Cg(n){try{return!!JSON.parse(n)}catch{return!1}}function Oc(n){return typeof n=="boolean"}function Bg(n){return!!n&&(n instanceof Nd.BigNumber||n.constructor&&n.constructor.name==="BigNumber")}function at(n){return typeof n=="string"||!!n&&n.constructor&&n.constructor.name==="String"}function Wg(n){return typeof n=="function"}function cn(n){return typeof n=="string"&&!isNaN(parseInt(n,16))&&/^(0x|)[a-fA-F0-9]+$/.test(n)}function Hr(n){return n===null?!1:Number.isInteger(Number(n))}function _d(n,r){return Object.prototype.hasOwnProperty.call(n,r)}function Ec(n,...r){return r.length&&!r.map(o=>_d(n,o)).includes(!1)}function Sg(n){let r={block:n.block_number,timestamp:n.block_timestamp,contract:n.contract_address,name:n.event_name,transaction:n.transaction_id,result:n.result,resourceNode:n.resource_Node||(n._unconfirmed?"fullNode":"solidityNode")};return n._unconfirmed&&(r.unconfirmed=n._unconfirmed),n._fingerprint&&(r.fingerprint=n._fingerprint),r}function vg(n,{inputs:r}){if(!n.result)return n;if(vn(n.result))for(let o=0;o<r.length;o++){let s=r[o];s.type=="address"&&s.name in n.result&&(n.result[s.name]=ht+n.result[s.name].substr(2).toLowerCase())}else Kn(n.result)&&(n.result=n.result.reduce((o,s,i)=>{let{name:a,type:c}=r[i];return c=="address"&&(s=ht+s.substr(2).toLowerCase()),o[a]=s,o},{}));return n}function Ig(n,r,o){let s=n.toString();for(;s.length<o;)s=r+s;return s}function yt(n){return n!==null&&typeof n<"u"}async function Mg(n=1e3){return new Promise(r=>setTimeout(r,n))}var Nd,Ud,un=se(()=>{Nd=require("bignumber.js"),Ud=ye(require("validator"),1);Qt()});function Dt(n){let r=new Set;return n.forEach(o=>r.add(o)),Object.freeze(r)}function In(n){let r=[],o=c=>{let u=a<n.length?JSON.stringify(n[a]):"$EOI";throw new Error(`invalid token ${u} at ${a}: ${c}`)},s=[],i=[],a=0;for(;a<n.length;){let c=n.substring(a),u=c.match(Dg);u&&(a+=u[1].length,c=n.substring(a));let l={depth:s.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};r.push(l);let p=xg[c[0]]||"";if(p){if(l.type=p,l.text=c[0],a++,p==="OPEN_PAREN")s.push(r.length-1),i.push(r.length-1);else if(p=="CLOSE_PAREN")s.length===0&&o("no matching open bracket"),l.match=s.pop(),r[l.match].match=r.length-1,l.depth--,l.linkBack=i.pop(),r[l.linkBack].linkNext=r.length-1;else if(p==="COMMA")l.linkBack=i.pop(),r[l.linkBack].linkNext=r.length-1,i.push(r.length-1);else if(p==="OPEN_BRACKET")l.type="BRACKET";else if(p==="CLOSE_BRACKET"){let A=r.pop().text;if(r.length>0&&r[r.length-1].type==="NUMBER"){let g=r.pop().text;A=g+A,r[r.length-1].value=(0,Se.getNumber)(g)}if(r.length===0||r[r.length-1].type!=="BRACKET")throw new Error("missing opening bracket");r[r.length-1].text+=A}continue}if(u=c.match(Ug),u){if(l.text=u[1],a+=l.text.length,Eg.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(ep)){l.type="TYPE";continue}l.type="ID";continue}if(u=c.match(Ng),u){l.text=u[1],l.type="NUMBER",a+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(c[0])} at position ${a}`)}return new mr(r.map(c=>Object.freeze(c)))}function jd(n,r){let o=[];for(let s in r.keys())n.has(s)&&o.push(s);if(o.length>1)throw new Error(`conflicting types: ${o.join(", ")}`)}function Ni(n,r){if(r.peekKeyword(Yd)){let o=r.pop().text;if(o!==n)throw new Error(`expected ${n}, got ${o}`)}return r.popType("ID")}function dn(n,r){let o=new Set;for(;;){let s=n.peekType("KEYWORD");if(s==null||r&&!r.has(s))break;if(n.pop(),o.has(s))throw new Error(`duplicate keywords: ${JSON.stringify(s)}`);o.add(s)}return Object.freeze(o)}function tp(n){let r=dn(n,Rg);return jd(r,Dt("constant payable nonpayable".split(" "))),jd(r,Dt("pure view payable nonpayable".split(" "))),r.has("view")?"view":r.has("pure")?"pure":r.has("payable")?"payable":r.has("nonpayable")?"nonpayable":r.has("constant")?"view":"nonpayable"}function ln(n,r){return n.popParams().map(o=>Nt.from(o,r))}function rp(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return(0,Se.getBigInt)(n.pop().text);throw new Error("invalid gas")}return null}function Qn(n){if(n.length)throw new Error(`unexpected tokens: ${n.toString()}`)}function zd(n){let r=n.match(ep);if((0,Se.assertArgument)(r,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(r[2]){let o=parseInt(r[2]);(0,Se.assertArgument)(o!==0&&o<=32,"invalid bytes length","type",n)}else if(r[3]){let o=parseInt(r[3]);(0,Se.assertArgument)(o!==0&&o<=256&&o%8===0,"invalid numeric width","type",n)}return n}function Is(n,r){return"("+r.map(o=>o.format(n)).join(n==="full"?", ":",")+")"}var Se,Di,Dc,Kd,Rg,Xd,Yd,qd,Fg,kg,Og,Eg,xg,Dg,Ng,Ug,Qd,ep,mr,_g,Ze,$t,Vd,Gd,Ld,$d,Zd,Jd,Hd,Nt,eo,xo,fr,Xn,Yn,xi,qn,vs,np=se(()=>{Se=require("ethers"),Di=require("ethers");Kd="constant external internal payable private public pure view",Rg=Dt(Kd.split(" ")),Xd="constructor error event fallback function receive struct",Yd=Dt(Xd.split(" ")),qd="calldata memory storage payable indexed",Fg=Dt(qd.split(" ")),kg="tuple returns",Og=[Xd,qd,kg,Kd].join(" "),Eg=Dt(Og.split(" ")),xg={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Dg=new RegExp("^(\\s*)"),Ng=new RegExp("^([0-9]+)"),Ug=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Qd=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),ep=new RegExp("^(trcToken|address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),mr=class{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(r){this.#e=0,this.#t=r.slice()}clone(){return new Dc(this.#t)}reset(){this.#e=0}#n(r=0,o=0){return new Dc(this.#t.slice(r,o).map(s=>Object.freeze(Object.assign({},s,{match:s.match-r,linkBack:s.linkBack-r,linkNext:s.linkNext-r}))))}popKeyword(r){let o=this.peek();if(o.type!=="KEYWORD"||!r.has(o.text))throw new Error(`expected keyword ${o.text}`);return this.pop().text}popType(r){if(this.peek().type!==r)throw new Error(`expected ${r}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){let r=this.peek();if(r.type!=="OPEN_PAREN")throw new Error("bad start");let o=this.#n(this.#e+1,r.match+1);return this.#e=r.match+1,o}popParams(){let r=this.peek();if(r.type!=="OPEN_PAREN")throw new Error("bad start");let o=[];for(;this.#e<r.match-1;){let s=this.peek().linkNext;o.push(this.#n(this.#e+1,s)),this.#e=s}return this.#e=r.match+1,o}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(r){let o=this.peekType("KEYWORD");return o!=null&&r.has(o)?o:null}peekType(r){if(this.length===0)return null;let o=this.peek();return o.type===r?o.text:null}pop(){let r=this.peek();return this.#e++,r}toString(){let r=[];for(let o=this.#e;o<this.#t.length;o++){let s=this.#t[o];r.push(`${s.type}:${s.text}`)}return`<TokenString ${r.join(" ")}>`}};Dc=mr;_g=new RegExp(/^(.*)\[([0-9]*)\]$/);Ze={},$t=Symbol.for("_ethers_internal"),Vd="_ParamTypeInternal",Gd="_ErrorInternal",Ld="_EventInternal",$d="_ConstructorInternal",Zd="_FallbackInternal",Jd="_FunctionInternal",Hd="_StructInternal",Nt=class n{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(r,o,s,i,a,c,u,l){if((0,Se.assertPrivate)(r,Ze,"ParamType"),Object.defineProperty(this,$t,{value:Vd}),c&&(c=Object.freeze(c.slice())),i==="array"){if(u==null||l==null)throw new Error("")}else if(u!=null||l!=null)throw new Error("");if(i==="tuple"){if(c==null)throw new Error("")}else if(c!=null)throw new Error("");(0,Se.defineProperties)(this,{name:o,type:s,baseType:i,indexed:a,components:c,arrayLength:u,arrayChildren:l})}format(r){if(r==null&&(r="sighash"),r==="json"){let s={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(r)))),JSON.stringify(s)}let o="";return this.isArray()?(o+=this.arrayChildren.format(r),o+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(r!=="sighash"&&(o+=this.type),o+="("+this.components.map(s=>s.format(r)).join(r==="full"?", ":",")+")"):o+=this.type,r!=="sighash"&&(this.indexed===!0&&(o+=" indexed"),r==="full"&&this.name&&(o+=" "+this.name)),o}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(r,o){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");return r.map(s=>this.arrayChildren?.walk(s,o))}if(this.isTuple()){if(!Array.isArray(r))throw new Error("invalid tuple value");if(r.length!==this.components.length)throw new Error("array is wrong length");return r.map((s,i)=>this.components?.[i].walk(s,o))}return o(this.type,r)}#e(r,o,s,i){if(this.isArray()){if(!Array.isArray(o))throw new Error("invalid array value");if(this.arrayLength!==-1&&o.length!==this.arrayLength)throw new Error("array is wrong length");let c=this.arrayChildren,u=o.slice();u.forEach((l,p)=>{c.#e(r,l,s,A=>{u[p]=A})}),i(u);return}if(this.isTuple()){let c=this.components,u;if(Array.isArray(o))u=o.slice();else{if(o==null||typeof o!="object")throw new Error("invalid tuple value");u=c.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in o))throw new Error(`missing value for component ${l.name}`);return o[l.name]})}if(u.length!==this.components.length)throw new Error("array is wrong length");u.forEach((l,p)=>{c[p].#e(r,l,s,A=>{u[p]=A})}),i(u);return}let a=s(this.type,o);a.then?r.push(async function(){i(await a)}()):i(a)}async walkAsync(r,o){let s=[],i=[r];return this.#e(s,r,o,a=>{i[0]=a}),s.length&&await Promise.all(s),i[0]}static from(r,o){if(n.isParamType(r))return r;if(typeof r=="string")return n.from(In(r),o);if(r instanceof mr){let u="",l="",p=null;dn(r,Dt(["tuple"])).has("tuple")||r.peekType("OPEN_PAREN")?(l="tuple",p=r.popParams().map(S=>n.from(S)),u=`tuple(${p.map(S=>S.format()).join(",")})`):(u=zd(r.popType("TYPE")),l=u);let A=null,g=null;for(;r.length&&r.peekType("BRACKET");){let S=r.pop();A=new n(Ze,"",u,l,null,p,g,A),g=S.value,u+=S.text,l="array",p=null}let P=null;if(dn(r,Fg).has("indexed")){if(!o)throw new Error("");P=!0}let W=r.peekType("ID")?r.pop().text:"";if(r.length)throw new Error("leftover tokens");return new n(Ze,W,u,l,P,p,g,A)}let s=r.name;(0,Se.assertArgument)(!s||typeof s=="string"&&s.match(Qd),"invalid name","obj.name",s);let i=r.indexed;i!=null&&((0,Se.assertArgument)(o,"parameter cannot be indexed","obj.indexed",r.indexed),i=!!i);let a=r.type,c=a.match(_g);if(c){let u=parseInt(c[2]||"-1"),l=n.from({type:c[1],components:r.components});return new n(Ze,s||"",a,"array",i,null,u,l)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){let u=r.components!=null?r.components.map(p=>n.from(p)):null;return new n(Ze,s||"",a,"tuple",i,u,null,null)}return a=zd(r.type),new n(Ze,s||"",a,a,i,null,null,null)}static isParamType(r){return r&&r[$t]===Vd}},eo=class n{type;inputs;constructor(r,o,s){(0,Se.assertPrivate)(r,Ze,"Fragment"),s=Object.freeze(s.slice()),(0,Se.defineProperties)(this,{type:o,inputs:s})}static from(r){if(typeof r=="string"){try{n.from(JSON.parse(r))}catch{}return n.from(In(r))}if(r instanceof mr)switch(r.peekKeyword(Yd)){case"constructor":return Yn.from(r);case"error":return fr.from(r);case"event":return Xn.from(r);case"fallback":case"receive":return xi.from(r);case"function":return qn.from(r);case"struct":return vs.from(r)}else if(typeof r=="object"){switch(r.type){case"constructor":return Yn.from(r);case"error":return fr.from(r);case"event":return Xn.from(r);case"fallback":case"receive":return xi.from(r);case"function":return qn.from(r);case"struct":return vs.from(r)}(0,Se.assert)(!1,`unsupported type: ${r.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}(0,Se.assertArgument)(!1,"unsupported frgament object","obj",r)}static isConstructor(r){return Yn.isFragment(r)}static isError(r){return fr.isFragment(r)}static isEvent(r){return Xn.isFragment(r)}static isFunction(r){return qn.isFragment(r)}static isStruct(r){return vs.isFragment(r)}},xo=class extends eo{name;constructor(r,o,s,i){super(r,o,i),(0,Se.assertArgument)(typeof s=="string"&&s.match(Qd),"invalid identifier","name",s),i=Object.freeze(i.slice()),(0,Se.defineProperties)(this,{name:s})}};fr=class n extends xo{constructor(r,o,s){super(r,"error",o,s),Object.defineProperty(this,$t,{value:Gd})}get selector(){return(0,Di.id)(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("error"),o.push(this.name+Is(r,this.inputs)),o.join(" ")}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(In(r));if(r instanceof mr){let o=Ni("error",r),s=ln(r);return Qn(r),new n(Ze,o,s)}return new n(Ze,r.name,r.inputs?r.inputs.map(Nt.from):[])}static isFragment(r){return r&&r[$t]===Gd}},Xn=class n extends xo{anonymous;constructor(r,o,s,i){super(r,"event",o,s),Object.defineProperty(this,$t,{value:Ld}),(0,Se.defineProperties)(this,{anonymous:i})}get topicHash(){return(0,Di.id)(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("event"),o.push(this.name+Is(r,this.inputs)),r!=="sighash"&&this.anonymous&&o.push("anonymous"),o.join(" ")}static getTopicHash(r,o){return o=(o||[]).map(i=>Nt.from(i)),new n(Ze,r,o,!1).topicHash}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(In(r));if(r instanceof mr){let o=Ni("event",r),s=ln(r,!0),i=!!dn(r,Dt(["anonymous"])).has("anonymous");return Qn(r),new n(Ze,o,s,i)}return new n(Ze,r.name,r.inputs?r.inputs.map(o=>Nt.from(o,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[$t]===Ld}},Yn=class n extends eo{payable;gas;constructor(r,o,s,i,a){super(r,o,s),Object.defineProperty(this,$t,{value:$d}),(0,Se.defineProperties)(this,{payable:i,gas:a})}format(r){if((0,Se.assert)(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[`constructor${Is(r,this.inputs)}`];return o.push(this.payable?"payable":"nonpayable"),this.gas!=null&&o.push(`@${this.gas.toString()}`),o.join(" ")}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(In(r));if(r instanceof mr){dn(r,Dt(["constructor"]));let o=ln(r),s=!!dn(r,Dt(["payable"])).has("payable"),i=rp(r);return Qn(r),new n(Ze,"constructor",o,s,i)}return new n(Ze,"constructor",r.inputs?r.inputs.map(Nt.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[$t]===$d}},xi=class n extends eo{payable;constructor(r,o,s){super(r,"fallback",o),Object.defineProperty(this,$t,{value:Zd}),(0,Se.defineProperties)(this,{payable:s})}format(r){let o=this.inputs.length===0?"receive":"fallback";if(r==="json"){let s=this.payable?"payable":"nonpayable";return JSON.stringify({type:o,stateMutability:s})}return`${o}()${this.payable?" payable":""}`}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(In(r));if(r instanceof mr){let o=r.toString(),s=r.peekKeyword(Dt(["fallback","receive"]));if((0,Se.assertArgument)(s,"type must be fallback or receive","obj",o),r.popKeyword(Dt(["fallback","receive"]))==="receive"){let u=ln(r);return(0,Se.assertArgument)(u.length===0,"receive cannot have arguments","obj.inputs",u),dn(r,Dt(["payable"])),Qn(r),new n(Ze,[],!0)}let a=ln(r);a.length?(0,Se.assertArgument)(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(u=>u.format("minimal")).join(", ")):a=[Nt.from("bytes")];let c=tp(r);if((0,Se.assertArgument)(c==="nonpayable"||c==="payable","fallback cannot be constants","obj.stateMutability",c),dn(r,Dt(["returns"])).has("returns")){let u=ln(r);(0,Se.assertArgument)(u.length===1&&u[0].type==="bytes","invalid fallback outputs","obj.outputs",u.map(l=>l.format("minimal")).join(", "))}return Qn(r),new n(Ze,a,c==="payable")}if(r.type==="receive")return new n(Ze,[],!0);if(r.type==="fallback"){let o=[Nt.from("bytes")],s=r.stateMutability==="payable";return new n(Ze,o,s)}(0,Se.assertArgument)(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[$t]===Zd}},qn=class n extends xo{constant;outputs;stateMutability;payable;gas;constructor(r,o,s,i,a,c){super(r,"function",o,i),Object.defineProperty(this,$t,{value:Jd}),a=Object.freeze(a.slice()),(0,Se.defineProperties)(this,{constant:s==="view"||s==="pure",gas:c,outputs:a,payable:s==="payable",stateMutability:s})}get selector(){return(0,Di.id)(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r))),outputs:this.outputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("function"),o.push(this.name+Is(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&o.push(this.stateMutability),this.outputs&&this.outputs.length&&(o.push("returns"),o.push(Is(r,this.outputs))),this.gas!=null&&o.push(`@${this.gas.toString()}`)),o.join(" ")}static getSelector(r,o){return o=(o||[]).map(i=>Nt.from(i)),new n(Ze,r,"view",o,[],null).selector}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(In(r));if(r instanceof mr){let s=Ni("function",r),i=ln(r),a=tp(r),c=[];dn(r,Dt(["returns"])).has("returns")&&(c=ln(r));let u=rp(r);return Qn(r),new n(Ze,s,a,i,c,u)}let o=r.stateMutability;return o==null&&(o="payable",typeof r.constant=="boolean"?(o="view",r.constant||(o="payable",typeof r.payable=="boolean"&&!r.payable&&(o="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(o="nonpayable")),new n(Ze,r.name,o,r.inputs?r.inputs.map(Nt.from):[],r.outputs?r.outputs.map(Nt.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[$t]===Jd}},vs=class n extends xo{constructor(r,o,s){super(r,"struct",o,s),Object.defineProperty(this,$t,{value:Hd})}format(){throw new Error("@TODO")}static from(r){if(typeof r=="string")return n.from(In(r));if(r instanceof mr){let o=Ni("struct",r),s=ln(r);return Qn(r),new n(Ze,o,s)}return new n(Ze,r.name,r.inputs?r.inputs.map(Nt.from):[])}static isFragment(r){return r&&r[$t]===Hd}}});var Nc,Uc,z,_c,Gc,Ui,jc,zc,Vc,_i,op,sp,ji,ip=se(()=>{Nc=require("ethers"),Uc=require("ethers"),z=require("ethers"),_c=require("ethers"),Gc=require("ethers");np();Ui=require("ethers"),jc=class{fragment;name;signature;topic;args;constructor(r,o,s){let i=r.name,a=r.format();(0,z.defineProperties)(this,{fragment:r,name:i,signature:a,topic:o,args:s})}},zc=class{fragment;name;args;signature;selector;value;constructor(r,o,s,i){let a=r.name,c=r.format();(0,z.defineProperties)(this,{fragment:r,name:a,args:s,signature:c,selector:o,value:i})}},Vc=class{fragment;name;args;signature;selector;constructor(r,o,s){let i=r.name,a=r.format();(0,z.defineProperties)(this,{fragment:r,name:i,args:s,signature:a,selector:o})}},_i=class{hash;_isIndexed;static isIndexed(r){return!!(r&&r._isIndexed)}constructor(r){(0,z.defineProperties)(this,{hash:r,_isIndexed:!0})}},op={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},sp={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let r="unknown panic code";return n>=0&&n<=255&&op[n.toString()]&&(r=op[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${r})`}}},ji=class n{fragments;deploy;fallback;receive;#e;#t;#n;#r;constructor(r){let o=[];typeof r=="string"?o=JSON.parse(r):o=r,this.#n=new Map,this.#e=new Map,this.#t=new Map;let s=[];for(let c of o)try{s.push(eo.from(c))}catch(u){console.log("EE",u)}(0,z.defineProperties)(this,{fragments:Object.freeze(s)});let i=null,a=!1;this.#r=this.getAbiCoder(),this.fragments.forEach((c,u)=>{let l;switch(c.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}(0,z.defineProperties)(this,{deploy:c});return;case"fallback":c.inputs.length===0?a=!0:((0,z.assertArgument)(!i||c.payable!==i.payable,"conflicting fallback fragments",`fragments[${u}]`,c),i=c,a=i.payable);return;case"function":l=this.#n;break;case"event":l=this.#t;break;case"error":l=this.#e;break;default:return}let p=c.format();l.has(p)||l.set(p,c)}),this.deploy||(0,z.defineProperties)(this,{deploy:Yn.from("constructor()")}),(0,z.defineProperties)(this,{fallback:i,receive:a})}format(r){let o=r?"minimal":"full";return this.fragments.map(i=>i.format(o))}formatJson(){let r=this.fragments.map(o=>o.format("json"));return JSON.stringify(r.map(o=>JSON.parse(o)))}getAbiCoder(){return _c.AbiCoder.defaultAbiCoder()}#o(r,o,s){if((0,z.isHexString)(r)){let a=r.toLowerCase();for(let c of this.#n.values())if(a===c.selector)return c;return null}if(r.indexOf("(")===-1){let a=[];for(let[c,u]of this.#n)c.split("(")[0]===r&&a.push(u);if(o){let c=o.length>0?o[o.length-1]:null,u=o.length,l=!0;Ui.Typed.isTyped(c)&&c.type==="overrides"&&(l=!1,u--);for(let p=a.length-1;p>=0;p--){let A=a[p].inputs.length;A!==u&&(!l||A!==u-1)&&a.splice(p,1)}for(let p=a.length-1;p>=0;p--){let A=a[p].inputs;for(let g=0;g<o.length;g++)if(Ui.Typed.isTyped(o[g])){if(g>=A.length){if(o[g].type==="overrides")continue;a.splice(p,1);break}if(o[g].type!==A[g].baseType){a.splice(p,1);break}}}}if(a.length===1&&o&&o.length!==a[0].inputs.length){let c=o[o.length-1];(c==null||Array.isArray(c)||typeof c!="object")&&a.splice(0,1)}if(a.length===0)return null;if(a.length>1&&s){let c=a.map(u=>JSON.stringify(u.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous function description (i.e. matches ${c})`,"key",r)}return a[0]}let i=this.#n.get(qn.from(r).format());return i||null}getFunctionName(r){let o=this.#o(r,null,!1);return(0,z.assertArgument)(o,"no matching function","key",r),o.name}hasFunction(r){return!!this.#o(r,null,!1)}getFunction(r,o){return this.#o(r,o||null,!0)}forEachFunction(r){let o=Array.from(this.#n.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#n.get(i),s)}}#s(r,o,s){if((0,z.isHexString)(r)){let a=r.toLowerCase();for(let c of this.#t.values())if(a===c.topicHash)return c;return null}if(r.indexOf("(")===-1){let a=[];for(let[c,u]of this.#t)c.split("(")[0]===r&&a.push(u);if(o){for(let c=a.length-1;c>=0;c--)a[c].inputs.length<o.length&&a.splice(c,1);for(let c=a.length-1;c>=0;c--){let u=a[c].inputs;for(let l=0;l<o.length;l++)if(Ui.Typed.isTyped(o[l])&&o[l].type!==u[l].baseType){a.splice(c,1);break}}}if(a.length===0)return null;if(a.length>1&&s){let c=a.map(u=>JSON.stringify(u.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous event description (i.e. matches ${c})`,"key",r)}return a[0]}let i=this.#t.get(Xn.from(r).format());return i||null}getEventName(r){let o=this.#s(r,null,!1);return(0,z.assertArgument)(o,"no matching event","key",r),o.name}hasEvent(r){return!!this.#s(r,null,!1)}getEvent(r,o){return this.#s(r,o||null,!0)}forEachEvent(r){let o=Array.from(this.#t.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#t.get(i),s)}}getError(r,o){if((0,z.isHexString)(r)){let i=r.toLowerCase();if(sp[i])return fr.from(sp[i].signature);for(let a of this.#e.values())if(i===a.selector)return a;return null}if(r.indexOf("(")===-1){let i=[];for(let[a,c]of this.#e)a.split("(")[0]===r&&i.push(c);if(i.length===0)return r==="Error"?fr.from("error Error(string)"):r==="Panic"?fr.from("error Panic(uint256)"):null;if(i.length>1){let a=i.map(c=>JSON.stringify(c.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous error description (i.e. ${a})`,"name",r)}return i[0]}if(r=fr.from(r).format(),r==="Error(string)")return fr.from("error Error(string)");if(r==="Panic(uint256)")return fr.from("error Panic(uint256)");let s=this.#e.get(r);return s||null}forEachError(r){let o=Array.from(this.#e.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#e.get(i),s)}}_decodeParams(r,o){return this.#r.decode(r,o)}_encodeParams(r,o){return this.#r.encode(r,o)}encodeDeploy(r){return this._encodeParams(this.deploy.inputs,r||[])}decodeErrorResult(r,o){if(typeof r=="string"){let s=this.getError(r);(0,z.assertArgument)(s,"unknown error","fragment",r),r=s}return(0,z.assertArgument)((0,z.dataSlice)(o,0,4)===r.selector,`data signature does not match error ${r.name}.`,"data",o),this._decodeParams(r.inputs,(0,z.dataSlice)(o,4))}encodeErrorResult(r,o){if(typeof r=="string"){let s=this.getError(r);(0,z.assertArgument)(s,"unknown error","fragment",r),r=s}return(0,z.concat)([r.selector,this._encodeParams(r.inputs,o||[])])}decodeFunctionData(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.assertArgument)((0,z.dataSlice)(o,0,4)===r.selector,`data signature does not match function ${r.name}.`,"data",o),this._decodeParams(r.inputs,(0,z.dataSlice)(o,4))}encodeFunctionData(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.concat)([r.selector,this._encodeParams(r.inputs,o||[])])}decodeFunctionResult(r,o){if(typeof r=="string"){let a=this.getFunction(r);(0,z.assertArgument)(a,"unknown function","fragment",r),r=a}let s="invalid length for result data",i=(0,z.getBytesCopy)(o);if(i.length%32===0)try{return this.#r.decode(r.outputs,i)}catch{s="could not decode result data"}(0,z.assert)(!1,s,"BAD_DATA",{value:(0,z.hexlify)(i),info:{method:r.name,signature:r.format()}})}makeError(r,o){let s=(0,z.getBytes)(r,"data"),i=_c.AbiCoder.getBuiltinCallException("call",o,s);if(i.message.startsWith("execution reverted (unknown custom error)")){let u=(0,z.hexlify)(s.slice(0,4)),l=this.getError(u);if(l)try{let p=this.#r.decode(l.inputs,s.slice(4));i.revert={name:l.name,signature:l.format(),args:p},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}let c=this.parseTransaction(o);return c&&(i.invocation={method:c.name,signature:c.signature,args:c.args}),i}encodeFunctionResult(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.hexlify)(this.#r.encode(r.outputs,o||[]))}encodeFilterTopics(r,o){if(typeof r=="string"){let a=this.getEvent(r);(0,z.assertArgument)(a,"unknown event","eventFragment",r),r=a}(0,z.assert)(o.length<=r.inputs.length,`too many arguments for ${r.format()}`,"UNEXPECTED_ARGUMENT",{count:o.length,expectedCount:r.inputs.length});let s=[];r.anonymous||s.push(r.topicHash);let i=(a,c)=>a.type==="string"?(0,Uc.id)(c):a.type==="bytes"?(0,Nc.keccak256)((0,z.hexlify)(c)):(a.type==="bool"&&typeof c=="boolean"&&(c=c?"0x01":"0x00"),a.type.match(/^u?int/)&&(c=(0,z.toBeHex)(c)),a.type==="address"&&this.#r.encode(["address"],[c]),(0,z.zeroPadValue)((0,z.hexlify)(c),32));for(o.forEach((a,c)=>{let u=r.inputs[c];if(!u.indexed){(0,z.assertArgument)(a==null,"cannot filter non-indexed parameters; must be null","contract."+u.name,a);return}a==null?s.push(null):u.baseType==="array"||u.baseType==="tuple"?(0,z.assertArgument)(!1,"filtering with tuples or arrays not supported","contract."+u.name,a):Array.isArray(a)?s.push(a.map(l=>i(u,l))):s.push(i(u,a))});s.length&&s[s.length-1]===null;)s.pop();return s}encodeEventLog(r,o){if(typeof r=="string"){let c=this.getEvent(r);(0,z.assertArgument)(c,"unknown event","eventFragment",r),r=c}let s=[],i=[],a=[];return r.anonymous||s.push(r.topicHash),(0,z.assertArgument)(o.length===r.inputs.length,"event arguments/values mismatch","values",o),r.inputs.forEach((c,u)=>{let l=o[u];if(c.indexed)if(c.type==="string")s.push((0,Uc.id)(l));else if(c.type==="bytes")s.push((0,Nc.keccak256)(l));else{if(c.baseType==="tuple"||c.baseType==="array")throw new Error("not implemented");s.push(this.#r.encode([c.type],[l]))}else i.push(c),a.push(l)}),{data:this.#r.encode(i,a),topics:s}}decodeEventLog(r,o,s){if(typeof r=="string"){let b=this.getEvent(r);(0,z.assertArgument)(b,"unknown event","eventFragment",r),r=b}if(s!=null&&!r.anonymous){let b=r.topicHash;(0,z.assertArgument)((0,z.isHexString)(s[0],32)&&s[0].toLowerCase()===b,"fragment/topic mismatch","topics[0]",s[0]),s=s.slice(1)}let i=[],a=[],c=[];r.inputs.forEach((b,W)=>{b.indexed?b.type==="string"||b.type==="bytes"||b.baseType==="tuple"||b.baseType==="array"?(i.push(Nt.from({type:"bytes32",name:b.name})),c.push(!0)):(i.push(b),c.push(!1)):(a.push(b),c.push(!1))});let u=s!=null?this.#r.decode(i,(0,z.concat)(s)):null,l=this.#r.decode(a,o,!0),p=[],A=[],g=0,P=0;return r.inputs.forEach((b,W)=>{let S=null;if(b.indexed)if(u==null)S=new _i(null);else if(c[W])S=new _i(u[P++]);else try{S=u[P++]}catch(F){S=F}else try{S=l[g++]}catch(F){S=F}p.push(S),A.push(b.name||null)}),Gc.Result.fromItems(p,A)}parseTransaction(r){let o=(0,z.getBytes)(r.data,"tx.data"),s=(0,z.getBigInt)(r.value!=null?r.value:0,"tx.value"),i=this.getFunction((0,z.hexlify)(o.slice(0,4)));if(!i)return null;let a=this.#r.decode(i.inputs,o.slice(4));return new zc(i,i.selector,a,s)}parseCallResult(r){throw new Error("@TODO")}parseLog(r){let o=this.getEvent(r.topics[0]);return!o||o.anonymous?null:new jc(o,o.topicHash,this.decodeEventLog(o,r.data,r.topics))}parseError(r){let o=(0,z.hexlify)(r),s=this.getError((0,z.dataSlice)(o,0,4));if(!s)return null;let i=this.#r.decode(s.inputs,(0,z.dataSlice)(o,4));return new Vc(s,s.selector,i)}static from(r){return r instanceof n?r:typeof r=="string"?new n(JSON.parse(r)):typeof r.format=="function"?new n(r.format("json")):new n(r)}}});var Zc={};Lt(Zc,{AbiCoder:()=>k.AbiCoder,FormatTypes:()=>zg,Interface:()=>ji,Mnemonic:()=>k.Mnemonic,Signature:()=>k.Signature,SigningKey:()=>k.SigningKey,Wordlist:()=>k.Wordlist,arrayify:()=>$c,concat:()=>k.concat,ethersHDNodeWallet:()=>k.HDNodeWallet,id:()=>k.id,isValidMnemonic:()=>Vg,joinSignature:()=>Lc,keccak256:()=>k.keccak256,recoverAddress:()=>k.recoverAddress,sha256:()=>k.sha256,splitSignature:()=>jg,toUtf8Bytes:()=>k.toUtf8Bytes,toUtf8String:()=>k.toUtf8String,wordlists:()=>k.wordlists});var k,jg,Lc,$c,zg,Vg,er=se(()=>{k=require("ethers");ip();jg=n=>k.Signature.from(n),Lc=n=>k.Signature.from(n).serialized,$c=n=>(0,k.getBytes)(n),zg={sighash:"sighash",minimal:"minimal",full:"full",json:"json"},Vg=k.Mnemonic.isValidMnemonic;k.computeHmac.register((n,r,o)=>k.computeHmac._(n,Buffer.from(r),Buffer.from(o)))});var qc={};Lt(qc,{ADDRESS_PREFIX:()=>ht,ADDRESS_PREFIX_BYTE:()=>Hc,ADDRESS_PREFIX_REGEX:()=>pn,ADDRESS_SIZE:()=>Jc,TRON_BIP39_PATH_INDEX_0:()=>zi,TRON_BIP39_PATH_PREFIX:()=>ap,fromHex:()=>Kc,fromPrivateKey:()=>Yc,isAddress:()=>to,isChecksumAddress:()=>Xc,toChecksumAddress:()=>Vi,toHex:()=>$});function Kc(n){return cn(n)?Cr(gt(n.replace(/^0x/,ht))):n}function $(n){return cn(n)?n.toLowerCase().replace(/^0x/,ht):it(Qc(n)).toLowerCase()}function Gg(n){n=n.toLowerCase();let r=n.substring(2).split(""),o=new Uint8Array(40);for(let i=0;i<40;i++)o[i]=r[i].charCodeAt(0);let s=gt((0,k.keccak256)(o).slice(2));for(let i=0;i<40;i+=2)s[i>>1]>>4>=8&&(r[i]=r[i].toUpperCase()),(s[i>>1]&15)>=8&&(r[i+1]=r[i+1].toUpperCase());return ht+r.join("")}function Vi(n){if(!to(n))throw new Error(`'${n}' is not a valid address string`);return Gg($(n))}function Xc(n){if(!cn(n)||n.length!==42)return!1;try{return Vi(n)===n}catch{return!1}}function Yc(n,r=!1){try{return Do(n,r)}catch{return!1}}function to(n){if(!n||!at(n))return!1;if(n.length===42)try{return to(Cr(gt(n)))}catch{return!1}try{return eu(n)}catch{return!1}}var Jc,ht,Hc,pn,ap,zi,Qt=se(()=>{Eo();Mn();un();er();Jc=34,ht="41",Hc=65,pn=/^(41)/,ap="m/44'/195'",zi=ap+"/0'/0/0"});var ou={};Lt(ou,{decode58:()=>Rs,encode58:()=>nu});function nu(n){if(n.length===0)return"";let r,o,s=[0];for(r=0;r<n.length;r++){for(o=0;o<s.length;o++)s[o]<<=8;s[0]+=n[r];let i=0;for(o=0;o<s.length;++o)s[o]+=i,i=s[o]/Ms|0,s[o]%=Ms;for(;i;)s.push(i%Ms),i=i/Ms|0}for(r=0;n[r]===0&&r<n.length-1;r++)s.push(0);return s.reverse().map(i=>tu[i]).join("")}function Rs(n){if(n.length===0)return[];let r,o,s=[0];for(r=0;r<n.length;r++){let i=n[r];if(!(i in ru))throw new Error("Non-base58 character");for(o=0;o<s.length;o++)s[o]*=Ms;s[0]+=ru[i];let a=0;for(o=0;o<s.length;++o)s[o]+=a,a=s[o]>>8,s[o]&=255;for(;a;)s.push(a&255),a>>=8}for(r=0;n[r]==="1"&&r<n.length-1;r++)s.push(0);return s.reverse()}var tu,ru,Ms,Gi=se(()=>{tu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ru={};for(let n=0;n<tu.length;n++)ru[tu.charAt(n)]=n;Ms=58});var cp,ro,up=se(()=>{cp=ye(require("axios"),1);un();ro=class{host;timeout;user;password;headers;statusPage;instance;constructor(r,o=3e4,s="",i="",a={},c="/"){if(!Ss(r))throw new Error("Invalid URL provided to HttpProvider");if(isNaN(o)||o<0)throw new Error("Invalid timeout duration provided");if(!vn(a))throw new Error("Invalid headers object provided");r=r.replace(/\/+$/,""),this.host=r,this.timeout=o,this.user=s,this.password=i,this.headers=a,this.statusPage=c,this.instance=cp.default.create({baseURL:r,timeout:o,headers:a,auth:s?{username:s,password:i}:void 0})}setStatusPage(r="/"){this.statusPage=r}async isConnected(r=this.statusPage){return this.request(r).then(o=>Ec(o,"blockID","block_header")).catch(()=>!1)}request(r,o={},s="get"){return s=s.toLowerCase(),this.instance.request({data:s=="post"&&Object.keys(o).length?o:null,params:s=="get"&&o,url:r,method:s}).then(({data:i})=>i)}}});var bt,Li=se(()=>{up();bt={HttpProvider:ro}});var iu={};Lt(iu,{decodeParams:()=>Lg,decodeParamsV2ByABI:()=>su,encodeParams:()=>$g,encodeParamsV2ByABI:()=>No});function lp(n){return ie.address.toHex(n).replace(pn,"0x")}function Lg(n,r,o,s=!1){if(s&&o.replace(/^0x/,"").length%64===8&&(o="0x"+o.replace(/^0x/,"").substring(8)),o.replace(/^0x/,"").length%64)throw new Error("The encoded string is not valid. Its length must be a multiple of 64.");return r=r.map(i=>(/trcToken/.test(i)&&(i=i.replace(/trcToken/,"uint256")),i)),$i.decode(r,o).reduce((i,a,c)=>(r[c]=="address"&&(a=ht+a.substr(2).toLowerCase()),n.length?i[n[c]]=a:i.push(a),i),n.length?{}:[])}function $g(n,r){for(let o=0;o<n.length;o++)n[o]==="address"&&(r[o]=ie.address.toHex(r[o]).replace(pn,"0x"));return $i.encode(n,r)}function Fs(n){let r=n.match(/([a-zA-Z0-9])(\[.*\])/);return r?r[2]:""}function dp(n){return(Fs(n).match(/\]\[/g)||[]).length+1}function No(n,r){let o=[],s=l=>l&&l.type.indexOf("tuple")===0&&l.components?`tuple(${l.components.map(A=>s(A)).join(",")})${Fs(l.type)}`:/trcToken/.test(l.type)?l.type.replace(/trcToken/,"uint256"):l.type,i=l=>{for(let p=0;p<l.length;p++){let A=l[p];/trcToken/.test(A)&&(l[p]=A.replace(/trcToken/,"uint256"))}},a=l=>Array.isArray(l)?(l.forEach((p,A)=>{l[A]=a(p)}),l):lp(l),c=(l,p,A)=>{A>1?p.length&&p.forEach(g=>{c(l,g,A-1)}):p.length&&A&&p.forEach(g=>{u(l,g)})},u=(l=[],p)=>{l.length&&l.forEach((A,g)=>{let P=A.type;if(p[g]){if(P==="address")p[g]=lp(p[g]);else if(P.match(/^([^\x5b]*)(\x5b|$)/)[0]==="address[")a(p[g]);else if(P.indexOf("tuple")===0)if(Fs(P)){let b=dp(P);c(A.components,p[g],b)}else u(A.components,p[g])}})};if(n.inputs&&n.inputs.length)for(let l=0;l<n.inputs.length;l++){let p=n.inputs[l].type;p==="bool"&&r[l]==="false"&&(r[l]=!1),o.push(p.indexOf("tuple")===0?s(n.inputs[l]):p),r.length<o.length&&r.push("")}return u(n.inputs,r),i(o),$i.encode(o,r)}function su(n,r){let o=u=>{for(let l=0;l<u.length;l++){let p=u[l];/^trcToken/.test(p)&&(u[l]=p.replace(/^trcToken/,"uint256"))}},s=u=>Array.isArray(u)?(u.forEach((l,p)=>{u[p]=s(l)}),u):ie.address.toHex(u),i=(u,l,p)=>{p>1?l.length&&l.forEach(A=>{i(u,A,p-1)}):l.length&&p&&l.forEach(A=>{c(u,A)})},a=u=>{let l=u.name?` ${u.name}`:"";return u&&u.type.indexOf("tuple")===0&&u.components?`tuple(${u.components.map(A=>a(A)).join(",")})${Fs(u.type)}${l}`:/trcToken/.test(u.type)?u.type.replace(/trcToken/,"uint256")+l:u.type+l},c=(u,l)=>{u.length&&u.forEach((p,A)=>{let{type:g,name:P}=p;if(l[A])if(g==="address")l[A]=ie.address.toHex(l[A]),P&&(l[P]=ie.address.toHex(l[A]));else if(g.match(/^([^\x5b]*)(\x5b|$)/)[0]==="address[")s(l[A]),P&&(l[P]=s(l[A]));else if(g.indexOf("tuple")===0){if(Fs(g)){let b=dp(g);i(p.components,l[A],b)}else c(p.components,l[A]);P&&(l[P]=l[A])}else P&&(l[P]=l[A]);else P&&(l[P]=l[A])})};if("outputs"in n&&n.outputs&&n.outputs.length>0){let u=[];for(let A=0;A<n.outputs.length;A++){let g=n.outputs[A].type,P=n.outputs[A].name?` ${n.outputs[A].name}`:"";u.push(g.indexOf("tuple")===0?a(n.outputs[A]):g+P)}o(u),(!r||!r.length)&&(r=new Uint8Array(32*n.outputs.length));let p=$i.decode(u,r).toArray(!0);return c(n.outputs,p),p}return[]}var $i,ks=se(()=>{er();Br();Qt();$i=new k.AbiCoder});var Uo,au=se(()=>{Qt();un();Uo=class{invalid(r){return r.msg||`Invalid ${r.name}${r.type==="address"?" address":""} provided`}notPositive(r){return`${r.name} must be a positive integer`}notEqual(r){return r.msg||`${r.names?.[0]} can not be equal to ${r.names?.[1]}`}notValid(r){let o={},s=!1;for(let i of r){let{name:a,names:c,value:u,type:l,gt:p,lt:A,gte:g,lte:P,optional:b}=i;if(!(b&&(!yt(u)||l!=="boolean"&&u===!1))){switch(o[a]=i.value,l){case"address":to(u)?o[a]=$(u):s=!0;break;case"integer":(!Hr(u)||typeof p=="number"&&u<=p||typeof A=="number"&&u>=A||typeof g=="number"&&u<g||typeof P=="number"&&u>P)&&(s=!0);break;case"positive-integer":if(!Hr(u)||u<=0)throw new Error(this.notPositive(i));break;case"tokenId":(!at(u)||!u.length)&&(s=!0);break;case"notEmptyObject":(!vn(u)||!Object.keys(u).length)&&(s=!0);break;case"notEqual":if(c&&o[c[0]]===o[c[1]])throw new Error(this.notEqual(i));break;case"resource":["BANDWIDTH","ENERGY"].includes(u)||(s=!0);break;case"url":Ss(u)||(s=!0);break;case"hex":cn(u)||(s=!0);break;case"array":Array.isArray(u)||(s=!0);break;case"not-empty-string":(!at(u)||!u.length)&&(s=!0);break;case"boolean":Oc(u)||(s=!0);break;case"string":(!at(u)||typeof p=="number"&&u.length<=p||typeof A=="number"&&u.length>=A||typeof g=="number"&&u.length<g||typeof P=="number"&&u.length>P)&&(s=!0);break}if(s)throw new Error(this.invalid(i))}}return!1}}});var pe,cu,uu,lu=se(()=>{(function(n){n.AccountCreateContract="AccountCreateContract",n.TransferContract="TransferContract",n.TransferAssetContract="TransferAssetContract",n.VoteAssetContract="VoteAssetContract",n.VoteWitnessContract="VoteWitnessContract",n.WitnessCreateContract="WitnessCreateContract",n.AssetIssueContract="AssetIssueContract",n.WitnessUpdateContract="WitnessUpdateContract",n.ParticipateAssetIssueContract="ParticipateAssetIssueContract",n.AccountUpdateContract="AccountUpdateContract",n.FreezeBalanceContract="FreezeBalanceContract",n.UnfreezeBalanceContract="UnfreezeBalanceContract",n.CancelAllUnfreezeV2Contract="CancelAllUnfreezeV2Contract",n.WithdrawBalanceContract="WithdrawBalanceContract",n.UnfreezeAssetContract="UnfreezeAssetContract",n.UpdateAssetContract="UpdateAssetContract",n.ProposalCreateContract="ProposalCreateContract",n.ProposalApproveContract="ProposalApproveContract",n.ProposalDeleteContract="ProposalDeleteContract",n.SetAccountIdContract="SetAccountIdContract",n.CustomContract="CustomContract",n.CreateSmartContract="CreateSmartContract",n.TriggerSmartContract="TriggerSmartContract",n.GetContract="GetContract",n.UpdateSettingContract="UpdateSettingContract",n.ExchangeCreateContract="ExchangeCreateContract",n.ExchangeInjectContract="ExchangeInjectContract",n.ExchangeWithdrawContract="ExchangeWithdrawContract",n.ExchangeTransactionContract="ExchangeTransactionContract",n.UpdateEnergyLimitContract="UpdateEnergyLimitContract",n.AccountPermissionUpdateContract="AccountPermissionUpdateContract",n.ClearABIContract="ClearABIContract",n.UpdateBrokerageContract="UpdateBrokerageContract",n.ShieldedTransferContract="ShieldedTransferContract",n.MarketSellAssetContract="MarketSellAssetContract",n.MarketCancelOrderContract="MarketCancelOrderContract",n.FreezeBalanceV2Contract="FreezeBalanceV2Contract",n.UnfreezeBalanceV2Contract="UnfreezeBalanceV2Contract",n.WithdrawExpireUnfreezeContract="WithdrawExpireUnfreezeContract",n.DelegateResourceContract="DelegateResourceContract",n.UnDelegateResourceContract="UnDelegateResourceContract",n.UNRECOGNIZED="UNRECOGNIZED"})(pe||(pe={}));(function(n){n[n.Owner=0]="Owner",n[n.Witness=1]="Witness",n[n.Active=2]="Active",n[n.UNRECOGNIZED=-1]="UNRECOGNIZED"})(cu||(cu={}));(function(n){n[n.Normal=0]="Normal",n[n.AssetIssue=1]="AssetIssue",n[n.Contract=2]="Contract",n[n.UNRECOGNIZED=-1]="UNRECOGNIZED"})(uu||(uu={}))});var gr=Et(Tt=>{var gu=typeof Object.defineProperties=="function"?Object.defineProperty:function(n,r,o){n!=Array.prototype&&n!=Object.prototype&&(n[r]=o.value)},oo=typeof window<"u"&&window===Tt?Tt:typeof global<"u"&&global!=null?global:Tt;function Zg(n,r){if(r){var o=oo;n=n.split(".");for(var s=0;s<n.length-1;s++){var i=n[s];i in o||(o[i]={}),o=o[i]}n=n[n.length-1],s=o[n],r=r(s),r!=s&&r!=null&&gu(o,n,{configurable:!0,writable:!0,value:r})}}function Jg(n){var r=0;return function(){return r<n.length?{done:!1,value:n[r++]}:{done:!0}}}function bp(){bp=function(){},oo.Symbol||(oo.Symbol=Hg)}function Tp(n,r){this.a=n,gu(this,"description",{configurable:!0,writable:!0,value:r})}Tp.prototype.toString=function(){return this.a};var Hg=function(){function n(o){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return new Tp("jscomp_symbol_"+(o||"")+"_"+r++,o)}var r=0;return n}();function hu(){bp();var n=oo.Symbol.iterator;n||(n=oo.Symbol.iterator=oo.Symbol("Symbol.iterator")),typeof Array.prototype[n]!="function"&&gu(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return Kg(Jg(this))}}),hu=function(){}}function Kg(n){return hu(),n={next:n},n[oo.Symbol.iterator]=function(){return this},n}function Xg(n,r){hu(),n instanceof String&&(n+="");var o=0,s={next:function(){if(o<n.length){var i=o++;return{value:r(i,n[i]),done:!1}}return s.next=function(){return{done:!0,value:void 0}},s.next()}};return s[Symbol.iterator]=function(){return s},s}Zg("Array.prototype.entries",function(n){return n||function(){return Xg(this,function(r,o){return[r,o]})}});var Yg=Tt||self;function G(n,r,o){n=n.split("."),o=o||Yg,n[0]in o||typeof o.execScript>"u"||o.execScript("var "+n[0]);for(var s;n.length&&(s=n.shift());)n.length||r===void 0?o[s]&&o[s]!==Object.prototype[s]?o=o[s]:o=o[s]={}:o[s]=r}function An(n){var r=typeof n;if(r=="object")if(n){if(n instanceof Array)return"array";if(n instanceof Object)return r;var o=Object.prototype.toString.call(n);if(o=="[object Window]")return"object";if(o=="[object Array]"||typeof n.length=="number"&&typeof n.splice<"u"&&typeof n.propertyIsEnumerable<"u"&&!n.propertyIsEnumerable("splice"))return"array";if(o=="[object Function]"||typeof n.call<"u"&&typeof n.propertyIsEnumerable<"u"&&!n.propertyIsEnumerable("call"))return"function"}else return"null";else if(r=="function"&&typeof n.call>"u")return"object";return r}function pp(n){var r=typeof n;return r=="object"&&n!=null||r=="function"}function qg(n,r,o){G(n,r,o)}function Qg(n,r){function o(){}o.prototype=r.prototype,n.prototype=new o,n.prototype.constructor=n}var Ap="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function eh(n,r){for(var o,s,i=1;i<arguments.length;i++){s=arguments[i];for(o in s)n[o]=s[o];for(var a=0;a<Ap.length;a++)o=Ap[a],Object.prototype.hasOwnProperty.call(s,o)&&(n[o]=s[o])}}var th=Array.prototype.forEach?function(n,r){Array.prototype.forEach.call(n,r,void 0)}:function(n,r){for(var o=n.length,s=typeof n=="string"?n.split(""):n,i=0;i<o;i++)i in s&&r.call(void 0,s[i],i,n)},Ns=Array.prototype.map?function(n,r){return Array.prototype.map.call(n,r,void 0)}:function(n,r){for(var o=n.length,s=Array(o),i=typeof n=="string"?n.split(""):n,a=0;a<o;a++)a in i&&(s[a]=r.call(void 0,i[a],a,n));return s};function rh(n,r,o){return 2>=arguments.length?Array.prototype.slice.call(n,r):Array.prototype.slice.call(n,r,o)}function Hi(n,r,o,s){var i="Assertion failed";if(o){i+=": "+o;var a=s}else n&&(i+=": "+n,a=r);throw Error(i,a||[])}function v(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];return n||Hi("",null,r,s),n}function nh(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];typeof n!="string"&&Hi("Expected string but got %s: %s.",[An(n),n],r,s)}function oh(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];Array.isArray(n)||Hi("Expected array but got %s: %s.",[An(n),n],r,s)}function rt(n,r){for(var o=[],s=1;s<arguments.length;++s)o[s-1]=arguments[s];throw Error("Failure"+(n?": "+n:""),o)}function Sr(n,r,o,s){for(var i=[],a=3;a<arguments.length;++a)i[a-3]=arguments[a];n instanceof r||Hi("Expected instanceof %s but got %s.",[fp(r),fp(n)],o,i)}function fp(n){return n instanceof Function?n.displayName||n.name||"unknown type name":n instanceof Object?n.constructor.displayName||n.constructor.name||Object.prototype.toString.call(n):n===null?"null":typeof n}function ee(n,r){if(this.f=n,this.b=r,this.a={},this.arrClean=!0,0<this.f.length){for(n=0;n<this.f.length;n++){r=this.f[n];var o=r[0];this.a[o.toString()]=new Pp(o,r[1])}this.arrClean=!0}}G("jspb.Map",ee,void 0);ee.prototype.g=function(){if(this.arrClean){if(this.b){var n=this.a,r;for(r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var o=n[r].a;o&&o.g()}}}else{for(this.f.length=0,n=Rn(this),n.sort(),r=0;r<n.length;r++){var s=this.a[n[r]];(o=s.a)&&o.g(),this.f.push([s.key,s.value])}this.arrClean=!0}return this.f};ee.prototype.toArray=ee.prototype.g;ee.prototype.Lc=function(n,r){for(var o=this.g(),s=[],i=0;i<o.length;i++){var a=this.a[o[i][0].toString()];jo(this,a);var c=a.a;c?(v(r),s.push([a.key,r(n,c)])):s.push([a.key,a.value])}return s};ee.prototype.toObject=ee.prototype.Lc;ee.fromObject=function(n,r,o){r=new ee([],r);for(var s=0;s<n.length;s++){var i=n[s][0],a=o(n[s][1]);r.set(i,a)}return r};function Us(n){this.a=0,this.b=n}Us.prototype.next=function(){return this.a<this.b.length?{done:!1,value:this.b[this.a++]}:{done:!0,value:void 0}};typeof Symbol<"u"&&(Us.prototype[Symbol.iterator]=function(){return this});ee.prototype.Jb=function(){return Rn(this).length};ee.prototype.getLength=ee.prototype.Jb;ee.prototype.clear=function(){this.a={},this.arrClean=!1};ee.prototype.clear=ee.prototype.clear;ee.prototype.Cb=function(n){n=n.toString();var r=this.a.hasOwnProperty(n);return delete this.a[n],this.arrClean=!1,r};ee.prototype.del=ee.prototype.Cb;ee.prototype.Eb=function(){var n=[],r=Rn(this);r.sort();for(var o=0;o<r.length;o++){var s=this.a[r[o]];n.push([s.key,s.value])}return n};ee.prototype.getEntryList=ee.prototype.Eb;ee.prototype.entries=function(){var n=[],r=Rn(this);r.sort();for(var o=0;o<r.length;o++){var s=this.a[r[o]];n.push([s.key,jo(this,s)])}return new Us(n)};ee.prototype.entries=ee.prototype.entries;ee.prototype.keys=function(){var n=[],r=Rn(this);r.sort();for(var o=0;o<r.length;o++)n.push(this.a[r[o]].key);return new Us(n)};ee.prototype.keys=ee.prototype.keys;ee.prototype.values=function(){var n=[],r=Rn(this);r.sort();for(var o=0;o<r.length;o++)n.push(jo(this,this.a[r[o]]));return new Us(n)};ee.prototype.values=ee.prototype.values;ee.prototype.forEach=function(n,r){var o=Rn(this);o.sort();for(var s=0;s<o.length;s++){var i=this.a[o[s]];n.call(r,jo(this,i),i.key,this)}};ee.prototype.forEach=ee.prototype.forEach;ee.prototype.set=function(n,r){var o=new Pp(n);return this.b?(o.a=r,o.value=r.g()):o.value=r,this.a[n.toString()]=o,this.arrClean=!1,this};ee.prototype.set=ee.prototype.set;function jo(n,r){return n.b?(r.a||(r.a=new n.b(r.value)),r.a):r.value}ee.prototype.get=function(n){if(n=this.a[n.toString()])return jo(this,n)};ee.prototype.get=ee.prototype.get;ee.prototype.has=function(n){return n.toString()in this.a};ee.prototype.has=ee.prototype.has;ee.prototype.Ic=function(n,r,o,s,i){var a=Rn(this);a.sort();for(var c=0;c<a.length;c++){var u=this.a[a[c]];r.Va(n),o.call(r,1,u.key),this.b?s.call(r,2,jo(this,u),i):s.call(r,2,u.value),r.Ya()}};ee.prototype.serializeBinary=ee.prototype.Ic;ee.deserializeBinary=function(n,r,o,s,i,a,c){for(;r.na()&&!r.bb();){var u=r.f;u==1?a=o.call(r):u==2&&(n.b?(v(i),c||(c=new n.b),s.call(r,c,i)):c=s.call(r))}v(a!=null),v(c!=null),n.set(a,c)};function Rn(n){n=n.a;var r=[],o;for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&r.push(o);return r}function Pp(n,r){this.key=n,this.value=r,this.a=void 0}function sh(n){if(8192>=n.length)return String.fromCharCode.apply(null,n);for(var r="",o=0;o<n.length;o+=8192)r+=String.fromCharCode.apply(null,rh(n,o,o+8192));return r}var du={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},Zi={"'":"\\'"},wp={},Os=null;function Cp(n,r){r===void 0&&(r=0),Wp(),r=wp[r];for(var o=[],s=0;s<n.length;s+=3){var i=n[s],a=s+1<n.length,c=a?n[s+1]:0,u=s+2<n.length,l=u?n[s+2]:0,p=i>>2;i=(i&3)<<4|c>>4,c=(c&15)<<2|l>>6,l&=63,u||(l=64,a||(c=64)),o.push(r[p],r[i],r[c]||"",r[l]||"")}return o.join("")}function Bp(n){var r=n.length,o=3*r/4;o%3?o=Math.floor(o):"=.".indexOf(n[r-1])!=-1&&(o="=.".indexOf(n[r-2])!=-1?o-2:o-1);var s=new Uint8Array(o),i=0;return ih(n,function(a){s[i++]=a}),s.subarray(0,i)}function ih(n,r){function o(l){for(;s<n.length;){var p=n.charAt(s++),A=Os[p];if(A!=null)return A;if(!/^[\s\xa0]*$/.test(p))throw Error("Unknown base64 encoding at char: "+p)}return l}Wp();for(var s=0;;){var i=o(-1),a=o(0),c=o(64),u=o(64);if(u===64&&i===-1)break;r(i<<2|a>>4),c!=64&&(r(a<<4&240|c>>2),u!=64&&r(c<<6&192|u))}}function Wp(){if(!Os){Os={};for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),r=["+/=","+/","-_=","-_.","-_"],o=0;5>o;o++){var s=n.concat(r[o].split(""));wp[o]=s;for(var i=0;i<s.length;i++){var a=s[i];Os[a]===void 0&&(Os[a]=i)}}}}G("jspb.ConstBinaryMessage",function(){},void 0);G("jspb.BinaryMessage",function(){},void 0);G("jspb.BinaryConstants.FieldType",{yb:-1,de:1,FLOAT:2,je:3,se:4,ie:5,xb:6,wb:7,BOOL:8,qe:9,he:10,ke:11,be:12,re:13,fe:14,le:15,me:16,ne:17,oe:18,ge:30,ue:31},void 0);G("jspb.BinaryConstants.WireType",{yb:-1,te:0,xb:1,ce:2,pe:3,ee:4,wb:5},void 0);G("jspb.BinaryConstants.FieldTypeToWireType",function(n){switch(n){case 5:case 3:case 13:case 4:case 17:case 18:case 8:case 14:case 31:return 0;case 1:case 6:case 16:case 30:return 1;case 9:case 11:case 12:return 2;case 2:case 7:case 15:return 5;default:return-1}},void 0);G("jspb.BinaryConstants.INVALID_FIELD_NUMBER",-1,void 0);G("jspb.BinaryConstants.FLOAT32_EPS",1401298464324817e-60,void 0);G("jspb.BinaryConstants.FLOAT32_MIN",11754943508222875e-54,void 0);G("jspb.BinaryConstants.FLOAT32_MAX",34028234663852886e22,void 0);G("jspb.BinaryConstants.FLOAT64_EPS",5e-324,void 0);G("jspb.BinaryConstants.FLOAT64_MIN",22250738585072014e-324,void 0);G("jspb.BinaryConstants.FLOAT64_MAX",17976931348623157e292,void 0);G("jspb.BinaryConstants.TWO_TO_20",1048576,void 0);G("jspb.BinaryConstants.TWO_TO_23",8388608,void 0);G("jspb.BinaryConstants.TWO_TO_31",2147483648,void 0);G("jspb.BinaryConstants.TWO_TO_32",4294967296,void 0);G("jspb.BinaryConstants.TWO_TO_52",4503599627370496,void 0);G("jspb.BinaryConstants.TWO_TO_63",9223372036854776e3,void 0);G("jspb.BinaryConstants.TWO_TO_64",18446744073709552e3,void 0);G("jspb.BinaryConstants.ZERO_HASH","\0\0\0\0\0\0\0\0",void 0);function no(n,r){if(n)throw Error("Invalid UTF8");r.push(65533)}function mp(n,r){return r=String.fromCharCode.apply(null,r),n==null?r:n+r}var Ji=void 0,pu,gp,ah=typeof TextDecoder<"u",Re=0,ke=0;G("jspb.utils.getSplit64Low",function(){return Re},void 0);G("jspb.utils.getSplit64High",function(){return ke},void 0);function yu(n){var r=n>>>0;n=Math.floor((n-r)/4294967296)>>>0,Re=r,ke=n}G("jspb.utils.splitUint64",yu,void 0);function _s(n){var r=0>n;n=Math.abs(n);var o=n>>>0;n=Math.floor((n-o)/4294967296),n>>>=0,r&&(n=~n>>>0,o=(~o>>>0)+1,4294967295<o&&(o=0,n++,4294967295<n&&(n=0))),Re=o,ke=n}G("jspb.utils.splitInt64",_s,void 0);function Sp(n){var r=0>n;n=2*Math.abs(n),yu(n),n=Re;var o=ke;r&&(n==0?o==0?o=n=4294967295:(o--,n=4294967295):n--),Re=n,ke=o}G("jspb.utils.splitZigzag64",Sp,void 0);function vp(n){var r=0>n?1:0;if(n=r?-n:n,n===0)0<1/n?Re=ke=0:(ke=0,Re=2147483648);else if(isNaN(n))ke=0,Re=2147483647;else if(34028234663852886e22<n)ke=0,Re=(r<<31|2139095040)>>>0;else if(11754943508222875e-54>n)n=Math.round(n/Math.pow(2,-149)),ke=0,Re=(r<<31|n)>>>0;else{var o=Math.floor(Math.log(n)/Math.LN2);n*=Math.pow(2,-o),n=Math.round(8388608*n),16777216<=n&&++o,ke=0,Re=(r<<31|o+127<<23|n&8388607)>>>0}}G("jspb.utils.splitFloat32",vp,void 0);function Ip(n){var r=0>n?1:0;if(n=r?-n:n,n===0)ke=0<1/n?0:2147483648,Re=0;else if(isNaN(n))ke=2147483647,Re=4294967295;else if(17976931348623157e292<n)ke=(r<<31|2146435072)>>>0,Re=0;else if(22250738585072014e-324>n)n/=Math.pow(2,-1074),ke=(r<<31|n/4294967296)>>>0,Re=n>>>0;else{var o=n,s=0;if(2<=o)for(;2<=o&&1023>s;)s++,o/=2;else for(;1>o&&-1022<s;)o*=2,s--;n*=Math.pow(2,-s),ke=(r<<31|s+1023<<20|1048576*n&1048575)>>>0,Re=4503599627370496*n>>>0}}G("jspb.utils.splitFloat64",Ip,void 0);function Fn(n){var r=n.charCodeAt(4),o=n.charCodeAt(5),s=n.charCodeAt(6),i=n.charCodeAt(7);Re=n.charCodeAt(0)+(n.charCodeAt(1)<<8)+(n.charCodeAt(2)<<16)+(n.charCodeAt(3)<<24)>>>0,ke=r+(o<<8)+(s<<16)+(i<<24)>>>0}G("jspb.utils.splitHash64",Fn,void 0);function zo(n,r){return 4294967296*r+(n>>>0)}G("jspb.utils.joinUint64",zo,void 0);function js(n,r){var o=r&2147483648;return o&&(n=~n+1>>>0,r=~r>>>0,n==0&&(r=r+1>>>0)),n=zo(n,r),o?-n:n}G("jspb.utils.joinInt64",js,void 0);function Ki(n,r,o){var s=r>>31;return o(n<<1^s,(r<<1|n>>>31)^s)}G("jspb.utils.toZigzag64",Ki,void 0);function Mp(n,r){return Xi(n,r,js)}G("jspb.utils.joinZigzag64",Mp,void 0);function Xi(n,r,o){var s=-(n&1);return o((n>>>1|r<<31)^s,r>>>1^s)}G("jspb.utils.fromZigzag64",Xi,void 0);function Rp(n){var r=2*(n>>31)+1,o=n>>>23&255;return n&=8388607,o==255?n?NaN:1/0*r:o==0?r*Math.pow(2,-149)*n:r*Math.pow(2,o-150)*(n+Math.pow(2,23))}G("jspb.utils.joinFloat32",Rp,void 0);function Fp(n,r){var o=2*(r>>31)+1,s=r>>>20&2047;return n=4294967296*(r&1048575)+n,s==2047?n?NaN:1/0*o:s==0?o*Math.pow(2,-1074)*n:o*Math.pow(2,s-1075)*(n+4503599627370496)}G("jspb.utils.joinFloat64",Fp,void 0);function Yi(n,r){return String.fromCharCode(n>>>0&255,n>>>8&255,n>>>16&255,n>>>24&255,r>>>0&255,r>>>8&255,r>>>16&255,r>>>24&255)}G("jspb.utils.joinHash64",Yi,void 0);G("jspb.utils.DIGITS","0123456789abcdef".split(""),void 0);function zs(n,r){function o(i,a){return i=i?String(i):"",a?"0000000".slice(i.length)+i:i}if(2097151>=r)return""+zo(n,r);var s=(n>>>24|r<<8)>>>0&16777215;return r=r>>16&65535,n=(n&16777215)+6777216*s+6710656*r,s+=8147497*r,r*=2,1e7<=n&&(s+=Math.floor(n/1e7),n%=1e7),1e7<=s&&(r+=Math.floor(s/1e7),s%=1e7),o(r,0)+o(s,r)+o(n,1)}G("jspb.utils.joinUnsignedDecimalString",zs,void 0);function Vs(n,r){var o=r&2147483648;return o&&(n=~n+1>>>0,r=~r+(n==0?1:0)>>>0),n=zs(n,r),o?"-"+n:n}G("jspb.utils.joinSignedDecimalString",Vs,void 0);function kp(n,r){Fn(n),n=Re;var o=ke;return r?Vs(n,o):zs(n,o)}G("jspb.utils.hash64ToDecimalString",kp,void 0);G("jspb.utils.hash64ArrayToDecimalStrings",function(n,r){for(var o=Array(n.length),s=0;s<n.length;s++)o[s]=kp(n[s],r);return o},void 0);function Gs(n){function r(c,u){for(var l=0;8>l&&(c!==1||0<u);l++)u=c*i[l]+u,i[l]=u&255,u>>>=8}function o(){for(var c=0;8>c;c++)i[c]=~i[c]&255}v(0<n.length);var s=!1;n[0]==="-"&&(s=!0,n=n.slice(1));for(var i=[0,0,0,0,0,0,0,0],a=0;a<n.length;a++)r(10,n.charCodeAt(a)-48);return s&&(o(),r(1,1)),sh(i)}G("jspb.utils.decimalStringToHash64",Gs,void 0);G("jspb.utils.splitDecimalString",function(n){Fn(Gs(n))},void 0);function hp(n){return String.fromCharCode(10>n?48+n:87+n)}function yp(n){return 97<=n?n-97+10:n-48}G("jspb.utils.hash64ToHexString",function(n){var r=Array(18);r[0]="0",r[1]="x";for(var o=0;8>o;o++){var s=n.charCodeAt(7-o);r[2*o+2]=hp(s>>4),r[2*o+3]=hp(s&15)}return r.join("")},void 0);G("jspb.utils.hexStringToHash64",function(n){n=n.toLowerCase(),v(n.length==18),v(n[0]=="0"),v(n[1]=="x");for(var r="",o=0;8>o;o++)r=String.fromCharCode(16*yp(n.charCodeAt(2*o+2))+yp(n.charCodeAt(2*o+3)))+r;return r},void 0);G("jspb.utils.hash64ToNumber",function(n,r){Fn(n),n=Re;var o=ke;return r?js(n,o):zo(n,o)},void 0);G("jspb.utils.numberToHash64",function(n){return _s(n),Yi(Re,ke)},void 0);G("jspb.utils.countVarints",function(n,r,o){for(var s=0,i=r;i<o;i++)s+=n[i]>>7;return o-r-s},void 0);G("jspb.utils.countVarintFields",function(n,r,o,s){var i=0;if(s*=8,128>s)for(;r<o&&n[r++]==s;)for(i++;;){var a=n[r++];if(!(a&128))break}else for(;r<o;){for(a=s;128<a;){if(n[r]!=(a&127|128))return i;r++,a>>=7}if(n[r++]!=a)break;for(i++;a=n[r++],(a&128)!=0;);}return i},void 0);function Op(n,r,o,s,i){var a=0;if(128>s)for(;r<o&&n[r++]==s;)a++,r+=i;else for(;r<o;){for(var c=s;128<c;){if(n[r++]!=(c&127|128))return a;c>>=7}if(n[r++]!=c)break;a++,r+=i}return a}G("jspb.utils.countFixed32Fields",function(n,r,o,s){return Op(n,r,o,8*s+5,4)},void 0);G("jspb.utils.countFixed64Fields",function(n,r,o,s){return Op(n,r,o,8*s+1,8)},void 0);G("jspb.utils.countDelimitedFields",function(n,r,o,s){var i=0;for(s=8*s+2;r<o;){for(var a=s;128<a;){if(n[r++]!=(a&127|128))return i;a>>=7}if(n[r++]!=a)break;i++;for(var c=0,u=1;a=n[r++],c+=(a&127)*u,u*=128,(a&128)!=0;);r+=c}return i},void 0);G("jspb.utils.debugBytesToTextFormat",function(n){var r='"';if(n){n=qi(n);for(var o=0;o<n.length;o++)r+="\\x",16>n[o]&&(r+="0"),r+=n[o].toString(16)}return r+'"'},void 0);G("jspb.utils.debugScalarToTextFormat",function(n){if(typeof n=="string"){n=String(n);for(var r=['"'],o=0;o<n.length;o++){var s=n.charAt(o),i=s.charCodeAt(0),a=o+1,c;(c=du[s])||(31<i&&127>i||(i=s,i in Zi?s=Zi[i]:i in du?s=Zi[i]=du[i]:(c=i.charCodeAt(0),31<c&&127>c?s=i:(256>c?(s="\\x",(16>c||256<c)&&(s+="0")):(s="\\u",4096>c&&(s+="0")),s+=c.toString(16).toUpperCase()),s=Zi[i]=s)),c=s),r[a]=c}r.push('"'),n=r.join("")}else n=n.toString();return n},void 0);G("jspb.utils.stringToByteArray",function(n){for(var r=new Uint8Array(n.length),o=0;o<n.length;o++){var s=n.charCodeAt(o);if(255<s)throw Error("Conversion error: string contains codepoint outside of byte range");r[o]=s}return r},void 0);function qi(n){return n.constructor===Uint8Array?n:n.constructor===ArrayBuffer?new Uint8Array(n):n.constructor===Array?new Uint8Array(n):n.constructor===String?Bp(n):n instanceof Uint8Array?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):(rt("Type not convertible to Uint8Array."),new Uint8Array(0))}G("jspb.utils.byteSourceToUint8Array",qi,void 0);function B(n,r,o){this.b=null,this.a=this.f=this.h=0,this.v=!1,n&&this.H(n,r,o)}G("jspb.BinaryDecoder",B,void 0);var Es=[];B.getInstanceCacheLength=function(){return Es.length};function Qi(n,r,o){if(Es.length){var s=Es.pop();return n&&s.H(n,r,o),s}return new B(n,r,o)}B.alloc=Qi;B.prototype.Ca=function(){this.clear(),100>Es.length&&Es.push(this)};B.prototype.free=B.prototype.Ca;B.prototype.clone=function(){return Qi(this.b,this.h,this.f-this.h)};B.prototype.clone=B.prototype.clone;B.prototype.clear=function(){this.b=null,this.a=this.f=this.h=0,this.v=!1};B.prototype.clear=B.prototype.clear;B.prototype.Y=function(){return this.b};B.prototype.getBuffer=B.prototype.Y;B.prototype.H=function(n,r,o){this.b=qi(n),this.h=r!==void 0?r:0,this.f=o!==void 0?this.h+o:this.b.length,this.a=this.h};B.prototype.setBlock=B.prototype.H;B.prototype.Db=function(){return this.f};B.prototype.getEnd=B.prototype.Db;B.prototype.setEnd=function(n){this.f=n};B.prototype.setEnd=B.prototype.setEnd;B.prototype.reset=function(){this.a=this.h};B.prototype.reset=B.prototype.reset;B.prototype.B=function(){return this.a};B.prototype.getCursor=B.prototype.B;B.prototype.Ma=function(n){this.a=n};B.prototype.setCursor=B.prototype.Ma;B.prototype.advance=function(n){this.a+=n,St(this)};B.prototype.advance=B.prototype.advance;B.prototype.ya=function(){return this.a==this.f};B.prototype.atEnd=B.prototype.ya;B.prototype.Qb=function(){return this.a>this.f};B.prototype.pastEnd=B.prototype.Qb;B.prototype.getError=function(){return this.v||0>this.a||this.a>this.f};B.prototype.getError=B.prototype.getError;B.prototype.w=function(n){for(var r=128,o=0,s=0,i=0;4>i&&128<=r;i++)r=this.b[this.a++],o|=(r&127)<<7*i;if(128<=r&&(r=this.b[this.a++],o|=(r&127)<<28,s|=(r&127)>>4),128<=r)for(i=0;5>i&&128<=r;i++)r=this.b[this.a++],s|=(r&127)<<7*i+3;if(128>r)return n(o>>>0,s>>>0);rt("Failed to read varint, encoding is invalid."),this.v=!0};B.prototype.readSplitVarint64=B.prototype.w;B.prototype.ea=function(n){return this.w(function(r,o){return Xi(r,o,n)})};B.prototype.readSplitZigzagVarint64=B.prototype.ea;B.prototype.sa=function(n){var r=this.b,o=this.a;this.a+=8;for(var s=0,i=0,a=o+7;a>=o;a--)s=s<<8|r[a],i=i<<8|r[a+4];return n(s,i)};B.prototype.readSplitFixed64=B.prototype.sa;function St(n){n.a>n.f&&rt("Read past the end "+n.a+" > "+n.f)}B.prototype.kb=function(){for(;this.b[this.a]&128;)this.a++;this.a++};B.prototype.skipVarint=B.prototype.kb;B.prototype.mb=function(n){for(;128<n;)this.a--,n>>>=7;this.a--};B.prototype.unskipVarint=B.prototype.mb;B.prototype.s=function(){var n=this.b,r=n[this.a],o=r&127;return 128>r?(this.a+=1,St(this),o):(r=n[this.a+1],o|=(r&127)<<7,128>r?(this.a+=2,St(this),o):(r=n[this.a+2],o|=(r&127)<<14,128>r?(this.a+=3,St(this),o):(r=n[this.a+3],o|=(r&127)<<21,128>r?(this.a+=4,St(this),o):(r=n[this.a+4],o|=(r&15)<<28,128>r?(this.a+=5,St(this),o>>>0):(this.a+=5,128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&v(!1),St(this),o)))))};B.prototype.readUnsignedVarint32=B.prototype.s;B.prototype.da=function(){return~~this.s()};B.prototype.readSignedVarint32=B.prototype.da;B.prototype.O=function(){return this.s().toString()};B.prototype.Ea=function(){return this.da().toString()};B.prototype.readSignedVarint32String=B.prototype.Ea;B.prototype.Ia=function(){var n=this.s();return n>>>1^-(n&1)};B.prototype.readZigzagVarint32=B.prototype.Ia;B.prototype.Ga=function(){return this.w(zo)};B.prototype.readUnsignedVarint64=B.prototype.Ga;B.prototype.Ha=function(){return this.w(zs)};B.prototype.readUnsignedVarint64String=B.prototype.Ha;B.prototype.ra=function(){return this.w(js)};B.prototype.readSignedVarint64=B.prototype.ra;B.prototype.Fa=function(){return this.w(Vs)};B.prototype.readSignedVarint64String=B.prototype.Fa;B.prototype.Ja=function(){return this.w(Mp)};B.prototype.readZigzagVarint64=B.prototype.Ja;B.prototype.fb=function(){return this.ea(Yi)};B.prototype.readZigzagVarintHash64=B.prototype.fb;B.prototype.Ka=function(){return this.ea(Vs)};B.prototype.readZigzagVarint64String=B.prototype.Ka;B.prototype.Fc=function(){var n=this.b[this.a];return this.a+=1,St(this),n};B.prototype.readUint8=B.prototype.Fc;B.prototype.Dc=function(){var n=this.b[this.a],r=this.b[this.a+1];return this.a+=2,St(this),n<<0|r<<8};B.prototype.readUint16=B.prototype.Dc;B.prototype.m=function(){var n=this.b[this.a],r=this.b[this.a+1],o=this.b[this.a+2],s=this.b[this.a+3];return this.a+=4,St(this),(n<<0|r<<8|o<<16|s<<24)>>>0};B.prototype.readUint32=B.prototype.m;B.prototype.fa=function(){var n=this.m(),r=this.m();return zo(n,r)};B.prototype.readUint64=B.prototype.fa;B.prototype.ga=function(){var n=this.m(),r=this.m();return zs(n,r)};B.prototype.readUint64String=B.prototype.ga;B.prototype.Xb=function(){var n=this.b[this.a];return this.a+=1,St(this),n<<24>>24};B.prototype.readInt8=B.prototype.Xb;B.prototype.Vb=function(){var n=this.b[this.a],r=this.b[this.a+1];return this.a+=2,St(this),(n<<0|r<<8)<<16>>16};B.prototype.readInt16=B.prototype.Vb;B.prototype.P=function(){var n=this.b[this.a],r=this.b[this.a+1],o=this.b[this.a+2],s=this.b[this.a+3];return this.a+=4,St(this),n<<0|r<<8|o<<16|s<<24};B.prototype.readInt32=B.prototype.P;B.prototype.ba=function(){var n=this.m(),r=this.m();return js(n,r)};B.prototype.readInt64=B.prototype.ba;B.prototype.ca=function(){var n=this.m(),r=this.m();return Vs(n,r)};B.prototype.readInt64String=B.prototype.ca;B.prototype.aa=function(){var n=this.m();return Rp(n,0)};B.prototype.readFloat=B.prototype.aa;B.prototype.Z=function(){var n=this.m(),r=this.m();return Fp(n,r)};B.prototype.readDouble=B.prototype.Z;B.prototype.oa=function(){var n=!!this.b[this.a++];return St(this),n};B.prototype.readBool=B.prototype.oa;B.prototype.qa=function(){return this.da()};B.prototype.readEnum=B.prototype.qa;B.prototype.ta=function(n,r){var o=this.a;this.a+=n,St(this);var s=v(this.b);if(ah){var i;r?(i=pu)||(i=pu=new TextDecoder("utf-8",{fatal:!0})):(i=gp)||(i=gp=new TextDecoder("utf-8",{fatal:!1}));var a=o+n;s=o===0&&a===s.length?s:s.subarray(o,a);try{var c=i.decode(s)}catch(A){if(r){if(Ji===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),Ji=!0}catch{Ji=!1}}r=!Ji}throw r&&(pu=void 0),A}}else{n=o+n,c=[];for(var u=null,l,p;o<n;)l=s[o++],128>l?c.push(l):224>l?o>=n?no(r,c):(p=s[o++],194>l||(p&192)!==128?(o--,no(r,c)):(l=(l&31)<<6|p&63,v(128<=l&&2047>=l),c.push(l))):240>l?o>=n-1?no(r,c):(p=s[o++],(p&192)!==128||l===224&&160>p||l===237&&160<=p||((i=s[o++])&192)!==128?(o--,no(r,c)):(l=(l&15)<<12|(p&63)<<6|i&63,v(2048<=l&&65535>=l),v(55296>l||57343<l),c.push(l))):244>=l?o>=n-2?no(r,c):(p=s[o++],(p&192)!==128||(l<<28)+(p-144)>>30||((i=s[o++])&192)!==128||((a=s[o++])&192)!==128?(o--,no(r,c)):(l=(l&7)<<18|(p&63)<<12|(i&63)<<6|a&63,v(65536<=l&&1114111>=l),l-=65536,c.push((l>>10&1023)+55296,(l&1023)+56320))):no(r,c),8192<=c.length&&(u=mp(u,c),c.length=0);v(o===n,"expected "+o+" === "+n),c=mp(u,c)}return c};B.prototype.readString=B.prototype.ta;B.prototype.pa=function(n){if(0>n||this.a+n>this.b.length)return this.v=!0,rt("Invalid byte length!"),new Uint8Array(0);var r=this.b.subarray(this.a,this.a+n);return this.a+=n,St(this),r};B.prototype.readBytes=B.prototype.pa;B.prototype.ha=function(){return this.w(Yi)};B.prototype.readVarintHash64=B.prototype.ha;B.prototype.$=function(){var n=this.b,r=this.a,o=n[r],s=n[r+1],i=n[r+2],a=n[r+3],c=n[r+4],u=n[r+5],l=n[r+6];return n=n[r+7],this.a+=8,String.fromCharCode(o,s,i,a,c,u,l,n)};B.prototype.readFixedHash64=B.prototype.$;v(!0);function h(n,r,o){this.a=Qi(n,r,o),this.O=this.a.B(),this.b=this.f=-1,this.h=!1,this.v=null}G("jspb.BinaryReader",h,void 0);var _o=[];h.clearInstanceCache=function(){_o=[]};h.getInstanceCacheLength=function(){return _o.length};function Ep(n,r,o){if(_o.length){var s=_o.pop();return n&&s.a.H(n,r,o),s}return new h(n,r,o)}h.alloc=Ep;h.prototype.zb=Ep;h.prototype.alloc=h.prototype.zb;h.prototype.Ca=function(){this.a.clear(),this.b=this.f=-1,this.h=!1,this.v=null,100>_o.length&&_o.push(this)};h.prototype.free=h.prototype.Ca;h.prototype.Fb=function(){return this.O};h.prototype.getFieldCursor=h.prototype.Fb;h.prototype.B=function(){return this.a.B()};h.prototype.getCursor=h.prototype.B;h.prototype.Y=function(){return this.a.Y()};h.prototype.getBuffer=h.prototype.Y;h.prototype.Hb=function(){return this.f};h.prototype.getFieldNumber=h.prototype.Hb;h.prototype.Lb=function(){return this.b};h.prototype.getWireType=h.prototype.Lb;h.prototype.Mb=function(){return this.b==2};h.prototype.isDelimited=h.prototype.Mb;h.prototype.bb=function(){return this.b==4};h.prototype.isEndGroup=h.prototype.bb;h.prototype.getError=function(){return this.h||this.a.getError()};h.prototype.getError=h.prototype.getError;h.prototype.H=function(n,r,o){this.a.H(n,r,o),this.b=this.f=-1};h.prototype.setBlock=h.prototype.H;h.prototype.reset=function(){this.a.reset(),this.b=this.f=-1};h.prototype.reset=h.prototype.reset;h.prototype.advance=function(n){this.a.advance(n)};h.prototype.advance=h.prototype.advance;h.prototype.na=function(){if(this.a.ya())return!1;if(this.getError())return rt("Decoder hit an error"),!1;this.O=this.a.B();var n=this.a.s(),r=n>>>3;return n&=7,n!=0&&n!=5&&n!=1&&n!=2&&n!=3&&n!=4?(rt("Invalid wire type: %s (at position %s)",n,this.O),this.h=!0,!1):(this.f=r,this.b=n,!0)};h.prototype.nextField=h.prototype.na;h.prototype.Oa=function(){this.a.mb(this.f<<3|this.b)};h.prototype.unskipHeader=h.prototype.Oa;h.prototype.Kc=function(){var n=this.f;for(this.Oa();this.na()&&this.f==n;)this.C();this.a.ya()||this.Oa()};h.prototype.skipMatchingFields=h.prototype.Kc;h.prototype.lb=function(){this.b!=0?(rt("Invalid wire type for skipVarintField"),this.C()):this.a.kb()};h.prototype.skipVarintField=h.prototype.lb;h.prototype.gb=function(){if(this.b!=2)rt("Invalid wire type for skipDelimitedField"),this.C();else{var n=this.a.s();this.a.advance(n)}};h.prototype.skipDelimitedField=h.prototype.gb;h.prototype.hb=function(){this.b!=5?(rt("Invalid wire type for skipFixed32Field"),this.C()):this.a.advance(4)};h.prototype.skipFixed32Field=h.prototype.hb;h.prototype.ib=function(){this.b!=1?(rt("Invalid wire type for skipFixed64Field"),this.C()):this.a.advance(8)};h.prototype.skipFixed64Field=h.prototype.ib;h.prototype.jb=function(){var n=this.f;do{if(!this.na()){rt("Unmatched start-group tag: stream EOF"),this.h=!0;break}if(this.b==4){this.f!=n&&(rt("Unmatched end-group tag"),this.h=!0);break}this.C()}while(!0)};h.prototype.skipGroup=h.prototype.jb;h.prototype.C=function(){switch(this.b){case 0:this.lb();break;case 1:this.ib();break;case 2:this.gb();break;case 5:this.hb();break;case 3:this.jb();break;default:rt("Invalid wire encoding for field.")}};h.prototype.skipField=h.prototype.C;h.prototype.Gc=function(n,r){this.v===null&&(this.v={}),v(!this.v[n]),this.v[n]=r};h.prototype.registerReadCallback=h.prototype.Gc;h.prototype.Hc=function(n){return v(this.v!==null),n=this.v[n],v(n),n(this)};h.prototype.runReadCallback=h.prototype.Hc;h.prototype.Yb=function(n,r){v(this.b==2);var o=this.a.f,s=this.a.s();s=this.a.B()+s,this.a.setEnd(s),r(n,this),this.a.Ma(s),this.a.setEnd(o)};h.prototype.readMessage=h.prototype.Yb;h.prototype.Ub=function(n,r,o){v(this.b==3),v(this.f==n),o(r,this),this.h||this.b==4||(rt("Group submessage did not end with an END_GROUP tag"),this.h=!0)};h.prototype.readGroup=h.prototype.Ub;h.prototype.Gb=function(){v(this.b==2);var n=this.a.s(),r=this.a.B(),o=r+n;return n=Qi(this.a.Y(),r,n),this.a.Ma(o),n};h.prototype.getFieldDecoder=h.prototype.Gb;h.prototype.P=function(){return v(this.b==0),this.a.da()};h.prototype.readInt32=h.prototype.P;h.prototype.Wb=function(){return v(this.b==0),this.a.Ea()};h.prototype.readInt32String=h.prototype.Wb;h.prototype.ba=function(){return v(this.b==0),this.a.ra()};h.prototype.readInt64=h.prototype.ba;h.prototype.ca=function(){return v(this.b==0),this.a.Fa()};h.prototype.readInt64String=h.prototype.ca;h.prototype.m=function(){return v(this.b==0),this.a.s()};h.prototype.readUint32=h.prototype.m;h.prototype.Ec=function(){return v(this.b==0),this.a.O()};h.prototype.readUint32String=h.prototype.Ec;h.prototype.fa=function(){return v(this.b==0),this.a.Ga()};h.prototype.readUint64=h.prototype.fa;h.prototype.ga=function(){return v(this.b==0),this.a.Ha()};h.prototype.readUint64String=h.prototype.ga;h.prototype.zc=function(){return v(this.b==0),this.a.Ia()};h.prototype.readSint32=h.prototype.zc;h.prototype.Ac=function(){return v(this.b==0),this.a.Ja()};h.prototype.readSint64=h.prototype.Ac;h.prototype.Bc=function(){return v(this.b==0),this.a.Ka()};h.prototype.readSint64String=h.prototype.Bc;h.prototype.Rb=function(){return v(this.b==5),this.a.m()};h.prototype.readFixed32=h.prototype.Rb;h.prototype.Sb=function(){return v(this.b==1),this.a.fa()};h.prototype.readFixed64=h.prototype.Sb;h.prototype.Tb=function(){return v(this.b==1),this.a.ga()};h.prototype.readFixed64String=h.prototype.Tb;h.prototype.vc=function(){return v(this.b==5),this.a.P()};h.prototype.readSfixed32=h.prototype.vc;h.prototype.wc=function(){return v(this.b==5),this.a.P().toString()};h.prototype.readSfixed32String=h.prototype.wc;h.prototype.xc=function(){return v(this.b==1),this.a.ba()};h.prototype.readSfixed64=h.prototype.xc;h.prototype.yc=function(){return v(this.b==1),this.a.ca()};h.prototype.readSfixed64String=h.prototype.yc;h.prototype.aa=function(){return v(this.b==5),this.a.aa()};h.prototype.readFloat=h.prototype.aa;h.prototype.Z=function(){return v(this.b==1),this.a.Z()};h.prototype.readDouble=h.prototype.Z;h.prototype.oa=function(){return v(this.b==0),!!this.a.s()};h.prototype.readBool=h.prototype.oa;h.prototype.qa=function(){return v(this.b==0),this.a.ra()};h.prototype.readEnum=h.prototype.qa;h.prototype.ta=function(){v(this.b==2);var n=this.a.s();return this.a.ta(n,!0)};h.prototype.readString=h.prototype.ta;h.prototype.pa=function(){v(this.b==2);var n=this.a.s();return this.a.pa(n)};h.prototype.readBytes=h.prototype.pa;h.prototype.ha=function(){return v(this.b==0),this.a.ha()};h.prototype.readVarintHash64=h.prototype.ha;h.prototype.Cc=function(){return v(this.b==0),this.a.fb()};h.prototype.readSintHash64=h.prototype.Cc;h.prototype.w=function(n){return v(this.b==0),this.a.w(n)};h.prototype.readSplitVarint64=h.prototype.w;h.prototype.ea=function(n){return v(this.b==0),this.a.w(function(r,o){return Xi(r,o,n)})};h.prototype.readSplitZigzagVarint64=h.prototype.ea;h.prototype.$=function(){return v(this.b==1),this.a.$()};h.prototype.readFixedHash64=h.prototype.$;h.prototype.sa=function(n){return v(this.b==1),this.a.sa(n)};h.prototype.readSplitFixed64=h.prototype.sa;function Je(n,r){v(n.b==2);var o=n.a.s();o=n.a.B()+o;for(var s=[];n.a.B()<o;)s.push(r.call(n.a));return s}h.prototype.gc=function(){return Je(this,this.a.da)};h.prototype.readPackedInt32=h.prototype.gc;h.prototype.hc=function(){return Je(this,this.a.Ea)};h.prototype.readPackedInt32String=h.prototype.hc;h.prototype.ic=function(){return Je(this,this.a.ra)};h.prototype.readPackedInt64=h.prototype.ic;h.prototype.jc=function(){return Je(this,this.a.Fa)};h.prototype.readPackedInt64String=h.prototype.jc;h.prototype.qc=function(){return Je(this,this.a.s)};h.prototype.readPackedUint32=h.prototype.qc;h.prototype.rc=function(){return Je(this,this.a.O)};h.prototype.readPackedUint32String=h.prototype.rc;h.prototype.sc=function(){return Je(this,this.a.Ga)};h.prototype.readPackedUint64=h.prototype.sc;h.prototype.tc=function(){return Je(this,this.a.Ha)};h.prototype.readPackedUint64String=h.prototype.tc;h.prototype.nc=function(){return Je(this,this.a.Ia)};h.prototype.readPackedSint32=h.prototype.nc;h.prototype.oc=function(){return Je(this,this.a.Ja)};h.prototype.readPackedSint64=h.prototype.oc;h.prototype.pc=function(){return Je(this,this.a.Ka)};h.prototype.readPackedSint64String=h.prototype.pc;h.prototype.bc=function(){return Je(this,this.a.m)};h.prototype.readPackedFixed32=h.prototype.bc;h.prototype.cc=function(){return Je(this,this.a.fa)};h.prototype.readPackedFixed64=h.prototype.cc;h.prototype.dc=function(){return Je(this,this.a.ga)};h.prototype.readPackedFixed64String=h.prototype.dc;h.prototype.kc=function(){return Je(this,this.a.P)};h.prototype.readPackedSfixed32=h.prototype.kc;h.prototype.lc=function(){return Je(this,this.a.ba)};h.prototype.readPackedSfixed64=h.prototype.lc;h.prototype.mc=function(){return Je(this,this.a.ca)};h.prototype.readPackedSfixed64String=h.prototype.mc;h.prototype.fc=function(){return Je(this,this.a.aa)};h.prototype.readPackedFloat=h.prototype.fc;h.prototype.$b=function(){return Je(this,this.a.Z)};h.prototype.readPackedDouble=h.prototype.$b;h.prototype.Zb=function(){return Je(this,this.a.oa)};h.prototype.readPackedBool=h.prototype.Zb;h.prototype.ac=function(){return Je(this,this.a.qa)};h.prototype.readPackedEnum=h.prototype.ac;h.prototype.uc=function(){return Je(this,this.a.ha)};h.prototype.readPackedVarintHash64=h.prototype.uc;h.prototype.ec=function(){return Je(this,this.a.$)};h.prototype.readPackedFixedHash64=h.prototype.ec;function xs(n,r,o,s,i){this.la=n,this.Ba=r,this.ka=o,this.Na=s,this.ma=i}G("jspb.ExtensionFieldInfo",xs,void 0);function xp(n,r,o,s,i,a){this.Za=n,this.za=r,this.Aa=o,this.Wa=s,this.Ab=i,this.Nb=a}G("jspb.ExtensionFieldBinaryInfo",xp,void 0);xs.prototype.F=function(){return!!this.ka};xs.prototype.isMessageType=xs.prototype.F;function N(){}G("jspb.Message",N,void 0);N.GENERATE_TO_OBJECT=!0;N.GENERATE_FROM_OBJECT=!0;var ea=typeof Uint8Array=="function";N.prototype.Ib=function(){return this.b};N.prototype.getJsPbMessageId=N.prototype.Ib;N.initialize=function(n,r,o,s,i,a){n.c=null,r||(r=o?[o]:[]),n.b=o?String(o):void 0,n.D=o===0?-1:0,n.u=r;e:{if(o=n.u.length,r=-1,o&&(r=o-1,o=n.u[r],!(o===null||typeof o!="object"||Array.isArray(o)||ea&&o instanceof Uint8Array))){n.G=r-n.D,n.i=o;break e}-1<s?(n.G=Math.max(s,r+1-n.D),n.i=null):n.G=Number.MAX_VALUE}if(n.a={},i)for(s=0;s<i.length;s++)r=i[s],r<n.G?(r+=n.D,n.u[r]=n.u[r]||Ds):(ta(n),n.i[r]=n.i[r]||Ds);if(a&&a.length)for(s=0;s<a.length;s++)bu(n,a[s])};var Ds=Object.freeze?Object.freeze([]):[];function ta(n){var r=n.G+n.D;n.u[r]||(n.i=n.u[r]={})}function Dp(n,r,o){for(var s=[],i=0;i<n.length;i++)s[i]=r.call(n[i],o,n[i]);return s}N.toObjectList=Dp;N.toObjectExtension=function(n,r,o,s,i){for(var a in o){var c=o[a],u=s.call(n,c);if(u!=null){for(var l in c.Ba)if(c.Ba.hasOwnProperty(l))break;r[l]=c.Na?c.ma?Dp(u,c.Na,i):c.Na(i,u):u}}};N.serializeBinaryExtensions=function(n,r,o,s){for(var i in o){var a=o[i],c=a.Za;if(!a.Aa)throw Error("Message extension present that was generated without binary serialization support");var u=s.call(n,c);if(u!=null)if(c.F())if(a.Wa)a.Aa.call(r,c.la,u,a.Wa);else throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format");else a.Aa.call(r,c.la,u)}};N.readBinaryExtension=function(n,r,o,s,i){var a=o[r.f];if(a){if(o=a.Za,!a.za)throw Error("Deserializing extension whose generated code does not support binary format");if(o.F()){var c=new o.ka;a.za.call(r,c,a.Ab)}else c=a.za.call(r);o.ma&&!a.Nb?(r=s.call(n,o))?r.push(c):i.call(n,o,[c]):i.call(n,o,c)}else r.C()};function tr(n,r){if(r<n.G){r+=n.D;var o=n.u[r];return o===Ds?n.u[r]=[]:o}if(n.i)return o=n.i[r],o===Ds?n.i[r]=[]:o}N.getField=tr;N.getRepeatedField=function(n,r){return tr(n,r)};function Np(n,r){return n=tr(n,r),n==null?n:+n}N.getOptionalFloatingPointField=Np;function Up(n,r){return n=tr(n,r),n==null?n:!!n}N.getBooleanField=Up;N.getRepeatedFloatingPointField=function(n,r){var o=tr(n,r);if(n.a||(n.a={}),!n.a[r]){for(var s=0;s<o.length;s++)o[s]=+o[s];n.a[r]=!0}return o};N.getRepeatedBooleanField=function(n,r){var o=tr(n,r);if(n.a||(n.a={}),!n.a[r]){for(var s=0;s<o.length;s++)o[s]=!!o[s];n.a[r]=!0}return o};function _p(n){return n==null||typeof n=="string"?n:ea&&n instanceof Uint8Array?Cp(n):(rt("Cannot coerce to b64 string: "+An(n)),null)}N.bytesAsB64=_p;function jp(n){return n==null||n instanceof Uint8Array?n:typeof n=="string"?Bp(n):(rt("Cannot coerce to Uint8Array: "+An(n)),null)}N.bytesAsU8=jp;N.bytesListAsB64=function(n){return zp(n),n.length&&typeof n[0]!="string"?Ns(n,_p):n};N.bytesListAsU8=function(n){return zp(n),!n.length||n[0]instanceof Uint8Array?n:Ns(n,jp)};function zp(n){if(n&&1<n.length){var r=An(n[0]);th(n,function(o){An(o)!=r&&rt("Inconsistent type in JSPB repeated field array. Got "+An(o)+" expected "+r)})}}function Vp(n,r,o){return n=tr(n,r),n??o}N.getFieldWithDefault=Vp;N.getBooleanFieldWithDefault=function(n,r,o){return n=Up(n,r),n??o};N.getFloatingPointFieldWithDefault=function(n,r,o){return n=Np(n,r),n??o};N.getFieldProto3=Vp;N.getMapField=function(n,r,o,s){if(n.c||(n.c={}),r in n.c)return n.c[r];var i=tr(n,r);if(!i){if(o)return;i=[],fn(n,r,i)}return n.c[r]=new ee(i,s)};function fn(n,r,o){return Sr(n,N),r<n.G?n.u[r+n.D]=o:(ta(n),n.i[r]=o),n}N.setField=fn;N.setProto3IntField=function(n,r,o){return so(n,r,o,0)};N.setProto3FloatField=function(n,r,o){return so(n,r,o,0)};N.setProto3BooleanField=function(n,r,o){return so(n,r,o,!1)};N.setProto3StringField=function(n,r,o){return so(n,r,o,"")};N.setProto3BytesField=function(n,r,o){return so(n,r,o,"")};N.setProto3EnumField=function(n,r,o){return so(n,r,o,0)};N.setProto3StringIntField=function(n,r,o){return so(n,r,o,"0")};function so(n,r,o,s){return Sr(n,N),o!==s?fn(n,r,o):r<n.G?n.u[r+n.D]=null:(ta(n),delete n.i[r]),n}N.addToRepeatedField=function(n,r,o,s){return Sr(n,N),r=tr(n,r),s!=null?r.splice(s,0,o):r.push(o),n};function Gp(n,r,o,s){return Sr(n,N),(o=bu(n,o))&&o!==r&&s!==void 0&&(n.c&&o in n.c&&(n.c[o]=void 0),fn(n,o,void 0)),fn(n,r,s)}N.setOneofField=Gp;function bu(n,r){for(var o,s,i=0;i<r.length;i++){var a=r[i],c=tr(n,a);c!=null&&(o=a,s=c,fn(n,a,void 0))}return o?(fn(n,o,s),o):0}N.computeOneofCase=bu;N.getWrapperField=function(n,r,o,s){if(n.c||(n.c={}),!n.c[o]){var i=tr(n,o);(s||i)&&(n.c[o]=new r(i))}return n.c[o]};N.getRepeatedWrapperField=function(n,r,o){return Lp(n,r,o),r=n.c[o],r==Ds&&(r=n.c[o]=[]),r};function Lp(n,r,o){if(n.c||(n.c={}),!n.c[o]){for(var s=tr(n,o),i=[],a=0;a<s.length;a++)i[a]=new r(s[a]);n.c[o]=i}}N.setWrapperField=function(n,r,o){Sr(n,N),n.c||(n.c={});var s=o&&o.g();return n.c[r]=o,fn(n,r,s)};N.setOneofWrapperField=function(n,r,o,s){Sr(n,N),n.c||(n.c={});var i=s&&s.g();return n.c[r]=s,Gp(n,r,o,i)};N.setRepeatedWrapperField=function(n,r,o){Sr(n,N),n.c||(n.c={}),o=o||[];for(var s=[],i=0;i<o.length;i++)s[i]=o[i].g();return n.c[r]=o,fn(n,r,s)};N.addToRepeatedWrapperField=function(n,r,o,s,i){Lp(n,s,r);var a=n.c[r];return a||(a=n.c[r]=[]),o=o||new s,n=tr(n,r),i!=null?(a.splice(i,0,o),n.splice(i,0,o.g())):(a.push(o),n.push(o.g())),o};N.toMap=function(n,r,o,s){for(var i={},a=0;a<n.length;a++)i[r.call(n[a])]=o?o.call(n[a],s,n[a]):n[a];return i};function $p(n){if(n.c)for(var r in n.c){var o=n.c[r];if(Array.isArray(o))for(var s=0;s<o.length;s++)o[s]&&o[s].g();else o&&o.g()}}N.prototype.g=function(){return $p(this),this.u};N.prototype.toArray=N.prototype.g;N.prototype.toString=function(){return $p(this),this.u.toString()};N.prototype.getExtension=function(n){if(this.i){this.c||(this.c={});var r=n.la;if(n.ma){if(n.F())return this.c[r]||(this.c[r]=Ns(this.i[r]||[],function(o){return new n.ka(o)})),this.c[r]}else if(n.F())return!this.c[r]&&this.i[r]&&(this.c[r]=new n.ka(this.i[r])),this.c[r];return this.i[r]}};N.prototype.getExtension=N.prototype.getExtension;N.prototype.Jc=function(n,r){this.c||(this.c={}),ta(this);var o=n.la;return n.ma?(r=r||[],n.F()?(this.c[o]=r,this.i[o]=Ns(r,function(s){return s.g()})):this.i[o]=r):n.F()?(this.c[o]=r,this.i[o]=r&&r.g()):this.i[o]=r,this};N.prototype.setExtension=N.prototype.Jc;N.difference=function(n,r){if(!(n instanceof r.constructor))throw Error("Messages have different types.");var o=n.g();r=r.g();var s=[],i=0,a=o.length>r.length?o.length:r.length;for(n.b&&(s[0]=n.b,i=1);i<a;i++)Ls(o[i],r[i])||(s[i]=r[i]);return new n.constructor(s)};N.equals=function(n,r){return n==r||!(!n||!r)&&n instanceof r.constructor&&Ls(n.g(),r.g())};function Au(n,r){n=n||{},r=r||{};var o={},s;for(s in n)o[s]=0;for(s in r)o[s]=0;for(s in o)if(!Ls(n[s],r[s]))return!1;return!0}N.compareExtensions=Au;function Ls(n,r){if(n==r)return!0;if(!pp(n)||!pp(r))return typeof n=="number"&&isNaN(n)||typeof r=="number"&&isNaN(r)?String(n)==String(r):!1;if(n.constructor!=r.constructor)return!1;if(ea&&n.constructor===Uint8Array){if(n.length!=r.length)return!1;for(var o=0;o<n.length;o++)if(n[o]!=r[o])return!1;return!0}if(n.constructor===Array){var s=void 0,i=void 0,a=Math.max(n.length,r.length);for(o=0;o<a;o++){var c=n[o],u=r[o];if(c&&c.constructor==Object&&(v(s===void 0),v(o===n.length-1),s=c,c=void 0),u&&u.constructor==Object&&(v(i===void 0),v(o===r.length-1),i=u,u=void 0),!Ls(c,u))return!1}return s||i?(s=s||{},i=i||{},Au(s,i)):!0}if(n.constructor===Object)return Au(n,r);throw Error("Invalid type in JSPB array")}N.compareFields=Ls;N.prototype.Bb=function(){return ra(this)};N.prototype.cloneMessage=N.prototype.Bb;N.prototype.clone=function(){return ra(this)};N.prototype.clone=N.prototype.clone;N.clone=function(n){return ra(n)};function ra(n){return new n.constructor(fu(n.g()))}N.copyInto=function(n,r){Sr(n,N),Sr(r,N),v(n.constructor==r.constructor,"Copy source and target message should have the same type."),n=ra(n);for(var o=r.g(),s=n.g(),i=o.length=0;i<s.length;i++)o[i]=s[i];r.c=n.c,r.i=n.i};function fu(n){if(Array.isArray(n)){for(var r=Array(n.length),o=0;o<n.length;o++){var s=n[o];s!=null&&(r[o]=typeof s=="object"?fu(v(s)):s)}return r}if(ea&&n instanceof Uint8Array)return new Uint8Array(n);r={};for(o in n)s=n[o],s!=null&&(r[o]=typeof s=="object"?fu(v(s)):s);return r}N.registerMessageType=function(n,r){r.ve=n};var Wr={dump:function(n){return Sr(n,N,"jspb.Message instance expected"),v(n.getExtension,"Only unobfuscated and unoptimized compilation modes supported."),Wr.X(n)}};G("jspb.debug.dump",Wr.dump,void 0);Wr.X=function(n){var r=An(n);if(r=="number"||r=="string"||r=="boolean"||r=="null"||r=="undefined"||typeof Uint8Array<"u"&&n instanceof Uint8Array)return n;if(r=="array")return oh(n),Ns(n,Wr.X);if(n instanceof ee){var o={};n=n.entries();for(var s=n.next();!s.done;s=n.next())o[s.value[0]]=Wr.X(s.value[1]);return o}Sr(n,N,"Only messages expected: "+n),r=n.constructor;var i={$name:r.name||r.displayName};for(u in r.prototype){var a=/^get([A-Z]\w*)/.exec(u);if(a&&u!="getExtension"&&u!="getJsPbMessageId"){var c="has"+a[1];(!n[c]||n[c]())&&(c=n[u](),i[Wr.$a(a[1])]=Wr.X(c))}}if(n.extensionObject_)return i.$extensions="Recursive dumping of extensions not supported in compiled code. Switch to uncompiled or dump extension object directly",i;for(s in r.extensions)if(/^\d+$/.test(s)){c=r.extensions[s];var u=n.getExtension(c);a=void 0,c=c.Ba;var l=[],p=0;for(a in c)l[p++]=a;a=l[0],u!=null&&(o||(o=i.$extensions={}),o[Wr.$a(a)]=Wr.X(u))}return i};Wr.$a=function(n){return n.replace(/^[A-Z]/,function(r){return r.toLowerCase()})};function O(){this.a=[]}G("jspb.BinaryEncoder",O,void 0);O.prototype.length=function(){return this.a.length};O.prototype.length=O.prototype.length;O.prototype.end=function(){var n=this.a;return this.a=[],n};O.prototype.end=O.prototype.end;O.prototype.l=function(n,r){for(v(n==Math.floor(n)),v(r==Math.floor(r)),v(0<=n&&4294967296>n),v(0<=r&&4294967296>r);0<r||127<n;)this.a.push(n&127|128),n=(n>>>7|r<<25)>>>0,r>>>=7;this.a.push(n)};O.prototype.writeSplitVarint64=O.prototype.l;O.prototype.A=function(n,r){v(n==Math.floor(n)),v(r==Math.floor(r)),v(0<=n&&4294967296>n),v(0<=r&&4294967296>r),this.o(n),this.o(r)};O.prototype.writeSplitFixed64=O.prototype.A;O.prototype.j=function(n){for(v(n==Math.floor(n)),v(0<=n&&4294967296>n);127<n;)this.a.push(n&127|128),n>>>=7;this.a.push(n)};O.prototype.writeUnsignedVarint32=O.prototype.j;O.prototype.M=function(n){if(v(n==Math.floor(n)),v(-2147483648<=n&&2147483648>n),0<=n)this.j(n);else{for(var r=0;9>r;r++)this.a.push(n&127|128),n>>=7;this.a.push(1)}};O.prototype.writeSignedVarint32=O.prototype.M;O.prototype.va=function(n){v(n==Math.floor(n)),v(0<=n&&18446744073709552e3>n),_s(n),this.l(Re,ke)};O.prototype.writeUnsignedVarint64=O.prototype.va;O.prototype.ua=function(n){v(n==Math.floor(n)),v(-9223372036854776e3<=n&&9223372036854776e3>n),_s(n),this.l(Re,ke)};O.prototype.writeSignedVarint64=O.prototype.ua;O.prototype.wa=function(n){v(n==Math.floor(n)),v(-2147483648<=n&&2147483648>n),this.j((n<<1^n>>31)>>>0)};O.prototype.writeZigzagVarint32=O.prototype.wa;O.prototype.xa=function(n){v(n==Math.floor(n)),v(-9223372036854776e3<=n&&9223372036854776e3>n),Sp(n),this.l(Re,ke)};O.prototype.writeZigzagVarint64=O.prototype.xa;O.prototype.Ta=function(n){this.W(Gs(n))};O.prototype.writeZigzagVarint64String=O.prototype.Ta;O.prototype.W=function(n){var r=this;Fn(n),Ki(Re,ke,function(o,s){r.l(o>>>0,s>>>0)})};O.prototype.writeZigzagVarintHash64=O.prototype.W;O.prototype.ae=function(n){v(n==Math.floor(n)),v(0<=n&&256>n),this.a.push(n>>>0&255)};O.prototype.writeUint8=O.prototype.ae;O.prototype.$d=function(n){v(n==Math.floor(n)),v(0<=n&&65536>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255)};O.prototype.writeUint16=O.prototype.$d;O.prototype.o=function(n){v(n==Math.floor(n)),v(0<=n&&4294967296>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255),this.a.push(n>>>16&255),this.a.push(n>>>24&255)};O.prototype.writeUint32=O.prototype.o;O.prototype.V=function(n){v(n==Math.floor(n)),v(0<=n&&18446744073709552e3>n),yu(n),this.o(Re),this.o(ke)};O.prototype.writeUint64=O.prototype.V;O.prototype.Pc=function(n){v(n==Math.floor(n)),v(-128<=n&&128>n),this.a.push(n>>>0&255)};O.prototype.writeInt8=O.prototype.Pc;O.prototype.Oc=function(n){v(n==Math.floor(n)),v(-32768<=n&&32768>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255)};O.prototype.writeInt16=O.prototype.Oc;O.prototype.S=function(n){v(n==Math.floor(n)),v(-2147483648<=n&&2147483648>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255),this.a.push(n>>>16&255),this.a.push(n>>>24&255)};O.prototype.writeInt32=O.prototype.S;O.prototype.T=function(n){v(n==Math.floor(n)),v(-9223372036854776e3<=n&&9223372036854776e3>n),_s(n),this.A(Re,ke)};O.prototype.writeInt64=O.prototype.T;O.prototype.ja=function(n){v(n==Math.floor(n)),v(-9223372036854776e3<=+n&&9223372036854776e3>+n),Fn(Gs(n)),this.A(Re,ke)};O.prototype.writeInt64String=O.prototype.ja;O.prototype.L=function(n){v(n===1/0||n===-1/0||isNaN(n)||-34028234663852886e22<=n&&34028234663852886e22>=n),vp(n),this.o(Re)};O.prototype.writeFloat=O.prototype.L;O.prototype.J=function(n){v(n===1/0||n===-1/0||isNaN(n)||-17976931348623157e292<=n&&17976931348623157e292>=n),Ip(n),this.o(Re),this.o(ke)};O.prototype.writeDouble=O.prototype.J;O.prototype.I=function(n){v(typeof n=="boolean"||typeof n=="number"),this.a.push(n?1:0)};O.prototype.writeBool=O.prototype.I;O.prototype.R=function(n){v(n==Math.floor(n)),v(-2147483648<=n&&2147483648>n),this.M(n)};O.prototype.writeEnum=O.prototype.R;O.prototype.ia=function(n){this.a.push.apply(this.a,n)};O.prototype.writeBytes=O.prototype.ia;O.prototype.N=function(n){Fn(n),this.l(Re,ke)};O.prototype.writeVarintHash64=O.prototype.N;O.prototype.K=function(n){Fn(n),this.o(Re),this.o(ke)};O.prototype.writeFixedHash64=O.prototype.K;O.prototype.U=function(n){var r=this.a.length;nh(n);for(var o=0;o<n.length;o++){var s=n.charCodeAt(o);if(128>s)this.a.push(s);else if(2048>s)this.a.push(s>>6|192),this.a.push(s&63|128);else if(65536>s)if(55296<=s&&56319>=s&&o+1<n.length){var i=n.charCodeAt(o+1);56320<=i&&57343>=i&&(s=1024*(s-55296)+i-56320+65536,this.a.push(s>>18|240),this.a.push(s>>12&63|128),this.a.push(s>>6&63|128),this.a.push(s&63|128),o++)}else this.a.push(s>>12|224),this.a.push(s>>6&63|128),this.a.push(s&63|128)}return this.a.length-r};O.prototype.writeString=O.prototype.U;function q(n,r){this.lo=n,this.hi=r}G("jspb.arith.UInt64",q,void 0);q.prototype.cmp=function(n){return this.hi<n.hi||this.hi==n.hi&&this.lo<n.lo?-1:this.hi==n.hi&&this.lo==n.lo?0:1};q.prototype.cmp=q.prototype.cmp;q.prototype.La=function(){return new q((this.lo>>>1|(this.hi&1)<<31)>>>0,this.hi>>>1>>>0)};q.prototype.rightShift=q.prototype.La;q.prototype.Da=function(){return new q(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)};q.prototype.leftShift=q.prototype.Da;q.prototype.cb=function(){return!!(this.hi&2147483648)};q.prototype.msb=q.prototype.cb;q.prototype.Ob=function(){return!!(this.lo&1)};q.prototype.lsb=q.prototype.Ob;q.prototype.Ua=function(){return this.lo==0&&this.hi==0};q.prototype.zero=q.prototype.Ua;q.prototype.add=function(n){return new q((this.lo+n.lo&4294967295)>>>0>>>0,((this.hi+n.hi&4294967295)>>>0)+(4294967296<=this.lo+n.lo?1:0)>>>0)};q.prototype.add=q.prototype.add;q.prototype.sub=function(n){return new q((this.lo-n.lo&4294967295)>>>0>>>0,((this.hi-n.hi&4294967295)>>>0)-(0>this.lo-n.lo?1:0)>>>0)};q.prototype.sub=q.prototype.sub;function mu(n,r){var o=n&65535;n>>>=16;var s=r&65535,i=r>>>16;for(r=o*s+65536*(o*i&65535)+65536*(n*s&65535),o=n*i+(o*i>>>16)+(n*s>>>16);4294967296<=r;)r-=4294967296,o+=1;return new q(r>>>0,o>>>0)}q.mul32x32=mu;q.prototype.eb=function(n){var r=mu(this.lo,n);return n=mu(this.hi,n),n.hi=n.lo,n.lo=0,r.add(n)};q.prototype.mul=q.prototype.eb;q.prototype.Xa=function(n){if(n==0)return[];var r=new q(0,0),o=new q(this.lo,this.hi);n=new q(n,0);for(var s=new q(1,0);!n.cb();)n=n.Da(),s=s.Da();for(;!s.Ua();)0>=n.cmp(o)&&(r=r.add(s),o=o.sub(n)),n=n.La(),s=s.La();return[r,o]};q.prototype.div=q.prototype.Xa;q.prototype.toString=function(){for(var n="",r=this;!r.Ua();){r=r.Xa(10);var o=r[0];n=r[1].lo+n,r=o}return n==""&&(n="0"),n};q.prototype.toString=q.prototype.toString;function Vo(n){for(var r=new q(0,0),o=new q(0,0),s=0;s<n.length;s++){if("0">n[s]||"9"<n[s])return null;o.lo=parseInt(n[s],10),r=r.eb(10).add(o)}return r}q.fromString=Vo;q.prototype.clone=function(){return new q(this.lo,this.hi)};q.prototype.clone=q.prototype.clone;function ut(n,r){this.lo=n,this.hi=r}G("jspb.arith.Int64",ut,void 0);ut.prototype.add=function(n){return new ut((this.lo+n.lo&4294967295)>>>0>>>0,((this.hi+n.hi&4294967295)>>>0)+(4294967296<=this.lo+n.lo?1:0)>>>0)};ut.prototype.add=ut.prototype.add;ut.prototype.sub=function(n){return new ut((this.lo-n.lo&4294967295)>>>0>>>0,((this.hi-n.hi&4294967295)>>>0)-(0>this.lo-n.lo?1:0)>>>0)};ut.prototype.sub=ut.prototype.sub;ut.prototype.clone=function(){return new ut(this.lo,this.hi)};ut.prototype.clone=ut.prototype.clone;ut.prototype.toString=function(){var n=(this.hi&2147483648)!=0,r=new q(this.lo,this.hi);return n&&(r=new q(0,0).sub(r)),(n?"-":"")+r.toString()};ut.prototype.toString=ut.prototype.toString;function na(n){var r=0<n.length&&n[0]=="-";return r&&(n=n.substring(1)),n=Vo(n),n===null?null:(r&&(n=new q(0,0).sub(n)),new ut(n.lo,n.hi))}ut.fromString=na;function f(){this.f=[],this.b=0,this.a=new O,this.h=[]}G("jspb.BinaryWriter",f,void 0);function Zp(n,r){var o=n.a.end();n.f.push(o),n.f.push(r),n.b+=o.length+r.length}function He(n,r){return Q(n,r,2),r=n.a.end(),n.f.push(r),n.b+=r.length,r.push(n.b),r}function Ke(n,r){var o=r.pop();for(o=n.b+n.a.length()-o,v(0<=o);127<o;)r.push(o&127|128),o>>>=7,n.b++;r.push(o),n.b++}f.prototype.pb=function(n,r,o){Zp(this,n.subarray(r,o))};f.prototype.writeSerializedMessage=f.prototype.pb;f.prototype.Pb=function(n,r,o){n!=null&&r!=null&&o!=null&&this.pb(n,r,o)};f.prototype.maybeWriteSerializedMessage=f.prototype.Pb;f.prototype.reset=function(){this.f=[],this.a.end(),this.b=0,this.h=[]};f.prototype.reset=f.prototype.reset;f.prototype.ab=function(){v(this.h.length==0);for(var n=new Uint8Array(this.b+this.a.length()),r=this.f,o=r.length,s=0,i=0;i<o;i++){var a=r[i];n.set(a,s),s+=a.length}return r=this.a.end(),n.set(r,s),s+=r.length,v(s==n.length),this.f=[n],n};f.prototype.getResultBuffer=f.prototype.ab;f.prototype.Kb=function(n){return Cp(this.ab(),n)};f.prototype.getResultBase64String=f.prototype.Kb;f.prototype.Va=function(n){this.h.push(He(this,n))};f.prototype.beginSubMessage=f.prototype.Va;f.prototype.Ya=function(){v(0<=this.h.length),Ke(this,this.h.pop())};f.prototype.endSubMessage=f.prototype.Ya;function Q(n,r,o){v(1<=r&&r==Math.floor(r)),n.a.j(8*r+o)}f.prototype.Mc=function(n,r,o){switch(n){case 1:this.J(r,o);break;case 2:this.L(r,o);break;case 3:this.T(r,o);break;case 4:this.V(r,o);break;case 5:this.S(r,o);break;case 6:this.Qa(r,o);break;case 7:this.Pa(r,o);break;case 8:this.I(r,o);break;case 9:this.U(r,o);break;case 10:rt("Group field type not supported in writeAny()");break;case 11:rt("Message field type not supported in writeAny()");break;case 12:this.ia(r,o);break;case 13:this.o(r,o);break;case 14:this.R(r,o);break;case 15:this.Ra(r,o);break;case 16:this.Sa(r,o);break;case 17:this.rb(r,o);break;case 18:this.sb(r,o);break;case 30:this.K(r,o);break;case 31:this.N(r,o);break;default:rt("Invalid field type in writeAny()")}};f.prototype.writeAny=f.prototype.Mc;function Tu(n,r,o){o!=null&&(Q(n,r,0),n.a.j(o))}function Pu(n,r,o){o!=null&&(Q(n,r,0),n.a.M(o))}f.prototype.S=function(n,r){r!=null&&(v(-2147483648<=r&&2147483648>r),Pu(this,n,r))};f.prototype.writeInt32=f.prototype.S;f.prototype.ob=function(n,r){r!=null&&(r=parseInt(r,10),v(-2147483648<=r&&2147483648>r),Pu(this,n,r))};f.prototype.writeInt32String=f.prototype.ob;f.prototype.T=function(n,r){r!=null&&(v(-9223372036854776e3<=r&&9223372036854776e3>r),r!=null&&(Q(this,n,0),this.a.ua(r)))};f.prototype.writeInt64=f.prototype.T;f.prototype.ja=function(n,r){r!=null&&(r=na(r),Q(this,n,0),this.a.l(r.lo,r.hi))};f.prototype.writeInt64String=f.prototype.ja;f.prototype.o=function(n,r){r!=null&&(v(0<=r&&4294967296>r),Tu(this,n,r))};f.prototype.writeUint32=f.prototype.o;f.prototype.ub=function(n,r){r!=null&&(r=parseInt(r,10),v(0<=r&&4294967296>r),Tu(this,n,r))};f.prototype.writeUint32String=f.prototype.ub;f.prototype.V=function(n,r){r!=null&&(v(0<=r&&18446744073709552e3>r),r!=null&&(Q(this,n,0),this.a.va(r)))};f.prototype.writeUint64=f.prototype.V;f.prototype.vb=function(n,r){r!=null&&(r=Vo(r),Q(this,n,0),this.a.l(r.lo,r.hi))};f.prototype.writeUint64String=f.prototype.vb;f.prototype.rb=function(n,r){r!=null&&(v(-2147483648<=r&&2147483648>r),r!=null&&(Q(this,n,0),this.a.wa(r)))};f.prototype.writeSint32=f.prototype.rb;f.prototype.sb=function(n,r){r!=null&&(v(-9223372036854776e3<=r&&9223372036854776e3>r),r!=null&&(Q(this,n,0),this.a.xa(r)))};f.prototype.writeSint64=f.prototype.sb;f.prototype.Zd=function(n,r){r!=null&&r!=null&&(Q(this,n,0),this.a.W(r))};f.prototype.writeSintHash64=f.prototype.Zd;f.prototype.Yd=function(n,r){r!=null&&r!=null&&(Q(this,n,0),this.a.Ta(r))};f.prototype.writeSint64String=f.prototype.Yd;f.prototype.Pa=function(n,r){r!=null&&(v(0<=r&&4294967296>r),Q(this,n,5),this.a.o(r))};f.prototype.writeFixed32=f.prototype.Pa;f.prototype.Qa=function(n,r){r!=null&&(v(0<=r&&18446744073709552e3>r),Q(this,n,1),this.a.V(r))};f.prototype.writeFixed64=f.prototype.Qa;f.prototype.nb=function(n,r){r!=null&&(r=Vo(r),Q(this,n,1),this.a.A(r.lo,r.hi))};f.prototype.writeFixed64String=f.prototype.nb;f.prototype.Ra=function(n,r){r!=null&&(v(-2147483648<=r&&2147483648>r),Q(this,n,5),this.a.S(r))};f.prototype.writeSfixed32=f.prototype.Ra;f.prototype.Sa=function(n,r){r!=null&&(v(-9223372036854776e3<=r&&9223372036854776e3>r),Q(this,n,1),this.a.T(r))};f.prototype.writeSfixed64=f.prototype.Sa;f.prototype.qb=function(n,r){r!=null&&(r=na(r),Q(this,n,1),this.a.A(r.lo,r.hi))};f.prototype.writeSfixed64String=f.prototype.qb;f.prototype.L=function(n,r){r!=null&&(Q(this,n,5),this.a.L(r))};f.prototype.writeFloat=f.prototype.L;f.prototype.J=function(n,r){r!=null&&(Q(this,n,1),this.a.J(r))};f.prototype.writeDouble=f.prototype.J;f.prototype.I=function(n,r){r!=null&&(v(typeof r=="boolean"||typeof r=="number"),Q(this,n,0),this.a.I(r))};f.prototype.writeBool=f.prototype.I;f.prototype.R=function(n,r){r!=null&&(v(-2147483648<=r&&2147483648>r),Q(this,n,0),this.a.M(r))};f.prototype.writeEnum=f.prototype.R;f.prototype.U=function(n,r){r!=null&&(n=He(this,n),this.a.U(r),Ke(this,n))};f.prototype.writeString=f.prototype.U;f.prototype.ia=function(n,r){r!=null&&(r=qi(r),Q(this,n,2),this.a.j(r.length),Zp(this,r))};f.prototype.writeBytes=f.prototype.ia;f.prototype.Qc=function(n,r,o){r!=null&&(n=He(this,n),o(r,this),Ke(this,n))};f.prototype.writeMessage=f.prototype.Qc;f.prototype.Rc=function(n,r,o){r!=null&&(Q(this,1,3),Q(this,2,0),this.a.M(n),n=He(this,3),o(r,this),Ke(this,n),Q(this,1,4))};f.prototype.writeMessageSet=f.prototype.Rc;f.prototype.Nc=function(n,r,o){r!=null&&(Q(this,n,3),o(r,this),Q(this,n,4))};f.prototype.writeGroup=f.prototype.Nc;f.prototype.K=function(n,r){r!=null&&(v(r.length==8),Q(this,n,1),this.a.K(r))};f.prototype.writeFixedHash64=f.prototype.K;f.prototype.N=function(n,r){r!=null&&(v(r.length==8),Q(this,n,0),this.a.N(r))};f.prototype.writeVarintHash64=f.prototype.N;f.prototype.A=function(n,r,o){Q(this,n,1),this.a.A(r,o)};f.prototype.writeSplitFixed64=f.prototype.A;f.prototype.l=function(n,r,o){Q(this,n,0),this.a.l(r,o)};f.prototype.writeSplitVarint64=f.prototype.l;f.prototype.tb=function(n,r,o){Q(this,n,0);var s=this.a;Ki(r,o,function(i,a){s.l(i>>>0,a>>>0)})};f.prototype.writeSplitZigzagVarint64=f.prototype.tb;f.prototype.Dd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)Pu(this,n,r[o])};f.prototype.writeRepeatedInt32=f.prototype.Dd;f.prototype.Ed=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ob(n,r[o])};f.prototype.writeRepeatedInt32String=f.prototype.Ed;f.prototype.Fd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.ua(s))}};f.prototype.writeRepeatedInt64=f.prototype.Fd;f.prototype.Pd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.A(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitFixed64=f.prototype.Pd;f.prototype.Qd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.l(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitVarint64=f.prototype.Qd;f.prototype.Rd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.tb(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitZigzagVarint64=f.prototype.Rd;f.prototype.Gd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ja(n,r[o])};f.prototype.writeRepeatedInt64String=f.prototype.Gd;f.prototype.Td=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)Tu(this,n,r[o])};f.prototype.writeRepeatedUint32=f.prototype.Td;f.prototype.Ud=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ub(n,r[o])};f.prototype.writeRepeatedUint32String=f.prototype.Ud;f.prototype.Vd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.va(s))}};f.prototype.writeRepeatedUint64=f.prototype.Vd;f.prototype.Wd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.vb(n,r[o])};f.prototype.writeRepeatedUint64String=f.prototype.Wd;f.prototype.Ld=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.wa(s))}};f.prototype.writeRepeatedSint32=f.prototype.Ld;f.prototype.Md=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.xa(s))}};f.prototype.writeRepeatedSint64=f.prototype.Md;f.prototype.Nd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.Ta(s))}};f.prototype.writeRepeatedSint64String=f.prototype.Nd;f.prototype.Od=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.W(s))}};f.prototype.writeRepeatedSintHash64=f.prototype.Od;f.prototype.xd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Pa(n,r[o])};f.prototype.writeRepeatedFixed32=f.prototype.xd;f.prototype.yd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Qa(n,r[o])};f.prototype.writeRepeatedFixed64=f.prototype.yd;f.prototype.zd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.nb(n,r[o])};f.prototype.writeRepeatedFixed64String=f.prototype.zd;f.prototype.Id=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Ra(n,r[o])};f.prototype.writeRepeatedSfixed32=f.prototype.Id;f.prototype.Jd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Sa(n,r[o])};f.prototype.writeRepeatedSfixed64=f.prototype.Jd;f.prototype.Kd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.qb(n,r[o])};f.prototype.writeRepeatedSfixed64String=f.prototype.Kd;f.prototype.Bd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.L(n,r[o])};f.prototype.writeRepeatedFloat=f.prototype.Bd;f.prototype.vd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.J(n,r[o])};f.prototype.writeRepeatedDouble=f.prototype.vd;f.prototype.td=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.I(n,r[o])};f.prototype.writeRepeatedBool=f.prototype.td;f.prototype.wd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.R(n,r[o])};f.prototype.writeRepeatedEnum=f.prototype.wd;f.prototype.Sd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.U(n,r[o])};f.prototype.writeRepeatedString=f.prototype.Sd;f.prototype.ud=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ia(n,r[o])};f.prototype.writeRepeatedBytes=f.prototype.ud;f.prototype.Hd=function(n,r,o){if(r!=null)for(var s=0;s<r.length;s++){var i=He(this,n);o(r[s],this),Ke(this,i)}};f.prototype.writeRepeatedMessage=f.prototype.Hd;f.prototype.Cd=function(n,r,o){if(r!=null)for(var s=0;s<r.length;s++)Q(this,n,3),o(r[s],this),Q(this,n,4)};f.prototype.writeRepeatedGroup=f.prototype.Cd;f.prototype.Ad=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.K(n,r[o])};f.prototype.writeRepeatedFixedHash64=f.prototype.Ad;f.prototype.Xd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.N(n,r[o])};f.prototype.writeRepeatedVarintHash64=f.prototype.Xd;f.prototype.$c=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.M(r[o]);Ke(this,n)}};f.prototype.writePackedInt32=f.prototype.$c;f.prototype.ad=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.M(parseInt(r[o],10));Ke(this,n)}};f.prototype.writePackedInt32String=f.prototype.ad;f.prototype.bd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.ua(r[o]);Ke(this,n)}};f.prototype.writePackedInt64=f.prototype.bd;f.prototype.ld=function(n,r,o,s){if(r!=null){n=He(this,n);for(var i=0;i<r.length;i++)this.a.A(o(r[i]),s(r[i]));Ke(this,n)}};f.prototype.writePackedSplitFixed64=f.prototype.ld;f.prototype.md=function(n,r,o,s){if(r!=null){n=He(this,n);for(var i=0;i<r.length;i++)this.a.l(o(r[i]),s(r[i]));Ke(this,n)}};f.prototype.writePackedSplitVarint64=f.prototype.md;f.prototype.nd=function(n,r,o,s){if(r!=null){n=He(this,n);for(var i=this.a,a=0;a<r.length;a++)Ki(o(r[a]),s(r[a]),function(c,u){i.l(c>>>0,u>>>0)});Ke(this,n)}};f.prototype.writePackedSplitZigzagVarint64=f.prototype.nd;f.prototype.cd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++){var s=na(r[o]);this.a.l(s.lo,s.hi)}Ke(this,n)}};f.prototype.writePackedInt64String=f.prototype.cd;f.prototype.od=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.j(r[o]);Ke(this,n)}};f.prototype.writePackedUint32=f.prototype.od;f.prototype.pd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.j(parseInt(r[o],10));Ke(this,n)}};f.prototype.writePackedUint32String=f.prototype.pd;f.prototype.qd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.va(r[o]);Ke(this,n)}};f.prototype.writePackedUint64=f.prototype.qd;f.prototype.rd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++){var s=Vo(r[o]);this.a.l(s.lo,s.hi)}Ke(this,n)}};f.prototype.writePackedUint64String=f.prototype.rd;f.prototype.gd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.wa(r[o]);Ke(this,n)}};f.prototype.writePackedSint32=f.prototype.gd;f.prototype.hd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.xa(r[o]);Ke(this,n)}};f.prototype.writePackedSint64=f.prototype.hd;f.prototype.jd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.W(Gs(r[o]));Ke(this,n)}};f.prototype.writePackedSint64String=f.prototype.jd;f.prototype.kd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.W(r[o]);Ke(this,n)}};f.prototype.writePackedSintHash64=f.prototype.kd;f.prototype.Vc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.o(r[n])};f.prototype.writePackedFixed32=f.prototype.Vc;f.prototype.Wc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.V(r[n])};f.prototype.writePackedFixed64=f.prototype.Wc;f.prototype.Xc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++){var o=Vo(r[n]);this.a.A(o.lo,o.hi)}};f.prototype.writePackedFixed64String=f.prototype.Xc;f.prototype.dd=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.S(r[n])};f.prototype.writePackedSfixed32=f.prototype.dd;f.prototype.ed=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.T(r[n])};f.prototype.writePackedSfixed64=f.prototype.ed;f.prototype.fd=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.ja(r[n])};f.prototype.writePackedSfixed64String=f.prototype.fd;f.prototype.Zc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.L(r[n])};f.prototype.writePackedFloat=f.prototype.Zc;f.prototype.Tc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.J(r[n])};f.prototype.writePackedDouble=f.prototype.Tc;f.prototype.Sc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(r.length),n=0;n<r.length;n++)this.a.I(r[n])};f.prototype.writePackedBool=f.prototype.Sc;f.prototype.Uc=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.R(r[o]);Ke(this,n)}};f.prototype.writePackedEnum=f.prototype.Uc;f.prototype.Yc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.K(r[n])};f.prototype.writePackedFixedHash64=f.prototype.Yc;f.prototype.sd=function(n,r){if(r!=null&&r.length){n=He(this,n);for(var o=0;o<r.length;o++)this.a.N(r[o]);Ke(this,n)}};f.prototype.writePackedVarintHash64=f.prototype.sd;typeof Tt=="object"&&(Tt.debug=Wr,Tt.Map=ee,Tt.Message=N,Tt.BinaryReader=h,Tt.BinaryWriter=f,Tt.ExtensionFieldInfo=xs,Tt.ExtensionFieldBinaryInfo=xp,Tt.exportSymbol=qg,Tt.inherits=Qg,Tt.object={extend:eh},Tt.typeOf=An)});var Hp=Et(Jp=>{var rr=gr(),oa=rr,wu=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof wu<"u"&&wu||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();oa.exportSymbol("proto.google.protobuf.Any",null,wu);proto.google.protobuf.Any=function(n){rr.Message.initialize(this,n,0,-1,null,null)};oa.inherits(proto.google.protobuf.Any,rr.Message);oa.DEBUG&&!COMPILED&&(proto.google.protobuf.Any.displayName="proto.google.protobuf.Any");rr.Message.GENERATE_TO_OBJECT&&(proto.google.protobuf.Any.prototype.toObject=function(n){return proto.google.protobuf.Any.toObject(n,this)},proto.google.protobuf.Any.toObject=function(n,r){var o,s={typeUrl:rr.Message.getFieldWithDefault(r,1,""),value:r.getValue_asB64()};return n&&(s.$jspbMessageInstance=r),s});proto.google.protobuf.Any.deserializeBinary=function(n){var r=new rr.BinaryReader(n),o=new proto.google.protobuf.Any;return proto.google.protobuf.Any.deserializeBinaryFromReader(o,r)};proto.google.protobuf.Any.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readString();n.setTypeUrl(s);break;case 2:var s=r.readBytes();n.setValue(s);break;default:r.skipField();break}}return n};proto.google.protobuf.Any.prototype.serializeBinary=function(){var n=new rr.BinaryWriter;return proto.google.protobuf.Any.serializeBinaryToWriter(this,n),n.getResultBuffer()};proto.google.protobuf.Any.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getTypeUrl(),o.length>0&&r.writeString(1,o),o=n.getValue_asU8(),o.length>0&&r.writeBytes(2,o)};proto.google.protobuf.Any.prototype.getTypeUrl=function(){return rr.Message.getFieldWithDefault(this,1,"")};proto.google.protobuf.Any.prototype.setTypeUrl=function(n){return rr.Message.setProto3StringField(this,1,n)};proto.google.protobuf.Any.prototype.getValue=function(){return rr.Message.getFieldWithDefault(this,2,"")};proto.google.protobuf.Any.prototype.getValue_asB64=function(){return rr.Message.bytesAsB64(this.getValue())};proto.google.protobuf.Any.prototype.getValue_asU8=function(){return rr.Message.bytesAsU8(this.getValue())};proto.google.protobuf.Any.prototype.setValue=function(n){return rr.Message.setProto3BytesField(this,2,n)};oa.object.extend(Jp,proto.google.protobuf);proto.google.protobuf.Any.prototype.getTypeName=function(){return this.getTypeUrl().split("/").pop()};proto.google.protobuf.Any.prototype.pack=function(n,r,o){o||(o="type.googleapis.com/"),o.substr(-1)!="/"?this.setTypeUrl(o+"/"+r):this.setTypeUrl(o+r),this.setValue(n)};proto.google.protobuf.Any.prototype.unpack=function(n,r){return this.getTypeName()==r?n(this.getValue_asU8()):null}});var sa=Et(Kp=>{var d=gr(),J=d,Ne=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Ne<"u"&&Ne||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),Go=Hp();J.object.extend(proto,Go);J.exportSymbol("TronWebProto.Account",null,Ne);J.exportSymbol("TronWebProto.Account.AccountResource",null,Ne);J.exportSymbol("TronWebProto.Account.Frozen",null,Ne);J.exportSymbol("TronWebProto.AccountId",null,Ne);J.exportSymbol("TronWebProto.AccountType",null,Ne);J.exportSymbol("TronWebProto.DelegatedResource",null,Ne);J.exportSymbol("TronWebProto.Exchange",null,Ne);J.exportSymbol("TronWebProto.Key",null,Ne);J.exportSymbol("TronWebProto.MarketOrderDetail",null,Ne);J.exportSymbol("TronWebProto.Permission",null,Ne);J.exportSymbol("TronWebProto.Permission.PermissionType",null,Ne);J.exportSymbol("TronWebProto.Proposal",null,Ne);J.exportSymbol("TronWebProto.Proposal.State",null,Ne);J.exportSymbol("TronWebProto.Transaction",null,Ne);J.exportSymbol("TronWebProto.Transaction.Contract",null,Ne);J.exportSymbol("TronWebProto.Transaction.Contract.ContractType",null,Ne);J.exportSymbol("TronWebProto.Transaction.Result",null,Ne);J.exportSymbol("TronWebProto.Transaction.Result.code",null,Ne);J.exportSymbol("TronWebProto.Transaction.Result.contractResult",null,Ne);J.exportSymbol("TronWebProto.Transaction.raw",null,Ne);J.exportSymbol("TronWebProto.Vote",null,Ne);J.exportSymbol("TronWebProto.Votes",null,Ne);J.exportSymbol("TronWebProto.Witness",null,Ne);J.exportSymbol("TronWebProto.authority",null,Ne);TronWebProto.AccountId=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.AccountId,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.AccountId.displayName="TronWebProto.AccountId");TronWebProto.Vote=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Vote,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Vote.displayName="TronWebProto.Vote");TronWebProto.Proposal=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Proposal.repeatedFields_,null)};J.inherits(TronWebProto.Proposal,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Proposal.displayName="TronWebProto.Proposal");TronWebProto.Exchange=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Exchange,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Exchange.displayName="TronWebProto.Exchange");TronWebProto.Account=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Account.repeatedFields_,null)};J.inherits(TronWebProto.Account,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.displayName="TronWebProto.Account");TronWebProto.Account.Frozen=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Account.Frozen,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.Frozen.displayName="TronWebProto.Account.Frozen");TronWebProto.Account.AccountResource=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Account.AccountResource,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.AccountResource.displayName="TronWebProto.Account.AccountResource");TronWebProto.Key=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Key,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Key.displayName="TronWebProto.Key");TronWebProto.DelegatedResource=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.DelegatedResource,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.DelegatedResource.displayName="TronWebProto.DelegatedResource");TronWebProto.authority=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.authority,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.authority.displayName="TronWebProto.authority");TronWebProto.Permission=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Permission.repeatedFields_,null)};J.inherits(TronWebProto.Permission,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Permission.displayName="TronWebProto.Permission");TronWebProto.Witness=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Witness,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Witness.displayName="TronWebProto.Witness");TronWebProto.Votes=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Votes.repeatedFields_,null)};J.inherits(TronWebProto.Votes,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Votes.displayName="TronWebProto.Votes");TronWebProto.MarketOrderDetail=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.MarketOrderDetail,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.MarketOrderDetail.displayName="TronWebProto.MarketOrderDetail");TronWebProto.Transaction=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.repeatedFields_,null)};J.inherits(TronWebProto.Transaction,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.displayName="TronWebProto.Transaction");TronWebProto.Transaction.Contract=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Transaction.Contract,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.Contract.displayName="TronWebProto.Transaction.Contract");TronWebProto.Transaction.Result=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.Result.repeatedFields_,null)};J.inherits(TronWebProto.Transaction.Result,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.Result.displayName="TronWebProto.Transaction.Result");TronWebProto.Transaction.raw=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.raw.repeatedFields_,null)};J.inherits(TronWebProto.Transaction.raw,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.raw.displayName="TronWebProto.Transaction.raw");d.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountId.prototype.toObject=function(n){return TronWebProto.AccountId.toObject(n,this)},TronWebProto.AccountId.toObject=function(n,r){var o,s={name:r.getName_asB64(),address:r.getAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountId.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.AccountId;return TronWebProto.AccountId.deserializeBinaryFromReader(o,r)};TronWebProto.AccountId.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setName(s);break;case 2:var s=r.readBytes();n.setAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountId.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.AccountId.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountId.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.AccountId.prototype.getName=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountId.prototype.getName_asB64=function(){return d.Message.bytesAsB64(this.getName())};TronWebProto.AccountId.prototype.getName_asU8=function(){return d.Message.bytesAsU8(this.getName())};TronWebProto.AccountId.prototype.setName=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountId.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountId.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.AccountId.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.AccountId.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Vote.prototype.toObject=function(n){return TronWebProto.Vote.toObject(n,this)},TronWebProto.Vote.toObject=function(n,r){var o,s={voteAddress:r.getVoteAddress_asB64(),voteCount:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Vote.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Vote;return TronWebProto.Vote.deserializeBinaryFromReader(o,r)};TronWebProto.Vote.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setVoteAddress(s);break;case 2:var s=r.readInt64();n.setVoteCount(s);break;default:r.skipField();break}}return n};TronWebProto.Vote.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Vote.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Vote.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getVoteAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVoteCount(),o!==0&&r.writeInt64(2,o)};TronWebProto.Vote.prototype.getVoteAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Vote.prototype.getVoteAddress_asB64=function(){return d.Message.bytesAsB64(this.getVoteAddress())};TronWebProto.Vote.prototype.getVoteAddress_asU8=function(){return d.Message.bytesAsU8(this.getVoteAddress())};TronWebProto.Vote.prototype.setVoteAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Vote.prototype.getVoteCount=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Vote.prototype.setVoteCount=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Proposal.repeatedFields_=[6];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Proposal.prototype.toObject=function(n){return TronWebProto.Proposal.toObject(n,this)},TronWebProto.Proposal.toObject=function(n,r){var o,s={proposalId:d.Message.getFieldWithDefault(r,1,0),proposerAddress:r.getProposerAddress_asB64(),parametersMap:(o=r.getParametersMap())?o.toObject(n,void 0):[],expirationTime:d.Message.getFieldWithDefault(r,4,0),createTime:d.Message.getFieldWithDefault(r,5,0),approvalsList:r.getApprovalsList_asB64(),state:d.Message.getFieldWithDefault(r,7,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Proposal.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Proposal;return TronWebProto.Proposal.deserializeBinaryFromReader(o,r)};TronWebProto.Proposal.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setProposalId(s);break;case 2:var s=r.readBytes();n.setProposerAddress(s);break;case 3:var s=n.getParametersMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readInt64,d.BinaryReader.prototype.readInt64,null,0,0)});break;case 4:var s=r.readInt64();n.setExpirationTime(s);break;case 5:var s=r.readInt64();n.setCreateTime(s);break;case 6:var s=r.readBytes();n.addApprovals(s);break;case 7:var s=r.readEnum();n.setState(s);break;default:r.skipField();break}}return n};TronWebProto.Proposal.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Proposal.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Proposal.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getProposalId(),o!==0&&r.writeInt64(1,o),o=n.getProposerAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getParametersMap(!0),o&&o.getLength()>0&&o.serializeBinary(3,r,d.BinaryWriter.prototype.writeInt64,d.BinaryWriter.prototype.writeInt64),o=n.getExpirationTime(),o!==0&&r.writeInt64(4,o),o=n.getCreateTime(),o!==0&&r.writeInt64(5,o),o=n.getApprovalsList_asU8(),o.length>0&&r.writeRepeatedBytes(6,o),o=n.getState(),o!==0&&r.writeEnum(7,o)};TronWebProto.Proposal.State={PENDING:0,DISAPPROVED:1,APPROVED:2,CANCELED:3};TronWebProto.Proposal.prototype.getProposalId=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Proposal.prototype.setProposalId=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Proposal.prototype.getProposerAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.Proposal.prototype.getProposerAddress_asB64=function(){return d.Message.bytesAsB64(this.getProposerAddress())};TronWebProto.Proposal.prototype.getProposerAddress_asU8=function(){return d.Message.bytesAsU8(this.getProposerAddress())};TronWebProto.Proposal.prototype.setProposerAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Proposal.prototype.getParametersMap=function(n){return d.Message.getMapField(this,3,n,null)};TronWebProto.Proposal.prototype.clearParametersMap=function(){return this.getParametersMap().clear(),this};TronWebProto.Proposal.prototype.getExpirationTime=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Proposal.prototype.setExpirationTime=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Proposal.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Proposal.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Proposal.prototype.getApprovalsList=function(){return d.Message.getRepeatedField(this,6)};TronWebProto.Proposal.prototype.getApprovalsList_asB64=function(){return d.Message.bytesListAsB64(this.getApprovalsList())};TronWebProto.Proposal.prototype.getApprovalsList_asU8=function(){return d.Message.bytesListAsU8(this.getApprovalsList())};TronWebProto.Proposal.prototype.setApprovalsList=function(n){return d.Message.setField(this,6,n||[])};TronWebProto.Proposal.prototype.addApprovals=function(n,r){return d.Message.addToRepeatedField(this,6,n,r)};TronWebProto.Proposal.prototype.clearApprovalsList=function(){return this.setApprovalsList([])};TronWebProto.Proposal.prototype.getState=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Proposal.prototype.setState=function(n){return d.Message.setProto3EnumField(this,7,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Exchange.prototype.toObject=function(n){return TronWebProto.Exchange.toObject(n,this)},TronWebProto.Exchange.toObject=function(n,r){var o,s={exchangeId:d.Message.getFieldWithDefault(r,1,0),creatorAddress:r.getCreatorAddress_asB64(),createTime:d.Message.getFieldWithDefault(r,3,0),firstTokenId:r.getFirstTokenId_asB64(),firstTokenBalance:d.Message.getFieldWithDefault(r,7,0),secondTokenId:r.getSecondTokenId_asB64(),secondTokenBalance:d.Message.getFieldWithDefault(r,9,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Exchange.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Exchange;return TronWebProto.Exchange.deserializeBinaryFromReader(o,r)};TronWebProto.Exchange.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setExchangeId(s);break;case 2:var s=r.readBytes();n.setCreatorAddress(s);break;case 3:var s=r.readInt64();n.setCreateTime(s);break;case 6:var s=r.readBytes();n.setFirstTokenId(s);break;case 7:var s=r.readInt64();n.setFirstTokenBalance(s);break;case 8:var s=r.readBytes();n.setSecondTokenId(s);break;case 9:var s=r.readInt64();n.setSecondTokenBalance(s);break;default:r.skipField();break}}return n};TronWebProto.Exchange.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Exchange.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Exchange.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getExchangeId(),o!==0&&r.writeInt64(1,o),o=n.getCreatorAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getCreateTime(),o!==0&&r.writeInt64(3,o),o=n.getFirstTokenId_asU8(),o.length>0&&r.writeBytes(6,o),o=n.getFirstTokenBalance(),o!==0&&r.writeInt64(7,o),o=n.getSecondTokenId_asU8(),o.length>0&&r.writeBytes(8,o),o=n.getSecondTokenBalance(),o!==0&&r.writeInt64(9,o)};TronWebProto.Exchange.prototype.getExchangeId=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Exchange.prototype.setExchangeId=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Exchange.prototype.getCreatorAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.Exchange.prototype.getCreatorAddress_asB64=function(){return d.Message.bytesAsB64(this.getCreatorAddress())};TronWebProto.Exchange.prototype.getCreatorAddress_asU8=function(){return d.Message.bytesAsU8(this.getCreatorAddress())};TronWebProto.Exchange.prototype.setCreatorAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Exchange.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Exchange.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Exchange.prototype.getFirstTokenId=function(){return d.Message.getFieldWithDefault(this,6,"")};TronWebProto.Exchange.prototype.getFirstTokenId_asB64=function(){return d.Message.bytesAsB64(this.getFirstTokenId())};TronWebProto.Exchange.prototype.getFirstTokenId_asU8=function(){return d.Message.bytesAsU8(this.getFirstTokenId())};TronWebProto.Exchange.prototype.setFirstTokenId=function(n){return d.Message.setProto3BytesField(this,6,n)};TronWebProto.Exchange.prototype.getFirstTokenBalance=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Exchange.prototype.setFirstTokenBalance=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Exchange.prototype.getSecondTokenId=function(){return d.Message.getFieldWithDefault(this,8,"")};TronWebProto.Exchange.prototype.getSecondTokenId_asB64=function(){return d.Message.bytesAsB64(this.getSecondTokenId())};TronWebProto.Exchange.prototype.getSecondTokenId_asU8=function(){return d.Message.bytesAsU8(this.getSecondTokenId())};TronWebProto.Exchange.prototype.setSecondTokenId=function(n){return d.Message.setProto3BytesField(this,8,n)};TronWebProto.Exchange.prototype.getSecondTokenBalance=function(){return d.Message.getFieldWithDefault(this,9,0)};TronWebProto.Exchange.prototype.setSecondTokenBalance=function(n){return d.Message.setProto3IntField(this,9,n)};TronWebProto.Account.repeatedFields_=[5,7,16,33];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.prototype.toObject=function(n){return TronWebProto.Account.toObject(n,this)},TronWebProto.Account.toObject=function(n,r){var o,s={accountName:r.getAccountName_asB64(),type:d.Message.getFieldWithDefault(r,2,0),address:r.getAddress_asB64(),balance:d.Message.getFieldWithDefault(r,4,0),votesList:d.Message.toObjectList(r.getVotesList(),TronWebProto.Vote.toObject,n),assetMap:(o=r.getAssetMap())?o.toObject(n,void 0):[],assetv2Map:(o=r.getAssetv2Map())?o.toObject(n,void 0):[],frozenList:d.Message.toObjectList(r.getFrozenList(),TronWebProto.Account.Frozen.toObject,n),netUsage:d.Message.getFieldWithDefault(r,8,0),acquiredDelegatedFrozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,41,0),delegatedFrozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,42,0),oldTronPower:d.Message.getFieldWithDefault(r,46,0),tronPower:(o=r.getTronPower())&&TronWebProto.Account.Frozen.toObject(n,o),assetOptimized:d.Message.getBooleanFieldWithDefault(r,60,!1),createTime:d.Message.getFieldWithDefault(r,9,0),latestOprationTime:d.Message.getFieldWithDefault(r,10,0),allowance:d.Message.getFieldWithDefault(r,11,0),latestWithdrawTime:d.Message.getFieldWithDefault(r,12,0),code:r.getCode_asB64(),isWitness:d.Message.getBooleanFieldWithDefault(r,14,!1),isCommittee:d.Message.getBooleanFieldWithDefault(r,15,!1),frozenSupplyList:d.Message.toObjectList(r.getFrozenSupplyList(),TronWebProto.Account.Frozen.toObject,n),assetIssuedName:r.getAssetIssuedName_asB64(),assetIssuedId:r.getAssetIssuedId_asB64(),latestAssetOperationTimeMap:(o=r.getLatestAssetOperationTimeMap())?o.toObject(n,void 0):[],latestAssetOperationTimev2Map:(o=r.getLatestAssetOperationTimev2Map())?o.toObject(n,void 0):[],freeNetUsage:d.Message.getFieldWithDefault(r,19,0),freeAssetNetUsageMap:(o=r.getFreeAssetNetUsageMap())?o.toObject(n,void 0):[],freeAssetNetUsagev2Map:(o=r.getFreeAssetNetUsagev2Map())?o.toObject(n,void 0):[],latestConsumeTime:d.Message.getFieldWithDefault(r,21,0),latestConsumeFreeTime:d.Message.getFieldWithDefault(r,22,0),accountId:r.getAccountId_asB64(),accountResource:(o=r.getAccountResource())&&TronWebProto.Account.AccountResource.toObject(n,o),codehash:r.getCodehash_asB64(),ownerPermission:(o=r.getOwnerPermission())&&TronWebProto.Permission.toObject(n,o),witnessPermission:(o=r.getWitnessPermission())&&TronWebProto.Permission.toObject(n,o),activePermissionList:d.Message.toObjectList(r.getActivePermissionList(),TronWebProto.Permission.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account;return TronWebProto.Account.deserializeBinaryFromReader(o,r)};TronWebProto.Account.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountName(s);break;case 2:var s=r.readEnum();n.setType(s);break;case 3:var s=r.readBytes();n.setAddress(s);break;case 4:var s=r.readInt64();n.setBalance(s);break;case 5:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addVotes(s);break;case 6:var s=n.getAssetMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 56:var s=n.getAssetv2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 7:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.addFrozen(s);break;case 8:var s=r.readInt64();n.setNetUsage(s);break;case 41:var s=r.readInt64();n.setAcquiredDelegatedFrozenBalanceForBandwidth(s);break;case 42:var s=r.readInt64();n.setDelegatedFrozenBalanceForBandwidth(s);break;case 46:var s=r.readInt64();n.setOldTronPower(s);break;case 47:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.setTronPower(s);break;case 60:var s=r.readBool();n.setAssetOptimized(s);break;case 9:var s=r.readInt64();n.setCreateTime(s);break;case 10:var s=r.readInt64();n.setLatestOprationTime(s);break;case 11:var s=r.readInt64();n.setAllowance(s);break;case 12:var s=r.readInt64();n.setLatestWithdrawTime(s);break;case 13:var s=r.readBytes();n.setCode(s);break;case 14:var s=r.readBool();n.setIsWitness(s);break;case 15:var s=r.readBool();n.setIsCommittee(s);break;case 16:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.addFrozenSupply(s);break;case 17:var s=r.readBytes();n.setAssetIssuedName(s);break;case 57:var s=r.readBytes();n.setAssetIssuedId(s);break;case 18:var s=n.getLatestAssetOperationTimeMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 58:var s=n.getLatestAssetOperationTimev2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 19:var s=r.readInt64();n.setFreeNetUsage(s);break;case 20:var s=n.getFreeAssetNetUsageMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 59:var s=n.getFreeAssetNetUsagev2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 21:var s=r.readInt64();n.setLatestConsumeTime(s);break;case 22:var s=r.readInt64();n.setLatestConsumeFreeTime(s);break;case 23:var s=r.readBytes();n.setAccountId(s);break;case 26:var s=new TronWebProto.Account.AccountResource;r.readMessage(s,TronWebProto.Account.AccountResource.deserializeBinaryFromReader),n.setAccountResource(s);break;case 30:var s=r.readBytes();n.setCodehash(s);break;case 31:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.setOwnerPermission(s);break;case 32:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.setWitnessPermission(s);break;case 33:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.addActivePermission(s);break;default:r.skipField();break}}return n};TronWebProto.Account.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getType(),o!==0&&r.writeEnum(2,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getBalance(),o!==0&&r.writeInt64(4,o),o=n.getVotesList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.Vote.serializeBinaryToWriter),o=n.getAssetMap(!0),o&&o.getLength()>0&&o.serializeBinary(6,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getAssetv2Map(!0),o&&o.getLength()>0&&o.serializeBinary(56,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFrozenList(),o.length>0&&r.writeRepeatedMessage(7,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getNetUsage(),o!==0&&r.writeInt64(8,o),o=n.getAcquiredDelegatedFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(41,o),o=n.getDelegatedFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(42,o),o=n.getOldTronPower(),o!==0&&r.writeInt64(46,o),o=n.getTronPower(),o!=null&&r.writeMessage(47,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getAssetOptimized(),o&&r.writeBool(60,o),o=n.getCreateTime(),o!==0&&r.writeInt64(9,o),o=n.getLatestOprationTime(),o!==0&&r.writeInt64(10,o),o=n.getAllowance(),o!==0&&r.writeInt64(11,o),o=n.getLatestWithdrawTime(),o!==0&&r.writeInt64(12,o),o=n.getCode_asU8(),o.length>0&&r.writeBytes(13,o),o=n.getIsWitness(),o&&r.writeBool(14,o),o=n.getIsCommittee(),o&&r.writeBool(15,o),o=n.getFrozenSupplyList(),o.length>0&&r.writeRepeatedMessage(16,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getAssetIssuedName_asU8(),o.length>0&&r.writeBytes(17,o),o=n.getAssetIssuedId_asU8(),o.length>0&&r.writeBytes(57,o),o=n.getLatestAssetOperationTimeMap(!0),o&&o.getLength()>0&&o.serializeBinary(18,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getLatestAssetOperationTimev2Map(!0),o&&o.getLength()>0&&o.serializeBinary(58,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFreeNetUsage(),o!==0&&r.writeInt64(19,o),o=n.getFreeAssetNetUsageMap(!0),o&&o.getLength()>0&&o.serializeBinary(20,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFreeAssetNetUsagev2Map(!0),o&&o.getLength()>0&&o.serializeBinary(59,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getLatestConsumeTime(),o!==0&&r.writeInt64(21,o),o=n.getLatestConsumeFreeTime(),o!==0&&r.writeInt64(22,o),o=n.getAccountId_asU8(),o.length>0&&r.writeBytes(23,o),o=n.getAccountResource(),o!=null&&r.writeMessage(26,o,TronWebProto.Account.AccountResource.serializeBinaryToWriter),o=n.getCodehash_asU8(),o.length>0&&r.writeBytes(30,o),o=n.getOwnerPermission(),o!=null&&r.writeMessage(31,o,TronWebProto.Permission.serializeBinaryToWriter),o=n.getWitnessPermission(),o!=null&&r.writeMessage(32,o,TronWebProto.Permission.serializeBinaryToWriter),o=n.getActivePermissionList(),o.length>0&&r.writeRepeatedMessage(33,o,TronWebProto.Permission.serializeBinaryToWriter)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.Frozen.prototype.toObject=function(n){return TronWebProto.Account.Frozen.toObject(n,this)},TronWebProto.Account.Frozen.toObject=function(n,r){var o,s={frozenBalance:d.Message.getFieldWithDefault(r,1,0),expireTime:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.Frozen.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account.Frozen;return TronWebProto.Account.Frozen.deserializeBinaryFromReader(o,r)};TronWebProto.Account.Frozen.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFrozenBalance(s);break;case 2:var s=r.readInt64();n.setExpireTime(s);break;default:r.skipField();break}}return n};TronWebProto.Account.Frozen.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.Frozen.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.Frozen.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrozenBalance(),o!==0&&r.writeInt64(1,o),o=n.getExpireTime(),o!==0&&r.writeInt64(2,o)};TronWebProto.Account.Frozen.prototype.getFrozenBalance=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Account.Frozen.prototype.setFrozenBalance=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Account.Frozen.prototype.getExpireTime=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Account.Frozen.prototype.setExpireTime=function(n){return d.Message.setProto3IntField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.AccountResource.prototype.toObject=function(n){return TronWebProto.Account.AccountResource.toObject(n,this)},TronWebProto.Account.AccountResource.toObject=function(n,r){var o,s={energyUsage:d.Message.getFieldWithDefault(r,1,0),frozenBalanceForEnergy:(o=r.getFrozenBalanceForEnergy())&&TronWebProto.Account.Frozen.toObject(n,o),latestConsumeTimeForEnergy:d.Message.getFieldWithDefault(r,3,0),acquiredDelegatedFrozenBalanceForEnergy:d.Message.getFieldWithDefault(r,4,0),delegatedFrozenBalanceForEnergy:d.Message.getFieldWithDefault(r,5,0),storageLimit:d.Message.getFieldWithDefault(r,6,0),storageUsage:d.Message.getFieldWithDefault(r,7,0),latestExchangeStorageTime:d.Message.getFieldWithDefault(r,8,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.AccountResource.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account.AccountResource;return TronWebProto.Account.AccountResource.deserializeBinaryFromReader(o,r)};TronWebProto.Account.AccountResource.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setEnergyUsage(s);break;case 2:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.setFrozenBalanceForEnergy(s);break;case 3:var s=r.readInt64();n.setLatestConsumeTimeForEnergy(s);break;case 4:var s=r.readInt64();n.setAcquiredDelegatedFrozenBalanceForEnergy(s);break;case 5:var s=r.readInt64();n.setDelegatedFrozenBalanceForEnergy(s);break;case 6:var s=r.readInt64();n.setStorageLimit(s);break;case 7:var s=r.readInt64();n.setStorageUsage(s);break;case 8:var s=r.readInt64();n.setLatestExchangeStorageTime(s);break;default:r.skipField();break}}return n};TronWebProto.Account.AccountResource.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.AccountResource.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.AccountResource.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEnergyUsage(),o!==0&&r.writeInt64(1,o),o=n.getFrozenBalanceForEnergy(),o!=null&&r.writeMessage(2,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getLatestConsumeTimeForEnergy(),o!==0&&r.writeInt64(3,o),o=n.getAcquiredDelegatedFrozenBalanceForEnergy(),o!==0&&r.writeInt64(4,o),o=n.getDelegatedFrozenBalanceForEnergy(),o!==0&&r.writeInt64(5,o),o=n.getStorageLimit(),o!==0&&r.writeInt64(6,o),o=n.getStorageUsage(),o!==0&&r.writeInt64(7,o),o=n.getLatestExchangeStorageTime(),o!==0&&r.writeInt64(8,o)};TronWebProto.Account.AccountResource.prototype.getEnergyUsage=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Account.AccountResource.prototype.setEnergyUsage=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Account.AccountResource.prototype.getFrozenBalanceForEnergy=function(){return d.Message.getWrapperField(this,TronWebProto.Account.Frozen,2)};TronWebProto.Account.AccountResource.prototype.setFrozenBalanceForEnergy=function(n){return d.Message.setWrapperField(this,2,n)};TronWebProto.Account.AccountResource.prototype.clearFrozenBalanceForEnergy=function(){return this.setFrozenBalanceForEnergy(void 0)};TronWebProto.Account.AccountResource.prototype.hasFrozenBalanceForEnergy=function(){return d.Message.getField(this,2)!=null};TronWebProto.Account.AccountResource.prototype.getLatestConsumeTimeForEnergy=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Account.AccountResource.prototype.setLatestConsumeTimeForEnergy=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Account.AccountResource.prototype.getAcquiredDelegatedFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Account.AccountResource.prototype.setAcquiredDelegatedFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Account.AccountResource.prototype.getDelegatedFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Account.AccountResource.prototype.setDelegatedFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Account.AccountResource.prototype.getStorageLimit=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.Account.AccountResource.prototype.setStorageLimit=function(n){return d.Message.setProto3IntField(this,6,n)};TronWebProto.Account.AccountResource.prototype.getStorageUsage=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Account.AccountResource.prototype.setStorageUsage=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Account.AccountResource.prototype.getLatestExchangeStorageTime=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Account.AccountResource.prototype.setLatestExchangeStorageTime=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Account.prototype.getAccountName=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Account.prototype.getAccountName_asB64=function(){return d.Message.bytesAsB64(this.getAccountName())};TronWebProto.Account.prototype.getAccountName_asU8=function(){return d.Message.bytesAsU8(this.getAccountName())};TronWebProto.Account.prototype.setAccountName=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Account.prototype.getType=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Account.prototype.setType=function(n){return d.Message.setProto3EnumField(this,2,n)};TronWebProto.Account.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Account.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Account.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Account.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Account.prototype.getBalance=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Account.prototype.setBalance=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Account.prototype.getVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,5)};TronWebProto.Account.prototype.setVotesList=function(n){return d.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.Account.prototype.addVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.Vote,r)};TronWebProto.Account.prototype.clearVotesList=function(){return this.setVotesList([])};TronWebProto.Account.prototype.getAssetMap=function(n){return d.Message.getMapField(this,6,n,null)};TronWebProto.Account.prototype.clearAssetMap=function(){return this.getAssetMap().clear(),this};TronWebProto.Account.prototype.getAssetv2Map=function(n){return d.Message.getMapField(this,56,n,null)};TronWebProto.Account.prototype.clearAssetv2Map=function(){return this.getAssetv2Map().clear(),this};TronWebProto.Account.prototype.getFrozenList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Account.Frozen,7)};TronWebProto.Account.prototype.setFrozenList=function(n){return d.Message.setRepeatedWrapperField(this,7,n)};TronWebProto.Account.prototype.addFrozen=function(n,r){return d.Message.addToRepeatedWrapperField(this,7,n,TronWebProto.Account.Frozen,r)};TronWebProto.Account.prototype.clearFrozenList=function(){return this.setFrozenList([])};TronWebProto.Account.prototype.getNetUsage=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Account.prototype.setNetUsage=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Account.prototype.getAcquiredDelegatedFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,41,0)};TronWebProto.Account.prototype.setAcquiredDelegatedFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,41,n)};TronWebProto.Account.prototype.getDelegatedFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,42,0)};TronWebProto.Account.prototype.setDelegatedFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,42,n)};TronWebProto.Account.prototype.getOldTronPower=function(){return d.Message.getFieldWithDefault(this,46,0)};TronWebProto.Account.prototype.setOldTronPower=function(n){return d.Message.setProto3IntField(this,46,n)};TronWebProto.Account.prototype.getTronPower=function(){return d.Message.getWrapperField(this,TronWebProto.Account.Frozen,47)};TronWebProto.Account.prototype.setTronPower=function(n){return d.Message.setWrapperField(this,47,n)};TronWebProto.Account.prototype.clearTronPower=function(){return this.setTronPower(void 0)};TronWebProto.Account.prototype.hasTronPower=function(){return d.Message.getField(this,47)!=null};TronWebProto.Account.prototype.getAssetOptimized=function(){return d.Message.getBooleanFieldWithDefault(this,60,!1)};TronWebProto.Account.prototype.setAssetOptimized=function(n){return d.Message.setProto3BooleanField(this,60,n)};TronWebProto.Account.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,9,0)};TronWebProto.Account.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,9,n)};TronWebProto.Account.prototype.getLatestOprationTime=function(){return d.Message.getFieldWithDefault(this,10,0)};TronWebProto.Account.prototype.setLatestOprationTime=function(n){return d.Message.setProto3IntField(this,10,n)};TronWebProto.Account.prototype.getAllowance=function(){return d.Message.getFieldWithDefault(this,11,0)};TronWebProto.Account.prototype.setAllowance=function(n){return d.Message.setProto3IntField(this,11,n)};TronWebProto.Account.prototype.getLatestWithdrawTime=function(){return d.Message.getFieldWithDefault(this,12,0)};TronWebProto.Account.prototype.setLatestWithdrawTime=function(n){return d.Message.setProto3IntField(this,12,n)};TronWebProto.Account.prototype.getCode=function(){return d.Message.getFieldWithDefault(this,13,"")};TronWebProto.Account.prototype.getCode_asB64=function(){return d.Message.bytesAsB64(this.getCode())};TronWebProto.Account.prototype.getCode_asU8=function(){return d.Message.bytesAsU8(this.getCode())};TronWebProto.Account.prototype.setCode=function(n){return d.Message.setProto3BytesField(this,13,n)};TronWebProto.Account.prototype.getIsWitness=function(){return d.Message.getBooleanFieldWithDefault(this,14,!1)};TronWebProto.Account.prototype.setIsWitness=function(n){return d.Message.setProto3BooleanField(this,14,n)};TronWebProto.Account.prototype.getIsCommittee=function(){return d.Message.getBooleanFieldWithDefault(this,15,!1)};TronWebProto.Account.prototype.setIsCommittee=function(n){return d.Message.setProto3BooleanField(this,15,n)};TronWebProto.Account.prototype.getFrozenSupplyList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Account.Frozen,16)};TronWebProto.Account.prototype.setFrozenSupplyList=function(n){return d.Message.setRepeatedWrapperField(this,16,n)};TronWebProto.Account.prototype.addFrozenSupply=function(n,r){return d.Message.addToRepeatedWrapperField(this,16,n,TronWebProto.Account.Frozen,r)};TronWebProto.Account.prototype.clearFrozenSupplyList=function(){return this.setFrozenSupplyList([])};TronWebProto.Account.prototype.getAssetIssuedName=function(){return d.Message.getFieldWithDefault(this,17,"")};TronWebProto.Account.prototype.getAssetIssuedName_asB64=function(){return d.Message.bytesAsB64(this.getAssetIssuedName())};TronWebProto.Account.prototype.getAssetIssuedName_asU8=function(){return d.Message.bytesAsU8(this.getAssetIssuedName())};TronWebProto.Account.prototype.setAssetIssuedName=function(n){return d.Message.setProto3BytesField(this,17,n)};TronWebProto.Account.prototype.getAssetIssuedId=function(){return d.Message.getFieldWithDefault(this,57,"")};TronWebProto.Account.prototype.getAssetIssuedId_asB64=function(){return d.Message.bytesAsB64(this.getAssetIssuedId())};TronWebProto.Account.prototype.getAssetIssuedId_asU8=function(){return d.Message.bytesAsU8(this.getAssetIssuedId())};TronWebProto.Account.prototype.setAssetIssuedId=function(n){return d.Message.setProto3BytesField(this,57,n)};TronWebProto.Account.prototype.getLatestAssetOperationTimeMap=function(n){return d.Message.getMapField(this,18,n,null)};TronWebProto.Account.prototype.clearLatestAssetOperationTimeMap=function(){return this.getLatestAssetOperationTimeMap().clear(),this};TronWebProto.Account.prototype.getLatestAssetOperationTimev2Map=function(n){return d.Message.getMapField(this,58,n,null)};TronWebProto.Account.prototype.clearLatestAssetOperationTimev2Map=function(){return this.getLatestAssetOperationTimev2Map().clear(),this};TronWebProto.Account.prototype.getFreeNetUsage=function(){return d.Message.getFieldWithDefault(this,19,0)};TronWebProto.Account.prototype.setFreeNetUsage=function(n){return d.Message.setProto3IntField(this,19,n)};TronWebProto.Account.prototype.getFreeAssetNetUsageMap=function(n){return d.Message.getMapField(this,20,n,null)};TronWebProto.Account.prototype.clearFreeAssetNetUsageMap=function(){return this.getFreeAssetNetUsageMap().clear(),this};TronWebProto.Account.prototype.getFreeAssetNetUsagev2Map=function(n){return d.Message.getMapField(this,59,n,null)};TronWebProto.Account.prototype.clearFreeAssetNetUsagev2Map=function(){return this.getFreeAssetNetUsagev2Map().clear(),this};TronWebProto.Account.prototype.getLatestConsumeTime=function(){return d.Message.getFieldWithDefault(this,21,0)};TronWebProto.Account.prototype.setLatestConsumeTime=function(n){return d.Message.setProto3IntField(this,21,n)};TronWebProto.Account.prototype.getLatestConsumeFreeTime=function(){return d.Message.getFieldWithDefault(this,22,0)};TronWebProto.Account.prototype.setLatestConsumeFreeTime=function(n){return d.Message.setProto3IntField(this,22,n)};TronWebProto.Account.prototype.getAccountId=function(){return d.Message.getFieldWithDefault(this,23,"")};TronWebProto.Account.prototype.getAccountId_asB64=function(){return d.Message.bytesAsB64(this.getAccountId())};TronWebProto.Account.prototype.getAccountId_asU8=function(){return d.Message.bytesAsU8(this.getAccountId())};TronWebProto.Account.prototype.setAccountId=function(n){return d.Message.setProto3BytesField(this,23,n)};TronWebProto.Account.prototype.getAccountResource=function(){return d.Message.getWrapperField(this,TronWebProto.Account.AccountResource,26)};TronWebProto.Account.prototype.setAccountResource=function(n){return d.Message.setWrapperField(this,26,n)};TronWebProto.Account.prototype.clearAccountResource=function(){return this.setAccountResource(void 0)};TronWebProto.Account.prototype.hasAccountResource=function(){return d.Message.getField(this,26)!=null};TronWebProto.Account.prototype.getCodehash=function(){return d.Message.getFieldWithDefault(this,30,"")};TronWebProto.Account.prototype.getCodehash_asB64=function(){return d.Message.bytesAsB64(this.getCodehash())};TronWebProto.Account.prototype.getCodehash_asU8=function(){return d.Message.bytesAsU8(this.getCodehash())};TronWebProto.Account.prototype.setCodehash=function(n){return d.Message.setProto3BytesField(this,30,n)};TronWebProto.Account.prototype.getOwnerPermission=function(){return d.Message.getWrapperField(this,TronWebProto.Permission,31)};TronWebProto.Account.prototype.setOwnerPermission=function(n){return d.Message.setWrapperField(this,31,n)};TronWebProto.Account.prototype.clearOwnerPermission=function(){return this.setOwnerPermission(void 0)};TronWebProto.Account.prototype.hasOwnerPermission=function(){return d.Message.getField(this,31)!=null};TronWebProto.Account.prototype.getWitnessPermission=function(){return d.Message.getWrapperField(this,TronWebProto.Permission,32)};TronWebProto.Account.prototype.setWitnessPermission=function(n){return d.Message.setWrapperField(this,32,n)};TronWebProto.Account.prototype.clearWitnessPermission=function(){return this.setWitnessPermission(void 0)};TronWebProto.Account.prototype.hasWitnessPermission=function(){return d.Message.getField(this,32)!=null};TronWebProto.Account.prototype.getActivePermissionList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Permission,33)};TronWebProto.Account.prototype.setActivePermissionList=function(n){return d.Message.setRepeatedWrapperField(this,33,n)};TronWebProto.Account.prototype.addActivePermission=function(n,r){return d.Message.addToRepeatedWrapperField(this,33,n,TronWebProto.Permission,r)};TronWebProto.Account.prototype.clearActivePermissionList=function(){return this.setActivePermissionList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Key.prototype.toObject=function(n){return TronWebProto.Key.toObject(n,this)},TronWebProto.Key.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),weight:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Key.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Key;return TronWebProto.Key.deserializeBinaryFromReader(o,r)};TronWebProto.Key.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=r.readInt64();n.setWeight(s);break;default:r.skipField();break}}return n};TronWebProto.Key.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Key.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Key.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getWeight(),o!==0&&r.writeInt64(2,o)};TronWebProto.Key.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Key.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Key.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Key.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Key.prototype.getWeight=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Key.prototype.setWeight=function(n){return d.Message.setProto3IntField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.DelegatedResource.prototype.toObject=function(n){return TronWebProto.DelegatedResource.toObject(n,this)},TronWebProto.DelegatedResource.toObject=function(n,r){var o,s={from:r.getFrom_asB64(),to:r.getTo_asB64(),frozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,3,0),frozenBalanceForEnergy:d.Message.getFieldWithDefault(r,4,0),expireTimeForBandwidth:d.Message.getFieldWithDefault(r,5,0),expireTimeForEnergy:d.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.DelegatedResource.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.DelegatedResource;return TronWebProto.DelegatedResource.deserializeBinaryFromReader(o,r)};TronWebProto.DelegatedResource.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setFrom(s);break;case 2:var s=r.readBytes();n.setTo(s);break;case 3:var s=r.readInt64();n.setFrozenBalanceForBandwidth(s);break;case 4:var s=r.readInt64();n.setFrozenBalanceForEnergy(s);break;case 5:var s=r.readInt64();n.setExpireTimeForBandwidth(s);break;case 6:var s=r.readInt64();n.setExpireTimeForEnergy(s);break;default:r.skipField();break}}return n};TronWebProto.DelegatedResource.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.DelegatedResource.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.DelegatedResource.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrom_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getTo_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(3,o),o=n.getFrozenBalanceForEnergy(),o!==0&&r.writeInt64(4,o),o=n.getExpireTimeForBandwidth(),o!==0&&r.writeInt64(5,o),o=n.getExpireTimeForEnergy(),o!==0&&r.writeInt64(6,o)};TronWebProto.DelegatedResource.prototype.getFrom=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.DelegatedResource.prototype.getFrom_asB64=function(){return d.Message.bytesAsB64(this.getFrom())};TronWebProto.DelegatedResource.prototype.getFrom_asU8=function(){return d.Message.bytesAsU8(this.getFrom())};TronWebProto.DelegatedResource.prototype.setFrom=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.DelegatedResource.prototype.getTo=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.DelegatedResource.prototype.getTo_asB64=function(){return d.Message.bytesAsB64(this.getTo())};TronWebProto.DelegatedResource.prototype.getTo_asU8=function(){return d.Message.bytesAsU8(this.getTo())};TronWebProto.DelegatedResource.prototype.setTo=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.DelegatedResource.prototype.getFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.DelegatedResource.prototype.setFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.DelegatedResource.prototype.getFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.DelegatedResource.prototype.setFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.DelegatedResource.prototype.getExpireTimeForBandwidth=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.DelegatedResource.prototype.setExpireTimeForBandwidth=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.DelegatedResource.prototype.getExpireTimeForEnergy=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.DelegatedResource.prototype.setExpireTimeForEnergy=function(n){return d.Message.setProto3IntField(this,6,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.authority.prototype.toObject=function(n){return TronWebProto.authority.toObject(n,this)},TronWebProto.authority.toObject=function(n,r){var o,s={account:(o=r.getAccount())&&TronWebProto.AccountId.toObject(n,o),permissionName:r.getPermissionName_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.authority.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.authority;return TronWebProto.authority.deserializeBinaryFromReader(o,r)};TronWebProto.authority.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.AccountId;r.readMessage(s,TronWebProto.AccountId.deserializeBinaryFromReader),n.setAccount(s);break;case 2:var s=r.readBytes();n.setPermissionName(s);break;default:r.skipField();break}}return n};TronWebProto.authority.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.authority.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.authority.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccount(),o!=null&&r.writeMessage(1,o,TronWebProto.AccountId.serializeBinaryToWriter),o=n.getPermissionName_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.authority.prototype.getAccount=function(){return d.Message.getWrapperField(this,TronWebProto.AccountId,1)};TronWebProto.authority.prototype.setAccount=function(n){return d.Message.setWrapperField(this,1,n)};TronWebProto.authority.prototype.clearAccount=function(){return this.setAccount(void 0)};TronWebProto.authority.prototype.hasAccount=function(){return d.Message.getField(this,1)!=null};TronWebProto.authority.prototype.getPermissionName=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.authority.prototype.getPermissionName_asB64=function(){return d.Message.bytesAsB64(this.getPermissionName())};TronWebProto.authority.prototype.getPermissionName_asU8=function(){return d.Message.bytesAsU8(this.getPermissionName())};TronWebProto.authority.prototype.setPermissionName=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Permission.repeatedFields_=[7];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Permission.prototype.toObject=function(n){return TronWebProto.Permission.toObject(n,this)},TronWebProto.Permission.toObject=function(n,r){var o,s={type:d.Message.getFieldWithDefault(r,1,0),id:d.Message.getFieldWithDefault(r,2,0),permissionName:d.Message.getFieldWithDefault(r,3,""),threshold:d.Message.getFieldWithDefault(r,4,0),parentId:d.Message.getFieldWithDefault(r,5,0),operations:r.getOperations_asB64(),keysList:d.Message.toObjectList(r.getKeysList(),TronWebProto.Key.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Permission.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Permission;return TronWebProto.Permission.deserializeBinaryFromReader(o,r)};TronWebProto.Permission.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readEnum();n.setType(s);break;case 2:var s=r.readInt32();n.setId(s);break;case 3:var s=r.readString();n.setPermissionName(s);break;case 4:var s=r.readInt64();n.setThreshold(s);break;case 5:var s=r.readInt32();n.setParentId(s);break;case 6:var s=r.readBytes();n.setOperations(s);break;case 7:var s=new TronWebProto.Key;r.readMessage(s,TronWebProto.Key.deserializeBinaryFromReader),n.addKeys(s);break;default:r.skipField();break}}return n};TronWebProto.Permission.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Permission.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Permission.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getType(),o!==0&&r.writeEnum(1,o),o=n.getId(),o!==0&&r.writeInt32(2,o),o=n.getPermissionName(),o.length>0&&r.writeString(3,o),o=n.getThreshold(),o!==0&&r.writeInt64(4,o),o=n.getParentId(),o!==0&&r.writeInt32(5,o),o=n.getOperations_asU8(),o.length>0&&r.writeBytes(6,o),o=n.getKeysList(),o.length>0&&r.writeRepeatedMessage(7,o,TronWebProto.Key.serializeBinaryToWriter)};TronWebProto.Permission.PermissionType={OWNER:0,WITNESS:1,ACTIVE:2};TronWebProto.Permission.prototype.getType=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Permission.prototype.setType=function(n){return d.Message.setProto3EnumField(this,1,n)};TronWebProto.Permission.prototype.getId=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Permission.prototype.setId=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Permission.prototype.getPermissionName=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Permission.prototype.setPermissionName=function(n){return d.Message.setProto3StringField(this,3,n)};TronWebProto.Permission.prototype.getThreshold=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Permission.prototype.setThreshold=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Permission.prototype.getParentId=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Permission.prototype.setParentId=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Permission.prototype.getOperations=function(){return d.Message.getFieldWithDefault(this,6,"")};TronWebProto.Permission.prototype.getOperations_asB64=function(){return d.Message.bytesAsB64(this.getOperations())};TronWebProto.Permission.prototype.getOperations_asU8=function(){return d.Message.bytesAsU8(this.getOperations())};TronWebProto.Permission.prototype.setOperations=function(n){return d.Message.setProto3BytesField(this,6,n)};TronWebProto.Permission.prototype.getKeysList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Key,7)};TronWebProto.Permission.prototype.setKeysList=function(n){return d.Message.setRepeatedWrapperField(this,7,n)};TronWebProto.Permission.prototype.addKeys=function(n,r){return d.Message.addToRepeatedWrapperField(this,7,n,TronWebProto.Key,r)};TronWebProto.Permission.prototype.clearKeysList=function(){return this.setKeysList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Witness.prototype.toObject=function(n){return TronWebProto.Witness.toObject(n,this)},TronWebProto.Witness.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),votecount:d.Message.getFieldWithDefault(r,2,0),pubkey:r.getPubkey_asB64(),url:d.Message.getFieldWithDefault(r,4,""),totalproduced:d.Message.getFieldWithDefault(r,5,0),totalmissed:d.Message.getFieldWithDefault(r,6,0),latestblocknum:d.Message.getFieldWithDefault(r,7,0),latestslotnum:d.Message.getFieldWithDefault(r,8,0),isjobs:d.Message.getBooleanFieldWithDefault(r,9,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Witness.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Witness;return TronWebProto.Witness.deserializeBinaryFromReader(o,r)};TronWebProto.Witness.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=r.readInt64();n.setVotecount(s);break;case 3:var s=r.readBytes();n.setPubkey(s);break;case 4:var s=r.readString();n.setUrl(s);break;case 5:var s=r.readInt64();n.setTotalproduced(s);break;case 6:var s=r.readInt64();n.setTotalmissed(s);break;case 7:var s=r.readInt64();n.setLatestblocknum(s);break;case 8:var s=r.readInt64();n.setLatestslotnum(s);break;case 9:var s=r.readBool();n.setIsjobs(s);break;default:r.skipField();break}}return n};TronWebProto.Witness.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Witness.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Witness.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVotecount(),o!==0&&r.writeInt64(2,o),o=n.getPubkey_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getUrl(),o.length>0&&r.writeString(4,o),o=n.getTotalproduced(),o!==0&&r.writeInt64(5,o),o=n.getTotalmissed(),o!==0&&r.writeInt64(6,o),o=n.getLatestblocknum(),o!==0&&r.writeInt64(7,o),o=n.getLatestslotnum(),o!==0&&r.writeInt64(8,o),o=n.getIsjobs(),o&&r.writeBool(9,o)};TronWebProto.Witness.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Witness.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Witness.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Witness.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Witness.prototype.getVotecount=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Witness.prototype.setVotecount=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Witness.prototype.getPubkey=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Witness.prototype.getPubkey_asB64=function(){return d.Message.bytesAsB64(this.getPubkey())};TronWebProto.Witness.prototype.getPubkey_asU8=function(){return d.Message.bytesAsU8(this.getPubkey())};TronWebProto.Witness.prototype.setPubkey=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Witness.prototype.getUrl=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Witness.prototype.setUrl=function(n){return d.Message.setProto3StringField(this,4,n)};TronWebProto.Witness.prototype.getTotalproduced=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Witness.prototype.setTotalproduced=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Witness.prototype.getTotalmissed=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.Witness.prototype.setTotalmissed=function(n){return d.Message.setProto3IntField(this,6,n)};TronWebProto.Witness.prototype.getLatestblocknum=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Witness.prototype.setLatestblocknum=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Witness.prototype.getLatestslotnum=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Witness.prototype.setLatestslotnum=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Witness.prototype.getIsjobs=function(){return d.Message.getBooleanFieldWithDefault(this,9,!1)};TronWebProto.Witness.prototype.setIsjobs=function(n){return d.Message.setProto3BooleanField(this,9,n)};TronWebProto.Votes.repeatedFields_=[2,3];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Votes.prototype.toObject=function(n){return TronWebProto.Votes.toObject(n,this)},TronWebProto.Votes.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),oldVotesList:d.Message.toObjectList(r.getOldVotesList(),TronWebProto.Vote.toObject,n),newVotesList:d.Message.toObjectList(r.getNewVotesList(),TronWebProto.Vote.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Votes.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Votes;return TronWebProto.Votes.deserializeBinaryFromReader(o,r)};TronWebProto.Votes.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addOldVotes(s);break;case 3:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addNewVotes(s);break;default:r.skipField();break}}return n};TronWebProto.Votes.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Votes.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Votes.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOldVotesList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.Vote.serializeBinaryToWriter),o=n.getNewVotesList(),o.length>0&&r.writeRepeatedMessage(3,o,TronWebProto.Vote.serializeBinaryToWriter)};TronWebProto.Votes.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Votes.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Votes.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Votes.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Votes.prototype.getOldVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,2)};TronWebProto.Votes.prototype.setOldVotesList=function(n){return d.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.Votes.prototype.addOldVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.Vote,r)};TronWebProto.Votes.prototype.clearOldVotesList=function(){return this.setOldVotesList([])};TronWebProto.Votes.prototype.getNewVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,3)};TronWebProto.Votes.prototype.setNewVotesList=function(n){return d.Message.setRepeatedWrapperField(this,3,n)};TronWebProto.Votes.prototype.addNewVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,3,n,TronWebProto.Vote,r)};TronWebProto.Votes.prototype.clearNewVotesList=function(){return this.setNewVotesList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.MarketOrderDetail.prototype.toObject=function(n){return TronWebProto.MarketOrderDetail.toObject(n,this)},TronWebProto.MarketOrderDetail.toObject=function(n,r){var o,s={makerorderid:r.getMakerorderid_asB64(),takerorderid:r.getTakerorderid_asB64(),fillsellquantity:d.Message.getFieldWithDefault(r,3,0),fillbuyquantity:d.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.MarketOrderDetail.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.MarketOrderDetail;return TronWebProto.MarketOrderDetail.deserializeBinaryFromReader(o,r)};TronWebProto.MarketOrderDetail.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setMakerorderid(s);break;case 2:var s=r.readBytes();n.setTakerorderid(s);break;case 3:var s=r.readInt64();n.setFillsellquantity(s);break;case 4:var s=r.readInt64();n.setFillbuyquantity(s);break;default:r.skipField();break}}return n};TronWebProto.MarketOrderDetail.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.MarketOrderDetail.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.MarketOrderDetail.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getMakerorderid_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getTakerorderid_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFillsellquantity(),o!==0&&r.writeInt64(3,o),o=n.getFillbuyquantity(),o!==0&&r.writeInt64(4,o)};TronWebProto.MarketOrderDetail.prototype.getMakerorderid=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.MarketOrderDetail.prototype.getMakerorderid_asB64=function(){return d.Message.bytesAsB64(this.getMakerorderid())};TronWebProto.MarketOrderDetail.prototype.getMakerorderid_asU8=function(){return d.Message.bytesAsU8(this.getMakerorderid())};TronWebProto.MarketOrderDetail.prototype.setMakerorderid=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.MarketOrderDetail.prototype.getTakerorderid=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.MarketOrderDetail.prototype.getTakerorderid_asB64=function(){return d.Message.bytesAsB64(this.getTakerorderid())};TronWebProto.MarketOrderDetail.prototype.getTakerorderid_asU8=function(){return d.Message.bytesAsU8(this.getTakerorderid())};TronWebProto.MarketOrderDetail.prototype.setTakerorderid=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.MarketOrderDetail.prototype.getFillsellquantity=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.MarketOrderDetail.prototype.setFillsellquantity=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.MarketOrderDetail.prototype.getFillbuyquantity=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.MarketOrderDetail.prototype.setFillbuyquantity=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Transaction.repeatedFields_=[2,5];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.prototype.toObject=function(n){return TronWebProto.Transaction.toObject(n,this)},TronWebProto.Transaction.toObject=function(n,r){var o,s={rawData:(o=r.getRawData())&&TronWebProto.Transaction.raw.toObject(n,o),signatureList:r.getSignatureList_asB64(),retList:d.Message.toObjectList(r.getRetList(),TronWebProto.Transaction.Result.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction;return TronWebProto.Transaction.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.Transaction.raw;r.readMessage(s,TronWebProto.Transaction.raw.deserializeBinaryFromReader),n.setRawData(s);break;case 2:var s=r.readBytes();n.addSignature(s);break;case 5:var s=new TronWebProto.Transaction.Result;r.readMessage(s,TronWebProto.Transaction.Result.deserializeBinaryFromReader),n.addRet(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getRawData(),o!=null&&r.writeMessage(1,o,TronWebProto.Transaction.raw.serializeBinaryToWriter),o=n.getSignatureList_asU8(),o.length>0&&r.writeRepeatedBytes(2,o),o=n.getRetList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.Transaction.Result.serializeBinaryToWriter)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.Contract.prototype.toObject=function(n){return TronWebProto.Transaction.Contract.toObject(n,this)},TronWebProto.Transaction.Contract.toObject=function(n,r){var o,s={type:d.Message.getFieldWithDefault(r,1,0),parameter:(o=r.getParameter())&&Go.Any.toObject(n,o),provider:r.getProvider_asB64(),contractname:r.getContractname_asB64(),permissionId:d.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.Contract.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.Contract;return TronWebProto.Transaction.Contract.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readEnum();n.setType(s);break;case 2:var s=new Go.Any;r.readMessage(s,Go.Any.deserializeBinaryFromReader),n.setParameter(s);break;case 3:var s=r.readBytes();n.setProvider(s);break;case 4:var s=r.readBytes();n.setContractname(s);break;case 5:var s=r.readInt32();n.setPermissionId(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.Contract.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getType(),o!==0&&r.writeEnum(1,o),o=n.getParameter(),o!=null&&r.writeMessage(2,o,Go.Any.serializeBinaryToWriter),o=n.getProvider_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getContractname_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getPermissionId(),o!==0&&r.writeInt32(5,o)};TronWebProto.Transaction.Contract.ContractType={ACCOUNTCREATECONTRACT:0,TRANSFERCONTRACT:1,TRANSFERASSETCONTRACT:2,VOTEASSETCONTRACT:3,VOTEWITNESSCONTRACT:4,WITNESSCREATECONTRACT:5,ASSETISSUECONTRACT:6,WITNESSUPDATECONTRACT:8,PARTICIPATEASSETISSUECONTRACT:9,ACCOUNTUPDATECONTRACT:10,FREEZEBALANCECONTRACT:11,UNFREEZEBALANCECONTRACT:12,WITHDRAWBALANCECONTRACT:13,UNFREEZEASSETCONTRACT:14,UPDATEASSETCONTRACT:15,PROPOSALCREATECONTRACT:16,PROPOSALAPPROVECONTRACT:17,PROPOSALDELETECONTRACT:18,SETACCOUNTIDCONTRACT:19,CUSTOMCONTRACT:20,CREATESMARTCONTRACT:30,TRIGGERSMARTCONTRACT:31,GETCONTRACT:32,UPDATESETTINGCONTRACT:33,EXCHANGECREATECONTRACT:41,EXCHANGEINJECTCONTRACT:42,EXCHANGEWITHDRAWCONTRACT:43,EXCHANGETRANSACTIONCONTRACT:44,UPDATEENERGYLIMITCONTRACT:45,ACCOUNTPERMISSIONUPDATECONTRACT:46,CLEARABICONTRACT:48,UPDATEBROKERAGECONTRACT:49,SHIELDEDTRANSFERCONTRACT:51,MARKETSELLASSETCONTRACT:52,MARKETCANCELORDERCONTRACT:53,FREEZEBALANCEV2CONTRACT:54,UNFREEZEBALANCEV2CONTRACT:55,WITHDRAWEXPIREUNFREEZECONTRACT:56,DELEGATERESOURCECONTRACT:57,UNDELEGATERESOURCECONTRACT:58,CANCELALLUNFREEZEV2CONTRACT:59};TronWebProto.Transaction.Contract.prototype.getType=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Transaction.Contract.prototype.setType=function(n){return d.Message.setProto3EnumField(this,1,n)};TronWebProto.Transaction.Contract.prototype.getParameter=function(){return d.Message.getWrapperField(this,Go.Any,2)};TronWebProto.Transaction.Contract.prototype.setParameter=function(n){return d.Message.setWrapperField(this,2,n)};TronWebProto.Transaction.Contract.prototype.clearParameter=function(){return this.setParameter(void 0)};TronWebProto.Transaction.Contract.prototype.hasParameter=function(){return d.Message.getField(this,2)!=null};TronWebProto.Transaction.Contract.prototype.getProvider=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Transaction.Contract.prototype.getProvider_asB64=function(){return d.Message.bytesAsB64(this.getProvider())};TronWebProto.Transaction.Contract.prototype.getProvider_asU8=function(){return d.Message.bytesAsU8(this.getProvider())};TronWebProto.Transaction.Contract.prototype.setProvider=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Transaction.Contract.prototype.getContractname=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Transaction.Contract.prototype.getContractname_asB64=function(){return d.Message.bytesAsB64(this.getContractname())};TronWebProto.Transaction.Contract.prototype.getContractname_asU8=function(){return d.Message.bytesAsU8(this.getContractname())};TronWebProto.Transaction.Contract.prototype.setContractname=function(n){return d.Message.setProto3BytesField(this,4,n)};TronWebProto.Transaction.Contract.prototype.getPermissionId=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Transaction.Contract.prototype.setPermissionId=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Transaction.Result.repeatedFields_=[26];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.Result.prototype.toObject=function(n){return TronWebProto.Transaction.Result.toObject(n,this)},TronWebProto.Transaction.Result.toObject=function(n,r){var o,s={fee:d.Message.getFieldWithDefault(r,1,0),ret:d.Message.getFieldWithDefault(r,2,0),contractret:d.Message.getFieldWithDefault(r,3,0),assetissueid:d.Message.getFieldWithDefault(r,14,""),withdrawAmount:d.Message.getFieldWithDefault(r,15,0),unfreezeAmount:d.Message.getFieldWithDefault(r,16,0),exchangeReceivedAmount:d.Message.getFieldWithDefault(r,18,0),exchangeInjectAnotherAmount:d.Message.getFieldWithDefault(r,19,0),exchangeWithdrawAnotherAmount:d.Message.getFieldWithDefault(r,20,0),exchangeId:d.Message.getFieldWithDefault(r,21,0),shieldedTransactionFee:d.Message.getFieldWithDefault(r,22,0),orderid:r.getOrderid_asB64(),orderdetailsList:d.Message.toObjectList(r.getOrderdetailsList(),TronWebProto.MarketOrderDetail.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.Result.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.Result;return TronWebProto.Transaction.Result.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.Result.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFee(s);break;case 2:var s=r.readEnum();n.setRet(s);break;case 3:var s=r.readEnum();n.setContractret(s);break;case 14:var s=r.readString();n.setAssetissueid(s);break;case 15:var s=r.readInt64();n.setWithdrawAmount(s);break;case 16:var s=r.readInt64();n.setUnfreezeAmount(s);break;case 18:var s=r.readInt64();n.setExchangeReceivedAmount(s);break;case 19:var s=r.readInt64();n.setExchangeInjectAnotherAmount(s);break;case 20:var s=r.readInt64();n.setExchangeWithdrawAnotherAmount(s);break;case 21:var s=r.readInt64();n.setExchangeId(s);break;case 22:var s=r.readInt64();n.setShieldedTransactionFee(s);break;case 25:var s=r.readBytes();n.setOrderid(s);break;case 26:var s=new TronWebProto.MarketOrderDetail;r.readMessage(s,TronWebProto.MarketOrderDetail.deserializeBinaryFromReader),n.addOrderdetails(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.Result.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.Result.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.Result.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFee(),o!==0&&r.writeInt64(1,o),o=n.getRet(),o!==0&&r.writeEnum(2,o),o=n.getContractret(),o!==0&&r.writeEnum(3,o),o=n.getAssetissueid(),o.length>0&&r.writeString(14,o),o=n.getWithdrawAmount(),o!==0&&r.writeInt64(15,o),o=n.getUnfreezeAmount(),o!==0&&r.writeInt64(16,o),o=n.getExchangeReceivedAmount(),o!==0&&r.writeInt64(18,o),o=n.getExchangeInjectAnotherAmount(),o!==0&&r.writeInt64(19,o),o=n.getExchangeWithdrawAnotherAmount(),o!==0&&r.writeInt64(20,o),o=n.getExchangeId(),o!==0&&r.writeInt64(21,o),o=n.getShieldedTransactionFee(),o!==0&&r.writeInt64(22,o),o=n.getOrderid_asU8(),o.length>0&&r.writeBytes(25,o),o=n.getOrderdetailsList(),o.length>0&&r.writeRepeatedMessage(26,o,TronWebProto.MarketOrderDetail.serializeBinaryToWriter)};TronWebProto.Transaction.Result.code={SUCESS:0,FAILED:1};TronWebProto.Transaction.Result.contractResult={DEFAULT:0,SUCCESS:1,REVERT:2,BAD_JUMP_DESTINATION:3,OUT_OF_MEMORY:4,PRECOMPILED_CONTRACT:5,STACK_TOO_SMALL:6,STACK_TOO_LARGE:7,ILLEGAL_OPERATION:8,STACK_OVERFLOW:9,OUT_OF_ENERGY:10,OUT_OF_TIME:11,JVM_STACK_OVER_FLOW:12,UNKNOWN:13,TRANSFER_FAILED:14,INVALID_CODE:15};TronWebProto.Transaction.Result.prototype.getFee=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Transaction.Result.prototype.setFee=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Transaction.Result.prototype.getRet=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Transaction.Result.prototype.setRet=function(n){return d.Message.setProto3EnumField(this,2,n)};TronWebProto.Transaction.Result.prototype.getContractret=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Transaction.Result.prototype.setContractret=function(n){return d.Message.setProto3EnumField(this,3,n)};TronWebProto.Transaction.Result.prototype.getAssetissueid=function(){return d.Message.getFieldWithDefault(this,14,"")};TronWebProto.Transaction.Result.prototype.setAssetissueid=function(n){return d.Message.setProto3StringField(this,14,n)};TronWebProto.Transaction.Result.prototype.getWithdrawAmount=function(){return d.Message.getFieldWithDefault(this,15,0)};TronWebProto.Transaction.Result.prototype.setWithdrawAmount=function(n){return d.Message.setProto3IntField(this,15,n)};TronWebProto.Transaction.Result.prototype.getUnfreezeAmount=function(){return d.Message.getFieldWithDefault(this,16,0)};TronWebProto.Transaction.Result.prototype.setUnfreezeAmount=function(n){return d.Message.setProto3IntField(this,16,n)};TronWebProto.Transaction.Result.prototype.getExchangeReceivedAmount=function(){return d.Message.getFieldWithDefault(this,18,0)};TronWebProto.Transaction.Result.prototype.setExchangeReceivedAmount=function(n){return d.Message.setProto3IntField(this,18,n)};TronWebProto.Transaction.Result.prototype.getExchangeInjectAnotherAmount=function(){return d.Message.getFieldWithDefault(this,19,0)};TronWebProto.Transaction.Result.prototype.setExchangeInjectAnotherAmount=function(n){return d.Message.setProto3IntField(this,19,n)};TronWebProto.Transaction.Result.prototype.getExchangeWithdrawAnotherAmount=function(){return d.Message.getFieldWithDefault(this,20,0)};TronWebProto.Transaction.Result.prototype.setExchangeWithdrawAnotherAmount=function(n){return d.Message.setProto3IntField(this,20,n)};TronWebProto.Transaction.Result.prototype.getExchangeId=function(){return d.Message.getFieldWithDefault(this,21,0)};TronWebProto.Transaction.Result.prototype.setExchangeId=function(n){return d.Message.setProto3IntField(this,21,n)};TronWebProto.Transaction.Result.prototype.getShieldedTransactionFee=function(){return d.Message.getFieldWithDefault(this,22,0)};TronWebProto.Transaction.Result.prototype.setShieldedTransactionFee=function(n){return d.Message.setProto3IntField(this,22,n)};TronWebProto.Transaction.Result.prototype.getOrderid=function(){return d.Message.getFieldWithDefault(this,25,"")};TronWebProto.Transaction.Result.prototype.getOrderid_asB64=function(){return d.Message.bytesAsB64(this.getOrderid())};TronWebProto.Transaction.Result.prototype.getOrderid_asU8=function(){return d.Message.bytesAsU8(this.getOrderid())};TronWebProto.Transaction.Result.prototype.setOrderid=function(n){return d.Message.setProto3BytesField(this,25,n)};TronWebProto.Transaction.Result.prototype.getOrderdetailsList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.MarketOrderDetail,26)};TronWebProto.Transaction.Result.prototype.setOrderdetailsList=function(n){return d.Message.setRepeatedWrapperField(this,26,n)};TronWebProto.Transaction.Result.prototype.addOrderdetails=function(n,r){return d.Message.addToRepeatedWrapperField(this,26,n,TronWebProto.MarketOrderDetail,r)};TronWebProto.Transaction.Result.prototype.clearOrderdetailsList=function(){return this.setOrderdetailsList([])};TronWebProto.Transaction.raw.repeatedFields_=[9,11];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.raw.prototype.toObject=function(n){return TronWebProto.Transaction.raw.toObject(n,this)},TronWebProto.Transaction.raw.toObject=function(n,r){var o,s={refBlockBytes:r.getRefBlockBytes_asB64(),refBlockNum:d.Message.getFieldWithDefault(r,3,0),refBlockHash:r.getRefBlockHash_asB64(),expiration:d.Message.getFieldWithDefault(r,8,0),authsList:d.Message.toObjectList(r.getAuthsList(),TronWebProto.authority.toObject,n),data:r.getData_asB64(),contractList:d.Message.toObjectList(r.getContractList(),TronWebProto.Transaction.Contract.toObject,n),scripts:r.getScripts_asB64(),timestamp:d.Message.getFieldWithDefault(r,14,0),feeLimit:d.Message.getFieldWithDefault(r,18,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.raw.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.raw;return TronWebProto.Transaction.raw.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.raw.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setRefBlockBytes(s);break;case 3:var s=r.readInt64();n.setRefBlockNum(s);break;case 4:var s=r.readBytes();n.setRefBlockHash(s);break;case 8:var s=r.readInt64();n.setExpiration(s);break;case 9:var s=new TronWebProto.authority;r.readMessage(s,TronWebProto.authority.deserializeBinaryFromReader),n.addAuths(s);break;case 10:var s=r.readBytes();n.setData(s);break;case 11:var s=new TronWebProto.Transaction.Contract;r.readMessage(s,TronWebProto.Transaction.Contract.deserializeBinaryFromReader),n.addContract(s);break;case 12:var s=r.readBytes();n.setScripts(s);break;case 14:var s=r.readInt64();n.setTimestamp(s);break;case 18:var s=r.readInt64();n.setFeeLimit(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.raw.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.raw.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.raw.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getRefBlockBytes_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getRefBlockNum(),o!==0&&r.writeInt64(3,o),o=n.getRefBlockHash_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getExpiration(),o!==0&&r.writeInt64(8,o),o=n.getAuthsList(),o.length>0&&r.writeRepeatedMessage(9,o,TronWebProto.authority.serializeBinaryToWriter),o=n.getData_asU8(),o.length>0&&r.writeBytes(10,o),o=n.getContractList(),o.length>0&&r.writeRepeatedMessage(11,o,TronWebProto.Transaction.Contract.serializeBinaryToWriter),o=n.getScripts_asU8(),o.length>0&&r.writeBytes(12,o),o=n.getTimestamp(),o!==0&&r.writeInt64(14,o),o=n.getFeeLimit(),o!==0&&r.writeInt64(18,o)};TronWebProto.Transaction.raw.prototype.getRefBlockBytes=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Transaction.raw.prototype.getRefBlockBytes_asB64=function(){return d.Message.bytesAsB64(this.getRefBlockBytes())};TronWebProto.Transaction.raw.prototype.getRefBlockBytes_asU8=function(){return d.Message.bytesAsU8(this.getRefBlockBytes())};TronWebProto.Transaction.raw.prototype.setRefBlockBytes=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Transaction.raw.prototype.getRefBlockNum=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Transaction.raw.prototype.setRefBlockNum=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Transaction.raw.prototype.getRefBlockHash=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Transaction.raw.prototype.getRefBlockHash_asB64=function(){return d.Message.bytesAsB64(this.getRefBlockHash())};TronWebProto.Transaction.raw.prototype.getRefBlockHash_asU8=function(){return d.Message.bytesAsU8(this.getRefBlockHash())};TronWebProto.Transaction.raw.prototype.setRefBlockHash=function(n){return d.Message.setProto3BytesField(this,4,n)};TronWebProto.Transaction.raw.prototype.getExpiration=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Transaction.raw.prototype.setExpiration=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Transaction.raw.prototype.getAuthsList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.authority,9)};TronWebProto.Transaction.raw.prototype.setAuthsList=function(n){return d.Message.setRepeatedWrapperField(this,9,n)};TronWebProto.Transaction.raw.prototype.addAuths=function(n,r){return d.Message.addToRepeatedWrapperField(this,9,n,TronWebProto.authority,r)};TronWebProto.Transaction.raw.prototype.clearAuthsList=function(){return this.setAuthsList([])};TronWebProto.Transaction.raw.prototype.getData=function(){return d.Message.getFieldWithDefault(this,10,"")};TronWebProto.Transaction.raw.prototype.getData_asB64=function(){return d.Message.bytesAsB64(this.getData())};TronWebProto.Transaction.raw.prototype.getData_asU8=function(){return d.Message.bytesAsU8(this.getData())};TronWebProto.Transaction.raw.prototype.setData=function(n){return d.Message.setProto3BytesField(this,10,n)};TronWebProto.Transaction.raw.prototype.getContractList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Transaction.Contract,11)};TronWebProto.Transaction.raw.prototype.setContractList=function(n){return d.Message.setRepeatedWrapperField(this,11,n)};TronWebProto.Transaction.raw.prototype.addContract=function(n,r){return d.Message.addToRepeatedWrapperField(this,11,n,TronWebProto.Transaction.Contract,r)};TronWebProto.Transaction.raw.prototype.clearContractList=function(){return this.setContractList([])};TronWebProto.Transaction.raw.prototype.getScripts=function(){return d.Message.getFieldWithDefault(this,12,"")};TronWebProto.Transaction.raw.prototype.getScripts_asB64=function(){return d.Message.bytesAsB64(this.getScripts())};TronWebProto.Transaction.raw.prototype.getScripts_asU8=function(){return d.Message.bytesAsU8(this.getScripts())};TronWebProto.Transaction.raw.prototype.setScripts=function(n){return d.Message.setProto3BytesField(this,12,n)};TronWebProto.Transaction.raw.prototype.getTimestamp=function(){return d.Message.getFieldWithDefault(this,14,0)};TronWebProto.Transaction.raw.prototype.setTimestamp=function(n){return d.Message.setProto3IntField(this,14,n)};TronWebProto.Transaction.raw.prototype.getFeeLimit=function(){return d.Message.getFieldWithDefault(this,18,0)};TronWebProto.Transaction.raw.prototype.setFeeLimit=function(n){return d.Message.setProto3IntField(this,18,n)};TronWebProto.Transaction.prototype.getRawData=function(){return d.Message.getWrapperField(this,TronWebProto.Transaction.raw,1)};TronWebProto.Transaction.prototype.setRawData=function(n){return d.Message.setWrapperField(this,1,n)};TronWebProto.Transaction.prototype.clearRawData=function(){return this.setRawData(void 0)};TronWebProto.Transaction.prototype.hasRawData=function(){return d.Message.getField(this,1)!=null};TronWebProto.Transaction.prototype.getSignatureList=function(){return d.Message.getRepeatedField(this,2)};TronWebProto.Transaction.prototype.getSignatureList_asB64=function(){return d.Message.bytesListAsB64(this.getSignatureList())};TronWebProto.Transaction.prototype.getSignatureList_asU8=function(){return d.Message.bytesListAsU8(this.getSignatureList())};TronWebProto.Transaction.prototype.setSignatureList=function(n){return d.Message.setField(this,2,n||[])};TronWebProto.Transaction.prototype.addSignature=function(n,r){return d.Message.addToRepeatedField(this,2,n,r)};TronWebProto.Transaction.prototype.clearSignatureList=function(){return this.setSignatureList([])};TronWebProto.Transaction.prototype.getRetList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Transaction.Result,5)};TronWebProto.Transaction.prototype.setRetList=function(n){return d.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.Transaction.prototype.addRet=function(n,r){return d.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.Transaction.Result,r)};TronWebProto.Transaction.prototype.clearRetList=function(){return this.setRetList([])};TronWebProto.AccountType={NORMAL:0,ASSETISSUE:1,CONTRACT:2};J.object.extend(Kp,TronWebProto)});var Bu=Et(Yp=>{var ch=gr(),Xp=ch,Cu=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Cu<"u"&&Cu||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();Xp.exportSymbol("TronWebProto.ResourceCode",null,Cu);TronWebProto.ResourceCode={BANDWIDTH:0,ENERGY:1,TRON_POWER:2};Xp.object.extend(Yp,TronWebProto)});var Qp=Et(qp=>{var m=gr(),K=m,nt=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof nt<"u"&&nt||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),uh=Bu();K.object.extend(proto,uh);K.exportSymbol("TronWebProto.AccountBalanceRequest",null,nt);K.exportSymbol("TronWebProto.AccountBalanceResponse",null,nt);K.exportSymbol("TronWebProto.AccountIdentifier",null,nt);K.exportSymbol("TronWebProto.AccountTrace",null,nt);K.exportSymbol("TronWebProto.BlockBalanceTrace",null,nt);K.exportSymbol("TronWebProto.BlockBalanceTrace.BlockIdentifier",null,nt);K.exportSymbol("TronWebProto.CancelAllUnfreezeV2Contract",null,nt);K.exportSymbol("TronWebProto.DelegateResourceContract",null,nt);K.exportSymbol("TronWebProto.FreezeBalanceContract",null,nt);K.exportSymbol("TronWebProto.FreezeBalanceV2Contract",null,nt);K.exportSymbol("TronWebProto.TransactionBalanceTrace",null,nt);K.exportSymbol("TronWebProto.TransactionBalanceTrace.Operation",null,nt);K.exportSymbol("TronWebProto.TransferContract",null,nt);K.exportSymbol("TronWebProto.UnDelegateResourceContract",null,nt);K.exportSymbol("TronWebProto.UnfreezeBalanceContract",null,nt);K.exportSymbol("TronWebProto.UnfreezeBalanceV2Contract",null,nt);K.exportSymbol("TronWebProto.WithdrawBalanceContract",null,nt);K.exportSymbol("TronWebProto.WithdrawExpireUnfreezeContract",null,nt);TronWebProto.FreezeBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.FreezeBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.FreezeBalanceContract.displayName="TronWebProto.FreezeBalanceContract");TronWebProto.UnfreezeBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnfreezeBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeBalanceContract.displayName="TronWebProto.UnfreezeBalanceContract");TronWebProto.WithdrawBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.WithdrawBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.WithdrawBalanceContract.displayName="TronWebProto.WithdrawBalanceContract");TronWebProto.TransferContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.TransferContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransferContract.displayName="TronWebProto.TransferContract");TronWebProto.TransactionBalanceTrace=function(n){m.Message.initialize(this,n,0,-1,TronWebProto.TransactionBalanceTrace.repeatedFields_,null)};K.inherits(TronWebProto.TransactionBalanceTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransactionBalanceTrace.displayName="TronWebProto.TransactionBalanceTrace");TronWebProto.TransactionBalanceTrace.Operation=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.TransactionBalanceTrace.Operation,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransactionBalanceTrace.Operation.displayName="TronWebProto.TransactionBalanceTrace.Operation");TronWebProto.BlockBalanceTrace=function(n){m.Message.initialize(this,n,0,-1,TronWebProto.BlockBalanceTrace.repeatedFields_,null)};K.inherits(TronWebProto.BlockBalanceTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.BlockBalanceTrace.displayName="TronWebProto.BlockBalanceTrace");TronWebProto.BlockBalanceTrace.BlockIdentifier=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.BlockBalanceTrace.BlockIdentifier,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.BlockBalanceTrace.BlockIdentifier.displayName="TronWebProto.BlockBalanceTrace.BlockIdentifier");TronWebProto.AccountTrace=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountTrace.displayName="TronWebProto.AccountTrace");TronWebProto.AccountIdentifier=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountIdentifier,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountIdentifier.displayName="TronWebProto.AccountIdentifier");TronWebProto.AccountBalanceRequest=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountBalanceRequest,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountBalanceRequest.displayName="TronWebProto.AccountBalanceRequest");TronWebProto.AccountBalanceResponse=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountBalanceResponse,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountBalanceResponse.displayName="TronWebProto.AccountBalanceResponse");TronWebProto.FreezeBalanceV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.FreezeBalanceV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.FreezeBalanceV2Contract.displayName="TronWebProto.FreezeBalanceV2Contract");TronWebProto.UnfreezeBalanceV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnfreezeBalanceV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeBalanceV2Contract.displayName="TronWebProto.UnfreezeBalanceV2Contract");TronWebProto.WithdrawExpireUnfreezeContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.WithdrawExpireUnfreezeContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.WithdrawExpireUnfreezeContract.displayName="TronWebProto.WithdrawExpireUnfreezeContract");TronWebProto.DelegateResourceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.DelegateResourceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.DelegateResourceContract.displayName="TronWebProto.DelegateResourceContract");TronWebProto.UnDelegateResourceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnDelegateResourceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnDelegateResourceContract.displayName="TronWebProto.UnDelegateResourceContract");TronWebProto.CancelAllUnfreezeV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.CancelAllUnfreezeV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.CancelAllUnfreezeV2Contract.displayName="TronWebProto.CancelAllUnfreezeV2Contract");m.Message.GENERATE_TO_OBJECT&&(TronWebProto.FreezeBalanceContract.prototype.toObject=function(n){return TronWebProto.FreezeBalanceContract.toObject(n,this)},TronWebProto.FreezeBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),frozenBalance:m.Message.getFieldWithDefault(r,2,0),frozenDuration:m.Message.getFieldWithDefault(r,3,0),resource:m.Message.getFieldWithDefault(r,10,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.FreezeBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.FreezeBalanceContract;return TronWebProto.FreezeBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.FreezeBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setFrozenBalance(s);break;case 3:var s=r.readInt64();n.setFrozenDuration(s);break;case 10:var s=r.readEnum();n.setResource(s);break;case 15:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.FreezeBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.FreezeBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.FreezeBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFrozenBalance(),o!==0&&r.writeInt64(2,o),o=n.getFrozenDuration(),o!==0&&r.writeInt64(3,o),o=n.getResource(),o!==0&&r.writeEnum(10,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(15,o)};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.FreezeBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.FreezeBalanceContract.prototype.getFrozenBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.FreezeBalanceContract.prototype.setFrozenBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.FreezeBalanceContract.prototype.getFrozenDuration=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.FreezeBalanceContract.prototype.setFrozenDuration=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.FreezeBalanceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,10,0)};TronWebProto.FreezeBalanceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,10,n)};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,15,"")};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.FreezeBalanceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,15,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeBalanceContract.prototype.toObject=function(n){return TronWebProto.UnfreezeBalanceContract.toObject(n,this)},TronWebProto.UnfreezeBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,10,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnfreezeBalanceContract;return TronWebProto.UnfreezeBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 10:var s=r.readEnum();n.setResource(s);break;case 15:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnfreezeBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(10,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(15,o)};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnfreezeBalanceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,10,0)};TronWebProto.UnfreezeBalanceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,10,n)};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,15,"")};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.UnfreezeBalanceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,15,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.WithdrawBalanceContract.prototype.toObject=function(n){return TronWebProto.WithdrawBalanceContract.toObject(n,this)},TronWebProto.WithdrawBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WithdrawBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.WithdrawBalanceContract;return TronWebProto.WithdrawBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.WithdrawBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.WithdrawBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.WithdrawBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WithdrawBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WithdrawBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransferContract.prototype.toObject=function(n){return TronWebProto.TransferContract.toObject(n,this)},TronWebProto.TransferContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),amount:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransferContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransferContract;return TronWebProto.TransferContract.deserializeBinaryFromReader(o,r)};TronWebProto.TransferContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setToAddress(s);break;case 3:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransferContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransferContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransferContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAmount(),o!==0&&r.writeInt64(3,o)};TronWebProto.TransferContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransferContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TransferContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TransferContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.TransferContract.prototype.getToAddress=function(){return m.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransferContract.prototype.getToAddress_asB64=function(){return m.Message.bytesAsB64(this.getToAddress())};TronWebProto.TransferContract.prototype.getToAddress_asU8=function(){return m.Message.bytesAsU8(this.getToAddress())};TronWebProto.TransferContract.prototype.setToAddress=function(n){return m.Message.setProto3BytesField(this,2,n)};TronWebProto.TransferContract.prototype.getAmount=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.TransferContract.prototype.setAmount=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.TransactionBalanceTrace.repeatedFields_=[2];m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransactionBalanceTrace.prototype.toObject=function(n){return TronWebProto.TransactionBalanceTrace.toObject(n,this)},TronWebProto.TransactionBalanceTrace.toObject=function(n,r){var o,s={transactionIdentifier:r.getTransactionIdentifier_asB64(),operationList:m.Message.toObjectList(r.getOperationList(),TronWebProto.TransactionBalanceTrace.Operation.toObject,n),type:m.Message.getFieldWithDefault(r,3,""),status:m.Message.getFieldWithDefault(r,4,"")};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransactionBalanceTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransactionBalanceTrace;return TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader(o,r)};TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setTransactionIdentifier(s);break;case 2:var s=new TronWebProto.TransactionBalanceTrace.Operation;r.readMessage(s,TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader),n.addOperation(s);break;case 3:var s=r.readString();n.setType(s);break;case 4:var s=r.readString();n.setStatus(s);break;default:r.skipField();break}}return n};TronWebProto.TransactionBalanceTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getTransactionIdentifier_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOperationList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter),o=n.getType(),o.length>0&&r.writeString(3,o),o=n.getStatus(),o.length>0&&r.writeString(4,o)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransactionBalanceTrace.Operation.prototype.toObject=function(n){return TronWebProto.TransactionBalanceTrace.Operation.toObject(n,this)},TronWebProto.TransactionBalanceTrace.Operation.toObject=function(n,r){var o,s={operationIdentifier:m.Message.getFieldWithDefault(r,1,0),address:r.getAddress_asB64(),amount:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransactionBalanceTrace.Operation.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransactionBalanceTrace.Operation;return TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader(o,r)};TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setOperationIdentifier(s);break;case 2:var s=r.readBytes();n.setAddress(s);break;case 3:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransactionBalanceTrace.Operation.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOperationIdentifier(),o!==0&&r.writeInt64(1,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAmount(),o!==0&&r.writeInt64(3,o)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getOperationIdentifier=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.TransactionBalanceTrace.Operation.prototype.setOperationIdentifier=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress=function(){return m.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress_asB64=function(){return m.Message.bytesAsB64(this.getAddress())};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress_asU8=function(){return m.Message.bytesAsU8(this.getAddress())};TronWebProto.TransactionBalanceTrace.Operation.prototype.setAddress=function(n){return m.Message.setProto3BytesField(this,2,n)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAmount=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.TransactionBalanceTrace.Operation.prototype.setAmount=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier_asB64=function(){return m.Message.bytesAsB64(this.getTransactionIdentifier())};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier_asU8=function(){return m.Message.bytesAsU8(this.getTransactionIdentifier())};TronWebProto.TransactionBalanceTrace.prototype.setTransactionIdentifier=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.TransactionBalanceTrace.prototype.getOperationList=function(){return m.Message.getRepeatedWrapperField(this,TronWebProto.TransactionBalanceTrace.Operation,2)};TronWebProto.TransactionBalanceTrace.prototype.setOperationList=function(n){return m.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.TransactionBalanceTrace.prototype.addOperation=function(n,r){return m.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.TransactionBalanceTrace.Operation,r)};TronWebProto.TransactionBalanceTrace.prototype.clearOperationList=function(){return this.setOperationList([])};TronWebProto.TransactionBalanceTrace.prototype.getType=function(){return m.Message.getFieldWithDefault(this,3,"")};TronWebProto.TransactionBalanceTrace.prototype.setType=function(n){return m.Message.setProto3StringField(this,3,n)};TronWebProto.TransactionBalanceTrace.prototype.getStatus=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.TransactionBalanceTrace.prototype.setStatus=function(n){return m.Message.setProto3StringField(this,4,n)};TronWebProto.BlockBalanceTrace.repeatedFields_=[3];m.Message.GENERATE_TO_OBJECT&&(TronWebProto.BlockBalanceTrace.prototype.toObject=function(n){return TronWebProto.BlockBalanceTrace.toObject(n,this)},TronWebProto.BlockBalanceTrace.toObject=function(n,r){var o,s={blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o),timestamp:m.Message.getFieldWithDefault(r,2,0),transactionBalanceTraceList:m.Message.toObjectList(r.getTransactionBalanceTraceList(),TronWebProto.TransactionBalanceTrace.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BlockBalanceTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.BlockBalanceTrace;return TronWebProto.BlockBalanceTrace.deserializeBinaryFromReader(o,r)};TronWebProto.BlockBalanceTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;case 2:var s=r.readInt64();n.setTimestamp(s);break;case 3:var s=new TronWebProto.TransactionBalanceTrace;r.readMessage(s,TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader),n.addTransactionBalanceTrace(s);break;default:r.skipField();break}}return n};TronWebProto.BlockBalanceTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.BlockBalanceTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BlockBalanceTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBlockIdentifier(),o!=null&&r.writeMessage(1,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter),o=n.getTimestamp(),o!==0&&r.writeInt64(2,o),o=n.getTransactionBalanceTraceList(),o.length>0&&r.writeRepeatedMessage(3,o,TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.toObject=function(n){return TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,this)},TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject=function(n,r){var o,s={hash:r.getHash_asB64(),number:m.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.BlockBalanceTrace.BlockIdentifier;return TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader(o,r)};TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setHash(s);break;case 2:var s=r.readInt64();n.setNumber(s);break;default:r.skipField();break}}return n};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getHash_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getNumber(),o!==0&&r.writeInt64(2,o)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash_asB64=function(){return m.Message.bytesAsB64(this.getHash())};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash_asU8=function(){return m.Message.bytesAsU8(this.getHash())};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.setHash=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getNumber=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.setNumber=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.BlockBalanceTrace.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,1)};TronWebProto.BlockBalanceTrace.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,1,n)};TronWebProto.BlockBalanceTrace.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.BlockBalanceTrace.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,1)!=null};TronWebProto.BlockBalanceTrace.prototype.getTimestamp=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.BlockBalanceTrace.prototype.setTimestamp=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.BlockBalanceTrace.prototype.getTransactionBalanceTraceList=function(){return m.Message.getRepeatedWrapperField(this,TronWebProto.TransactionBalanceTrace,3)};TronWebProto.BlockBalanceTrace.prototype.setTransactionBalanceTraceList=function(n){return m.Message.setRepeatedWrapperField(this,3,n)};TronWebProto.BlockBalanceTrace.prototype.addTransactionBalanceTrace=function(n,r){return m.Message.addToRepeatedWrapperField(this,3,n,TronWebProto.TransactionBalanceTrace,r)};TronWebProto.BlockBalanceTrace.prototype.clearTransactionBalanceTraceList=function(){return this.setTransactionBalanceTraceList([])};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountTrace.prototype.toObject=function(n){return TronWebProto.AccountTrace.toObject(n,this)},TronWebProto.AccountTrace.toObject=function(n,r){var o,s={balance:m.Message.getFieldWithDefault(r,1,0),placeholder:m.Message.getFieldWithDefault(r,99,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountTrace;return TronWebProto.AccountTrace.deserializeBinaryFromReader(o,r)};TronWebProto.AccountTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setBalance(s);break;case 99:var s=r.readInt64();n.setPlaceholder(s);break;default:r.skipField();break}}return n};TronWebProto.AccountTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBalance(),o!==0&&r.writeInt64(1,o),o=n.getPlaceholder(),o!==0&&r.writeInt64(99,o)};TronWebProto.AccountTrace.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.AccountTrace.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.AccountTrace.prototype.getPlaceholder=function(){return m.Message.getFieldWithDefault(this,99,0)};TronWebProto.AccountTrace.prototype.setPlaceholder=function(n){return m.Message.setProto3IntField(this,99,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountIdentifier.prototype.toObject=function(n){return TronWebProto.AccountIdentifier.toObject(n,this)},TronWebProto.AccountIdentifier.toObject=function(n,r){var o,s={address:r.getAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountIdentifier.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountIdentifier;return TronWebProto.AccountIdentifier.deserializeBinaryFromReader(o,r)};TronWebProto.AccountIdentifier.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountIdentifier.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountIdentifier.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountIdentifier.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.AccountIdentifier.prototype.getAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountIdentifier.prototype.getAddress_asB64=function(){return m.Message.bytesAsB64(this.getAddress())};TronWebProto.AccountIdentifier.prototype.getAddress_asU8=function(){return m.Message.bytesAsU8(this.getAddress())};TronWebProto.AccountIdentifier.prototype.setAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountBalanceRequest.prototype.toObject=function(n){return TronWebProto.AccountBalanceRequest.toObject(n,this)},TronWebProto.AccountBalanceRequest.toObject=function(n,r){var o,s={accountIdentifier:(o=r.getAccountIdentifier())&&TronWebProto.AccountIdentifier.toObject(n,o),blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountBalanceRequest.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountBalanceRequest;return TronWebProto.AccountBalanceRequest.deserializeBinaryFromReader(o,r)};TronWebProto.AccountBalanceRequest.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.AccountIdentifier;r.readMessage(s,TronWebProto.AccountIdentifier.deserializeBinaryFromReader),n.setAccountIdentifier(s);break;case 2:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;default:r.skipField();break}}return n};TronWebProto.AccountBalanceRequest.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountBalanceRequest.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountBalanceRequest.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountIdentifier(),o!=null&&r.writeMessage(1,o,TronWebProto.AccountIdentifier.serializeBinaryToWriter),o=n.getBlockIdentifier(),o!=null&&r.writeMessage(2,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter)};TronWebProto.AccountBalanceRequest.prototype.getAccountIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.AccountIdentifier,1)};TronWebProto.AccountBalanceRequest.prototype.setAccountIdentifier=function(n){return m.Message.setWrapperField(this,1,n)};TronWebProto.AccountBalanceRequest.prototype.clearAccountIdentifier=function(){return this.setAccountIdentifier(void 0)};TronWebProto.AccountBalanceRequest.prototype.hasAccountIdentifier=function(){return m.Message.getField(this,1)!=null};TronWebProto.AccountBalanceRequest.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,2)};TronWebProto.AccountBalanceRequest.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,2,n)};TronWebProto.AccountBalanceRequest.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.AccountBalanceRequest.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,2)!=null};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountBalanceResponse.prototype.toObject=function(n){return TronWebProto.AccountBalanceResponse.toObject(n,this)},TronWebProto.AccountBalanceResponse.toObject=function(n,r){var o,s={balance:m.Message.getFieldWithDefault(r,1,0),blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountBalanceResponse.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountBalanceResponse;return TronWebProto.AccountBalanceResponse.deserializeBinaryFromReader(o,r)};TronWebProto.AccountBalanceResponse.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setBalance(s);break;case 2:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;default:r.skipField();break}}return n};TronWebProto.AccountBalanceResponse.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountBalanceResponse.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountBalanceResponse.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBalance(),o!==0&&r.writeInt64(1,o),o=n.getBlockIdentifier(),o!=null&&r.writeMessage(2,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter)};TronWebProto.AccountBalanceResponse.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.AccountBalanceResponse.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.AccountBalanceResponse.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,2)};TronWebProto.AccountBalanceResponse.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,2,n)};TronWebProto.AccountBalanceResponse.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.AccountBalanceResponse.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,2)!=null};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.FreezeBalanceV2Contract.prototype.toObject=function(n){return TronWebProto.FreezeBalanceV2Contract.toObject(n,this)},TronWebProto.FreezeBalanceV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),frozenBalance:m.Message.getFieldWithDefault(r,2,0),resource:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.FreezeBalanceV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.FreezeBalanceV2Contract;return TronWebProto.FreezeBalanceV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.FreezeBalanceV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setFrozenBalance(s);break;case 3:var s=r.readEnum();n.setResource(s);break;default:r.skipField();break}}return n};TronWebProto.FreezeBalanceV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.FreezeBalanceV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.FreezeBalanceV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFrozenBalance(),o!==0&&r.writeInt64(2,o),o=n.getResource(),o!==0&&r.writeEnum(3,o)};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.FreezeBalanceV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.FreezeBalanceV2Contract.prototype.getFrozenBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.FreezeBalanceV2Contract.prototype.setFrozenBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.FreezeBalanceV2Contract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.FreezeBalanceV2Contract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,3,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeBalanceV2Contract.prototype.toObject=function(n){return TronWebProto.UnfreezeBalanceV2Contract.toObject(n,this)},TronWebProto.UnfreezeBalanceV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),unfreezeBalance:m.Message.getFieldWithDefault(r,2,0),resource:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeBalanceV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnfreezeBalanceV2Contract;return TronWebProto.UnfreezeBalanceV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeBalanceV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setUnfreezeBalance(s);break;case 3:var s=r.readEnum();n.setResource(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeBalanceV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnfreezeBalanceV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeBalanceV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUnfreezeBalance(),o!==0&&r.writeInt64(2,o),o=n.getResource(),o!==0&&r.writeEnum(3,o)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getUnfreezeBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.UnfreezeBalanceV2Contract.prototype.setUnfreezeBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.UnfreezeBalanceV2Contract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,3,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.WithdrawExpireUnfreezeContract.prototype.toObject=function(n){return TronWebProto.WithdrawExpireUnfreezeContract.toObject(n,this)},TronWebProto.WithdrawExpireUnfreezeContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.WithdrawExpireUnfreezeContract;return TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinaryFromReader(o,r)};TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.WithdrawExpireUnfreezeContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.WithdrawExpireUnfreezeContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WithdrawExpireUnfreezeContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WithdrawExpireUnfreezeContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.DelegateResourceContract.prototype.toObject=function(n){return TronWebProto.DelegateResourceContract.toObject(n,this)},TronWebProto.DelegateResourceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,2,0),balance:m.Message.getFieldWithDefault(r,3,0),receiverAddress:r.getReceiverAddress_asB64(),lock:m.Message.getBooleanFieldWithDefault(r,5,!1),lockPeriod:m.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.DelegateResourceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.DelegateResourceContract;return TronWebProto.DelegateResourceContract.deserializeBinaryFromReader(o,r)};TronWebProto.DelegateResourceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readEnum();n.setResource(s);break;case 3:var s=r.readInt64();n.setBalance(s);break;case 4:var s=r.readBytes();n.setReceiverAddress(s);break;case 5:var s=r.readBool();n.setLock(s);break;case 6:var s=r.readInt64();n.setLockPeriod(s);break;default:r.skipField();break}}return n};TronWebProto.DelegateResourceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.DelegateResourceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.DelegateResourceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(2,o),o=n.getBalance(),o!==0&&r.writeInt64(3,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getLock(),o&&r.writeBool(5,o),o=n.getLockPeriod(),o!==0&&r.writeInt64(6,o)};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.DelegateResourceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.DelegateResourceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.DelegateResourceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,2,n)};TronWebProto.DelegateResourceContract.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.DelegateResourceContract.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.DelegateResourceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,4,n)};TronWebProto.DelegateResourceContract.prototype.getLock=function(){return m.Message.getBooleanFieldWithDefault(this,5,!1)};TronWebProto.DelegateResourceContract.prototype.setLock=function(n){return m.Message.setProto3BooleanField(this,5,n)};TronWebProto.DelegateResourceContract.prototype.getLockPeriod=function(){return m.Message.getFieldWithDefault(this,6,0)};TronWebProto.DelegateResourceContract.prototype.setLockPeriod=function(n){return m.Message.setProto3IntField(this,6,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnDelegateResourceContract.prototype.toObject=function(n){return TronWebProto.UnDelegateResourceContract.toObject(n,this)},TronWebProto.UnDelegateResourceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,2,0),balance:m.Message.getFieldWithDefault(r,3,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnDelegateResourceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnDelegateResourceContract;return TronWebProto.UnDelegateResourceContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnDelegateResourceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readEnum();n.setResource(s);break;case 3:var s=r.readInt64();n.setBalance(s);break;case 4:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnDelegateResourceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnDelegateResourceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnDelegateResourceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(2,o),o=n.getBalance(),o!==0&&r.writeInt64(3,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(4,o)};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnDelegateResourceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnDelegateResourceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.UnDelegateResourceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,2,n)};TronWebProto.UnDelegateResourceContract.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.UnDelegateResourceContract.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.UnDelegateResourceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,4,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.CancelAllUnfreezeV2Contract.prototype.toObject=function(n){return TronWebProto.CancelAllUnfreezeV2Contract.toObject(n,this)},TronWebProto.CancelAllUnfreezeV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.CancelAllUnfreezeV2Contract;return TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.CancelAllUnfreezeV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.CancelAllUnfreezeV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.CancelAllUnfreezeV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.CancelAllUnfreezeV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};K.object.extend(qp,TronWebProto)});var tA=Et(eA=>{var C=gr(),ct=C,kn=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof kn<"u"&&kn||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();ct.exportSymbol("TronWebProto.AssetIssueContract",null,kn);ct.exportSymbol("TronWebProto.AssetIssueContract.FrozenSupply",null,kn);ct.exportSymbol("TronWebProto.ParticipateAssetIssueContract",null,kn);ct.exportSymbol("TronWebProto.TransferAssetContract",null,kn);ct.exportSymbol("TronWebProto.UnfreezeAssetContract",null,kn);ct.exportSymbol("TronWebProto.UpdateAssetContract",null,kn);TronWebProto.AssetIssueContract=function(n){C.Message.initialize(this,n,0,-1,TronWebProto.AssetIssueContract.repeatedFields_,null)};ct.inherits(TronWebProto.AssetIssueContract,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.AssetIssueContract.displayName="TronWebProto.AssetIssueContract");TronWebProto.AssetIssueContract.FrozenSupply=function(n){C.Message.initialize(this,n,0,-1,null,null)};ct.inherits(TronWebProto.AssetIssueContract.FrozenSupply,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.AssetIssueContract.FrozenSupply.displayName="TronWebProto.AssetIssueContract.FrozenSupply");TronWebProto.TransferAssetContract=function(n){C.Message.initialize(this,n,0,-1,null,null)};ct.inherits(TronWebProto.TransferAssetContract,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.TransferAssetContract.displayName="TronWebProto.TransferAssetContract");TronWebProto.UnfreezeAssetContract=function(n){C.Message.initialize(this,n,0,-1,null,null)};ct.inherits(TronWebProto.UnfreezeAssetContract,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeAssetContract.displayName="TronWebProto.UnfreezeAssetContract");TronWebProto.UpdateAssetContract=function(n){C.Message.initialize(this,n,0,-1,null,null)};ct.inherits(TronWebProto.UpdateAssetContract,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.UpdateAssetContract.displayName="TronWebProto.UpdateAssetContract");TronWebProto.ParticipateAssetIssueContract=function(n){C.Message.initialize(this,n,0,-1,null,null)};ct.inherits(TronWebProto.ParticipateAssetIssueContract,C.Message);ct.DEBUG&&!COMPILED&&(TronWebProto.ParticipateAssetIssueContract.displayName="TronWebProto.ParticipateAssetIssueContract");TronWebProto.AssetIssueContract.repeatedFields_=[5];C.Message.GENERATE_TO_OBJECT&&(TronWebProto.AssetIssueContract.prototype.toObject=function(n){return TronWebProto.AssetIssueContract.toObject(n,this)},TronWebProto.AssetIssueContract.toObject=function(n,r){var o,s={id:C.Message.getFieldWithDefault(r,41,""),ownerAddress:r.getOwnerAddress_asB64(),name:r.getName_asB64(),abbr:r.getAbbr_asB64(),totalSupply:C.Message.getFieldWithDefault(r,4,0),frozenSupplyList:C.Message.toObjectList(r.getFrozenSupplyList(),TronWebProto.AssetIssueContract.FrozenSupply.toObject,n),trxNum:C.Message.getFieldWithDefault(r,6,0),precision:C.Message.getFieldWithDefault(r,7,0),num:C.Message.getFieldWithDefault(r,8,0),startTime:C.Message.getFieldWithDefault(r,9,0),endTime:C.Message.getFieldWithDefault(r,10,0),order:C.Message.getFieldWithDefault(r,11,0),voteScore:C.Message.getFieldWithDefault(r,16,0),description:r.getDescription_asB64(),url:r.getUrl_asB64(),freeAssetNetLimit:C.Message.getFieldWithDefault(r,22,0),publicFreeAssetNetLimit:C.Message.getFieldWithDefault(r,23,0),publicFreeAssetNetUsage:C.Message.getFieldWithDefault(r,24,0),publicLatestFreeNetTime:C.Message.getFieldWithDefault(r,25,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AssetIssueContract.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.AssetIssueContract;return TronWebProto.AssetIssueContract.deserializeBinaryFromReader(o,r)};TronWebProto.AssetIssueContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 41:var s=r.readString();n.setId(s);break;case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setName(s);break;case 3:var s=r.readBytes();n.setAbbr(s);break;case 4:var s=r.readInt64();n.setTotalSupply(s);break;case 5:var s=new TronWebProto.AssetIssueContract.FrozenSupply;r.readMessage(s,TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader),n.addFrozenSupply(s);break;case 6:var s=r.readInt32();n.setTrxNum(s);break;case 7:var s=r.readInt32();n.setPrecision(s);break;case 8:var s=r.readInt32();n.setNum(s);break;case 9:var s=r.readInt64();n.setStartTime(s);break;case 10:var s=r.readInt64();n.setEndTime(s);break;case 11:var s=r.readInt64();n.setOrder(s);break;case 16:var s=r.readInt32();n.setVoteScore(s);break;case 20:var s=r.readBytes();n.setDescription(s);break;case 21:var s=r.readBytes();n.setUrl(s);break;case 22:var s=r.readInt64();n.setFreeAssetNetLimit(s);break;case 23:var s=r.readInt64();n.setPublicFreeAssetNetLimit(s);break;case 24:var s=r.readInt64();n.setPublicFreeAssetNetUsage(s);break;case 25:var s=r.readInt64();n.setPublicLatestFreeNetTime(s);break;default:r.skipField();break}}return n};TronWebProto.AssetIssueContract.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.AssetIssueContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AssetIssueContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getId(),o.length>0&&r.writeString(41,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getName_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAbbr_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getTotalSupply(),o!==0&&r.writeInt64(4,o),o=n.getFrozenSupplyList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter),o=n.getTrxNum(),o!==0&&r.writeInt32(6,o),o=n.getPrecision(),o!==0&&r.writeInt32(7,o),o=n.getNum(),o!==0&&r.writeInt32(8,o),o=n.getStartTime(),o!==0&&r.writeInt64(9,o),o=n.getEndTime(),o!==0&&r.writeInt64(10,o),o=n.getOrder(),o!==0&&r.writeInt64(11,o),o=n.getVoteScore(),o!==0&&r.writeInt32(16,o),o=n.getDescription_asU8(),o.length>0&&r.writeBytes(20,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(21,o),o=n.getFreeAssetNetLimit(),o!==0&&r.writeInt64(22,o),o=n.getPublicFreeAssetNetLimit(),o!==0&&r.writeInt64(23,o),o=n.getPublicFreeAssetNetUsage(),o!==0&&r.writeInt64(24,o),o=n.getPublicLatestFreeNetTime(),o!==0&&r.writeInt64(25,o)};C.Message.GENERATE_TO_OBJECT&&(TronWebProto.AssetIssueContract.FrozenSupply.prototype.toObject=function(n){return TronWebProto.AssetIssueContract.FrozenSupply.toObject(n,this)},TronWebProto.AssetIssueContract.FrozenSupply.toObject=function(n,r){var o,s={frozenAmount:C.Message.getFieldWithDefault(r,1,0),frozenDays:C.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.AssetIssueContract.FrozenSupply;return TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader(o,r)};TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFrozenAmount(s);break;case 2:var s=r.readInt64();n.setFrozenDays(s);break;default:r.skipField();break}}return n};TronWebProto.AssetIssueContract.FrozenSupply.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrozenAmount(),o!==0&&r.writeInt64(1,o),o=n.getFrozenDays(),o!==0&&r.writeInt64(2,o)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.getFrozenAmount=function(){return C.Message.getFieldWithDefault(this,1,0)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.setFrozenAmount=function(n){return C.Message.setProto3IntField(this,1,n)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.getFrozenDays=function(){return C.Message.getFieldWithDefault(this,2,0)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.setFrozenDays=function(n){return C.Message.setProto3IntField(this,2,n)};TronWebProto.AssetIssueContract.prototype.getId=function(){return C.Message.getFieldWithDefault(this,41,"")};TronWebProto.AssetIssueContract.prototype.setId=function(n){return C.Message.setProto3StringField(this,41,n)};TronWebProto.AssetIssueContract.prototype.getOwnerAddress=function(){return C.Message.getFieldWithDefault(this,1,"")};TronWebProto.AssetIssueContract.prototype.getOwnerAddress_asB64=function(){return C.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AssetIssueContract.prototype.getOwnerAddress_asU8=function(){return C.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AssetIssueContract.prototype.setOwnerAddress=function(n){return C.Message.setProto3BytesField(this,1,n)};TronWebProto.AssetIssueContract.prototype.getName=function(){return C.Message.getFieldWithDefault(this,2,"")};TronWebProto.AssetIssueContract.prototype.getName_asB64=function(){return C.Message.bytesAsB64(this.getName())};TronWebProto.AssetIssueContract.prototype.getName_asU8=function(){return C.Message.bytesAsU8(this.getName())};TronWebProto.AssetIssueContract.prototype.setName=function(n){return C.Message.setProto3BytesField(this,2,n)};TronWebProto.AssetIssueContract.prototype.getAbbr=function(){return C.Message.getFieldWithDefault(this,3,"")};TronWebProto.AssetIssueContract.prototype.getAbbr_asB64=function(){return C.Message.bytesAsB64(this.getAbbr())};TronWebProto.AssetIssueContract.prototype.getAbbr_asU8=function(){return C.Message.bytesAsU8(this.getAbbr())};TronWebProto.AssetIssueContract.prototype.setAbbr=function(n){return C.Message.setProto3BytesField(this,3,n)};TronWebProto.AssetIssueContract.prototype.getTotalSupply=function(){return C.Message.getFieldWithDefault(this,4,0)};TronWebProto.AssetIssueContract.prototype.setTotalSupply=function(n){return C.Message.setProto3IntField(this,4,n)};TronWebProto.AssetIssueContract.prototype.getFrozenSupplyList=function(){return C.Message.getRepeatedWrapperField(this,TronWebProto.AssetIssueContract.FrozenSupply,5)};TronWebProto.AssetIssueContract.prototype.setFrozenSupplyList=function(n){return C.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.AssetIssueContract.prototype.addFrozenSupply=function(n,r){return C.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.AssetIssueContract.FrozenSupply,r)};TronWebProto.AssetIssueContract.prototype.clearFrozenSupplyList=function(){return this.setFrozenSupplyList([])};TronWebProto.AssetIssueContract.prototype.getTrxNum=function(){return C.Message.getFieldWithDefault(this,6,0)};TronWebProto.AssetIssueContract.prototype.setTrxNum=function(n){return C.Message.setProto3IntField(this,6,n)};TronWebProto.AssetIssueContract.prototype.getPrecision=function(){return C.Message.getFieldWithDefault(this,7,0)};TronWebProto.AssetIssueContract.prototype.setPrecision=function(n){return C.Message.setProto3IntField(this,7,n)};TronWebProto.AssetIssueContract.prototype.getNum=function(){return C.Message.getFieldWithDefault(this,8,0)};TronWebProto.AssetIssueContract.prototype.setNum=function(n){return C.Message.setProto3IntField(this,8,n)};TronWebProto.AssetIssueContract.prototype.getStartTime=function(){return C.Message.getFieldWithDefault(this,9,0)};TronWebProto.AssetIssueContract.prototype.setStartTime=function(n){return C.Message.setProto3IntField(this,9,n)};TronWebProto.AssetIssueContract.prototype.getEndTime=function(){return C.Message.getFieldWithDefault(this,10,0)};TronWebProto.AssetIssueContract.prototype.setEndTime=function(n){return C.Message.setProto3IntField(this,10,n)};TronWebProto.AssetIssueContract.prototype.getOrder=function(){return C.Message.getFieldWithDefault(this,11,0)};TronWebProto.AssetIssueContract.prototype.setOrder=function(n){return C.Message.setProto3IntField(this,11,n)};TronWebProto.AssetIssueContract.prototype.getVoteScore=function(){return C.Message.getFieldWithDefault(this,16,0)};TronWebProto.AssetIssueContract.prototype.setVoteScore=function(n){return C.Message.setProto3IntField(this,16,n)};TronWebProto.AssetIssueContract.prototype.getDescription=function(){return C.Message.getFieldWithDefault(this,20,"")};TronWebProto.AssetIssueContract.prototype.getDescription_asB64=function(){return C.Message.bytesAsB64(this.getDescription())};TronWebProto.AssetIssueContract.prototype.getDescription_asU8=function(){return C.Message.bytesAsU8(this.getDescription())};TronWebProto.AssetIssueContract.prototype.setDescription=function(n){return C.Message.setProto3BytesField(this,20,n)};TronWebProto.AssetIssueContract.prototype.getUrl=function(){return C.Message.getFieldWithDefault(this,21,"")};TronWebProto.AssetIssueContract.prototype.getUrl_asB64=function(){return C.Message.bytesAsB64(this.getUrl())};TronWebProto.AssetIssueContract.prototype.getUrl_asU8=function(){return C.Message.bytesAsU8(this.getUrl())};TronWebProto.AssetIssueContract.prototype.setUrl=function(n){return C.Message.setProto3BytesField(this,21,n)};TronWebProto.AssetIssueContract.prototype.getFreeAssetNetLimit=function(){return C.Message.getFieldWithDefault(this,22,0)};TronWebProto.AssetIssueContract.prototype.setFreeAssetNetLimit=function(n){return C.Message.setProto3IntField(this,22,n)};TronWebProto.AssetIssueContract.prototype.getPublicFreeAssetNetLimit=function(){return C.Message.getFieldWithDefault(this,23,0)};TronWebProto.AssetIssueContract.prototype.setPublicFreeAssetNetLimit=function(n){return C.Message.setProto3IntField(this,23,n)};TronWebProto.AssetIssueContract.prototype.getPublicFreeAssetNetUsage=function(){return C.Message.getFieldWithDefault(this,24,0)};TronWebProto.AssetIssueContract.prototype.setPublicFreeAssetNetUsage=function(n){return C.Message.setProto3IntField(this,24,n)};TronWebProto.AssetIssueContract.prototype.getPublicLatestFreeNetTime=function(){return C.Message.getFieldWithDefault(this,25,0)};TronWebProto.AssetIssueContract.prototype.setPublicLatestFreeNetTime=function(n){return C.Message.setProto3IntField(this,25,n)};C.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransferAssetContract.prototype.toObject=function(n){return TronWebProto.TransferAssetContract.toObject(n,this)},TronWebProto.TransferAssetContract.toObject=function(n,r){var o,s={assetName:r.getAssetName_asB64(),ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),amount:C.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransferAssetContract.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.TransferAssetContract;return TronWebProto.TransferAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.TransferAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAssetName(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;case 3:var s=r.readBytes();n.setToAddress(s);break;case 4:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransferAssetContract.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.TransferAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransferAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAssetName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getAmount(),o!==0&&r.writeInt64(4,o)};TronWebProto.TransferAssetContract.prototype.getAssetName=function(){return C.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransferAssetContract.prototype.getAssetName_asB64=function(){return C.Message.bytesAsB64(this.getAssetName())};TronWebProto.TransferAssetContract.prototype.getAssetName_asU8=function(){return C.Message.bytesAsU8(this.getAssetName())};TronWebProto.TransferAssetContract.prototype.setAssetName=function(n){return C.Message.setProto3BytesField(this,1,n)};TronWebProto.TransferAssetContract.prototype.getOwnerAddress=function(){return C.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransferAssetContract.prototype.getOwnerAddress_asB64=function(){return C.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TransferAssetContract.prototype.getOwnerAddress_asU8=function(){return C.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TransferAssetContract.prototype.setOwnerAddress=function(n){return C.Message.setProto3BytesField(this,2,n)};TronWebProto.TransferAssetContract.prototype.getToAddress=function(){return C.Message.getFieldWithDefault(this,3,"")};TronWebProto.TransferAssetContract.prototype.getToAddress_asB64=function(){return C.Message.bytesAsB64(this.getToAddress())};TronWebProto.TransferAssetContract.prototype.getToAddress_asU8=function(){return C.Message.bytesAsU8(this.getToAddress())};TronWebProto.TransferAssetContract.prototype.setToAddress=function(n){return C.Message.setProto3BytesField(this,3,n)};TronWebProto.TransferAssetContract.prototype.getAmount=function(){return C.Message.getFieldWithDefault(this,4,0)};TronWebProto.TransferAssetContract.prototype.setAmount=function(n){return C.Message.setProto3IntField(this,4,n)};C.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeAssetContract.prototype.toObject=function(n){return TronWebProto.UnfreezeAssetContract.toObject(n,this)},TronWebProto.UnfreezeAssetContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeAssetContract.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.UnfreezeAssetContract;return TronWebProto.UnfreezeAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeAssetContract.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.UnfreezeAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress=function(){return C.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress_asB64=function(){return C.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress_asU8=function(){return C.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeAssetContract.prototype.setOwnerAddress=function(n){return C.Message.setProto3BytesField(this,1,n)};C.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateAssetContract.prototype.toObject=function(n){return TronWebProto.UpdateAssetContract.toObject(n,this)},TronWebProto.UpdateAssetContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),description:r.getDescription_asB64(),url:r.getUrl_asB64(),newLimit:C.Message.getFieldWithDefault(r,4,0),newPublicLimit:C.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateAssetContract.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.UpdateAssetContract;return TronWebProto.UpdateAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setDescription(s);break;case 3:var s=r.readBytes();n.setUrl(s);break;case 4:var s=r.readInt64();n.setNewLimit(s);break;case 5:var s=r.readInt64();n.setNewPublicLimit(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateAssetContract.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.UpdateAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getDescription_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getNewLimit(),o!==0&&r.writeInt64(4,o),o=n.getNewPublicLimit(),o!==0&&r.writeInt64(5,o)};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress=function(){return C.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress_asB64=function(){return C.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress_asU8=function(){return C.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateAssetContract.prototype.setOwnerAddress=function(n){return C.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateAssetContract.prototype.getDescription=function(){return C.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateAssetContract.prototype.getDescription_asB64=function(){return C.Message.bytesAsB64(this.getDescription())};TronWebProto.UpdateAssetContract.prototype.getDescription_asU8=function(){return C.Message.bytesAsU8(this.getDescription())};TronWebProto.UpdateAssetContract.prototype.setDescription=function(n){return C.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateAssetContract.prototype.getUrl=function(){return C.Message.getFieldWithDefault(this,3,"")};TronWebProto.UpdateAssetContract.prototype.getUrl_asB64=function(){return C.Message.bytesAsB64(this.getUrl())};TronWebProto.UpdateAssetContract.prototype.getUrl_asU8=function(){return C.Message.bytesAsU8(this.getUrl())};TronWebProto.UpdateAssetContract.prototype.setUrl=function(n){return C.Message.setProto3BytesField(this,3,n)};TronWebProto.UpdateAssetContract.prototype.getNewLimit=function(){return C.Message.getFieldWithDefault(this,4,0)};TronWebProto.UpdateAssetContract.prototype.setNewLimit=function(n){return C.Message.setProto3IntField(this,4,n)};TronWebProto.UpdateAssetContract.prototype.getNewPublicLimit=function(){return C.Message.getFieldWithDefault(this,5,0)};TronWebProto.UpdateAssetContract.prototype.setNewPublicLimit=function(n){return C.Message.setProto3IntField(this,5,n)};C.Message.GENERATE_TO_OBJECT&&(TronWebProto.ParticipateAssetIssueContract.prototype.toObject=function(n){return TronWebProto.ParticipateAssetIssueContract.toObject(n,this)},TronWebProto.ParticipateAssetIssueContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),assetName:r.getAssetName_asB64(),amount:C.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ParticipateAssetIssueContract.deserializeBinary=function(n){var r=new C.BinaryReader(n),o=new TronWebProto.ParticipateAssetIssueContract;return TronWebProto.ParticipateAssetIssueContract.deserializeBinaryFromReader(o,r)};TronWebProto.ParticipateAssetIssueContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setToAddress(s);break;case 3:var s=r.readBytes();n.setAssetName(s);break;case 4:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.ParticipateAssetIssueContract.prototype.serializeBinary=function(){var n=new C.BinaryWriter;return TronWebProto.ParticipateAssetIssueContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ParticipateAssetIssueContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAssetName_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getAmount(),o!==0&&r.writeInt64(4,o)};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress=function(){return C.Message.getFieldWithDefault(this,1,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress_asB64=function(){return C.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress_asU8=function(){return C.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.setOwnerAddress=function(n){return C.Message.setProto3BytesField(this,1,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress=function(){return C.Message.getFieldWithDefault(this,2,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress_asB64=function(){return C.Message.bytesAsB64(this.getToAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress_asU8=function(){return C.Message.bytesAsU8(this.getToAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.setToAddress=function(n){return C.Message.setProto3BytesField(this,2,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName=function(){return C.Message.getFieldWithDefault(this,3,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName_asB64=function(){return C.Message.bytesAsB64(this.getAssetName())};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName_asU8=function(){return C.Message.bytesAsU8(this.getAssetName())};TronWebProto.ParticipateAssetIssueContract.prototype.setAssetName=function(n){return C.Message.setProto3BytesField(this,3,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getAmount=function(){return C.Message.getFieldWithDefault(this,4,0)};TronWebProto.ParticipateAssetIssueContract.prototype.setAmount=function(n){return C.Message.setProto3IntField(this,4,n)};ct.object.extend(eA,TronWebProto)});var nA=Et(rA=>{var y=gr(),Ae=y,Ut=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Ut<"u"&&Ut||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),lh=sa();Ae.object.extend(proto,lh);Ae.exportSymbol("TronWebProto.ClearABIContract",null,Ut);Ae.exportSymbol("TronWebProto.ContractState",null,Ut);Ae.exportSymbol("TronWebProto.CreateSmartContract",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract.ABI",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract.ABI.Entry",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract.ABI.Entry.EntryType",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract.ABI.Entry.Param",null,Ut);Ae.exportSymbol("TronWebProto.SmartContract.ABI.Entry.StateMutabilityType",null,Ut);Ae.exportSymbol("TronWebProto.SmartContractDataWrapper",null,Ut);Ae.exportSymbol("TronWebProto.TriggerSmartContract",null,Ut);Ae.exportSymbol("TronWebProto.UpdateEnergyLimitContract",null,Ut);Ae.exportSymbol("TronWebProto.UpdateSettingContract",null,Ut);TronWebProto.SmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.SmartContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.displayName="TronWebProto.SmartContract");TronWebProto.SmartContract.ABI=function(n){y.Message.initialize(this,n,0,-1,TronWebProto.SmartContract.ABI.repeatedFields_,null)};Ae.inherits(TronWebProto.SmartContract.ABI,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.displayName="TronWebProto.SmartContract.ABI");TronWebProto.SmartContract.ABI.Entry=function(n){y.Message.initialize(this,n,0,-1,TronWebProto.SmartContract.ABI.Entry.repeatedFields_,null)};Ae.inherits(TronWebProto.SmartContract.ABI.Entry,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.Entry.displayName="TronWebProto.SmartContract.ABI.Entry");TronWebProto.SmartContract.ABI.Entry.Param=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.SmartContract.ABI.Entry.Param,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.Entry.Param.displayName="TronWebProto.SmartContract.ABI.Entry.Param");TronWebProto.ContractState=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.ContractState,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.ContractState.displayName="TronWebProto.ContractState");TronWebProto.CreateSmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.CreateSmartContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.CreateSmartContract.displayName="TronWebProto.CreateSmartContract");TronWebProto.TriggerSmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.TriggerSmartContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.TriggerSmartContract.displayName="TronWebProto.TriggerSmartContract");TronWebProto.ClearABIContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.ClearABIContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.ClearABIContract.displayName="TronWebProto.ClearABIContract");TronWebProto.UpdateSettingContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.UpdateSettingContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.UpdateSettingContract.displayName="TronWebProto.UpdateSettingContract");TronWebProto.UpdateEnergyLimitContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.UpdateEnergyLimitContract,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.UpdateEnergyLimitContract.displayName="TronWebProto.UpdateEnergyLimitContract");TronWebProto.SmartContractDataWrapper=function(n){y.Message.initialize(this,n,0,-1,null,null)};Ae.inherits(TronWebProto.SmartContractDataWrapper,y.Message);Ae.DEBUG&&!COMPILED&&(TronWebProto.SmartContractDataWrapper.displayName="TronWebProto.SmartContractDataWrapper");y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.prototype.toObject=function(n){return TronWebProto.SmartContract.toObject(n,this)},TronWebProto.SmartContract.toObject=function(n,r){var o,s={originAddress:r.getOriginAddress_asB64(),contractAddress:r.getContractAddress_asB64(),abi:(o=r.getAbi())&&TronWebProto.SmartContract.ABI.toObject(n,o),bytecode:r.getBytecode_asB64(),callValue:y.Message.getFieldWithDefault(r,5,0),consumeUserResourcePercent:y.Message.getFieldWithDefault(r,6,0),name:y.Message.getFieldWithDefault(r,7,""),originEnergyLimit:y.Message.getFieldWithDefault(r,8,0),codeHash:r.getCodeHash_asB64(),trxHash:r.getTrxHash_asB64(),version:y.Message.getFieldWithDefault(r,11,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract;return TronWebProto.SmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOriginAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=new TronWebProto.SmartContract.ABI;r.readMessage(s,TronWebProto.SmartContract.ABI.deserializeBinaryFromReader),n.setAbi(s);break;case 4:var s=r.readBytes();n.setBytecode(s);break;case 5:var s=r.readInt64();n.setCallValue(s);break;case 6:var s=r.readInt64();n.setConsumeUserResourcePercent(s);break;case 7:var s=r.readString();n.setName(s);break;case 8:var s=r.readInt64();n.setOriginEnergyLimit(s);break;case 9:var s=r.readBytes();n.setCodeHash(s);break;case 10:var s=r.readBytes();n.setTrxHash(s);break;case 11:var s=r.readInt32();n.setVersion(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOriginAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAbi(),o!=null&&r.writeMessage(3,o,TronWebProto.SmartContract.ABI.serializeBinaryToWriter),o=n.getBytecode_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getCallValue(),o!==0&&r.writeInt64(5,o),o=n.getConsumeUserResourcePercent(),o!==0&&r.writeInt64(6,o),o=n.getName(),o.length>0&&r.writeString(7,o),o=n.getOriginEnergyLimit(),o!==0&&r.writeInt64(8,o),o=n.getCodeHash_asU8(),o.length>0&&r.writeBytes(9,o),o=n.getTrxHash_asU8(),o.length>0&&r.writeBytes(10,o),o=n.getVersion(),o!==0&&r.writeInt32(11,o)};TronWebProto.SmartContract.ABI.repeatedFields_=[1];y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.toObject(n,this)},TronWebProto.SmartContract.ABI.toObject=function(n,r){var o,s={entrysList:y.Message.toObjectList(r.getEntrysList(),TronWebProto.SmartContract.ABI.Entry.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI;return TronWebProto.SmartContract.ABI.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.SmartContract.ABI.Entry;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader),n.addEntrys(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEntrysList(),o.length>0&&r.writeRepeatedMessage(1,o,TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter)};TronWebProto.SmartContract.ABI.Entry.repeatedFields_=[4,5];y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.Entry.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.Entry.toObject(n,this)},TronWebProto.SmartContract.ABI.Entry.toObject=function(n,r){var o,s={anonymous:y.Message.getBooleanFieldWithDefault(r,1,!1),constant:y.Message.getBooleanFieldWithDefault(r,2,!1),name:y.Message.getFieldWithDefault(r,3,""),inputsList:y.Message.toObjectList(r.getInputsList(),TronWebProto.SmartContract.ABI.Entry.Param.toObject,n),outputsList:y.Message.toObjectList(r.getOutputsList(),TronWebProto.SmartContract.ABI.Entry.Param.toObject,n),type:y.Message.getFieldWithDefault(r,6,0),payable:y.Message.getBooleanFieldWithDefault(r,7,!1),statemutability:y.Message.getFieldWithDefault(r,8,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.Entry.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI.Entry;return TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBool();n.setAnonymous(s);break;case 2:var s=r.readBool();n.setConstant(s);break;case 3:var s=r.readString();n.setName(s);break;case 4:var s=new TronWebProto.SmartContract.ABI.Entry.Param;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader),n.addInputs(s);break;case 5:var s=new TronWebProto.SmartContract.ABI.Entry.Param;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader),n.addOutputs(s);break;case 6:var s=r.readEnum();n.setType(s);break;case 7:var s=r.readBool();n.setPayable(s);break;case 8:var s=r.readEnum();n.setStatemutability(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.Entry.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAnonymous(),o&&r.writeBool(1,o),o=n.getConstant(),o&&r.writeBool(2,o),o=n.getName(),o.length>0&&r.writeString(3,o),o=n.getInputsList(),o.length>0&&r.writeRepeatedMessage(4,o,TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter),o=n.getOutputsList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter),o=n.getType(),o!==0&&r.writeEnum(6,o),o=n.getPayable(),o&&r.writeBool(7,o),o=n.getStatemutability(),o!==0&&r.writeEnum(8,o)};TronWebProto.SmartContract.ABI.Entry.EntryType={UNKNOWNENTRYTYPE:0,CONSTRUCTOR:1,FUNCTION:2,EVENT:3,FALLBACK:4,RECEIVE:5,ERROR:6};TronWebProto.SmartContract.ABI.Entry.StateMutabilityType={UNKNOWNMUTABILITYTYPE:0,PURE:1,VIEW:2,NONPAYABLE:3,PAYABLE:4};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.Entry.Param.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.Entry.Param.toObject(n,this)},TronWebProto.SmartContract.ABI.Entry.Param.toObject=function(n,r){var o,s={indexed:y.Message.getBooleanFieldWithDefault(r,1,!1),name:y.Message.getFieldWithDefault(r,2,""),type:y.Message.getFieldWithDefault(r,3,"")};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI.Entry.Param;return TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBool();n.setIndexed(s);break;case 2:var s=r.readString();n.setName(s);break;case 3:var s=r.readString();n.setType(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.Entry.Param.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getIndexed(),o&&r.writeBool(1,o),o=n.getName(),o.length>0&&r.writeString(2,o),o=n.getType(),o.length>0&&r.writeString(3,o)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getIndexed=function(){return y.Message.getBooleanFieldWithDefault(this,1,!1)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setIndexed=function(n){return y.Message.setProto3BooleanField(this,1,n)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getName=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setName=function(n){return y.Message.setProto3StringField(this,2,n)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getType=function(){return y.Message.getFieldWithDefault(this,3,"")};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setType=function(n){return y.Message.setProto3StringField(this,3,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getAnonymous=function(){return y.Message.getBooleanFieldWithDefault(this,1,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setAnonymous=function(n){return y.Message.setProto3BooleanField(this,1,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getConstant=function(){return y.Message.getBooleanFieldWithDefault(this,2,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setConstant=function(n){return y.Message.setProto3BooleanField(this,2,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getName=function(){return y.Message.getFieldWithDefault(this,3,"")};TronWebProto.SmartContract.ABI.Entry.prototype.setName=function(n){return y.Message.setProto3StringField(this,3,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getInputsList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry.Param,4)};TronWebProto.SmartContract.ABI.Entry.prototype.setInputsList=function(n){return y.Message.setRepeatedWrapperField(this,4,n)};TronWebProto.SmartContract.ABI.Entry.prototype.addInputs=function(n,r){return y.Message.addToRepeatedWrapperField(this,4,n,TronWebProto.SmartContract.ABI.Entry.Param,r)};TronWebProto.SmartContract.ABI.Entry.prototype.clearInputsList=function(){return this.setInputsList([])};TronWebProto.SmartContract.ABI.Entry.prototype.getOutputsList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry.Param,5)};TronWebProto.SmartContract.ABI.Entry.prototype.setOutputsList=function(n){return y.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.SmartContract.ABI.Entry.prototype.addOutputs=function(n,r){return y.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.SmartContract.ABI.Entry.Param,r)};TronWebProto.SmartContract.ABI.Entry.prototype.clearOutputsList=function(){return this.setOutputsList([])};TronWebProto.SmartContract.ABI.Entry.prototype.getType=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.SmartContract.ABI.Entry.prototype.setType=function(n){return y.Message.setProto3EnumField(this,6,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getPayable=function(){return y.Message.getBooleanFieldWithDefault(this,7,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setPayable=function(n){return y.Message.setProto3BooleanField(this,7,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getStatemutability=function(){return y.Message.getFieldWithDefault(this,8,0)};TronWebProto.SmartContract.ABI.Entry.prototype.setStatemutability=function(n){return y.Message.setProto3EnumField(this,8,n)};TronWebProto.SmartContract.ABI.prototype.getEntrysList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry,1)};TronWebProto.SmartContract.ABI.prototype.setEntrysList=function(n){return y.Message.setRepeatedWrapperField(this,1,n)};TronWebProto.SmartContract.ABI.prototype.addEntrys=function(n,r){return y.Message.addToRepeatedWrapperField(this,1,n,TronWebProto.SmartContract.ABI.Entry,r)};TronWebProto.SmartContract.ABI.prototype.clearEntrysList=function(){return this.setEntrysList([])};TronWebProto.SmartContract.prototype.getOriginAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.SmartContract.prototype.getOriginAddress_asB64=function(){return y.Message.bytesAsB64(this.getOriginAddress())};TronWebProto.SmartContract.prototype.getOriginAddress_asU8=function(){return y.Message.bytesAsU8(this.getOriginAddress())};TronWebProto.SmartContract.prototype.setOriginAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.SmartContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.SmartContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.SmartContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.SmartContract.prototype.getAbi=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract.ABI,3)};TronWebProto.SmartContract.prototype.setAbi=function(n){return y.Message.setWrapperField(this,3,n)};TronWebProto.SmartContract.prototype.clearAbi=function(){return this.setAbi(void 0)};TronWebProto.SmartContract.prototype.hasAbi=function(){return y.Message.getField(this,3)!=null};TronWebProto.SmartContract.prototype.getBytecode=function(){return y.Message.getFieldWithDefault(this,4,"")};TronWebProto.SmartContract.prototype.getBytecode_asB64=function(){return y.Message.bytesAsB64(this.getBytecode())};TronWebProto.SmartContract.prototype.getBytecode_asU8=function(){return y.Message.bytesAsU8(this.getBytecode())};TronWebProto.SmartContract.prototype.setBytecode=function(n){return y.Message.setProto3BytesField(this,4,n)};TronWebProto.SmartContract.prototype.getCallValue=function(){return y.Message.getFieldWithDefault(this,5,0)};TronWebProto.SmartContract.prototype.setCallValue=function(n){return y.Message.setProto3IntField(this,5,n)};TronWebProto.SmartContract.prototype.getConsumeUserResourcePercent=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.SmartContract.prototype.setConsumeUserResourcePercent=function(n){return y.Message.setProto3IntField(this,6,n)};TronWebProto.SmartContract.prototype.getName=function(){return y.Message.getFieldWithDefault(this,7,"")};TronWebProto.SmartContract.prototype.setName=function(n){return y.Message.setProto3StringField(this,7,n)};TronWebProto.SmartContract.prototype.getOriginEnergyLimit=function(){return y.Message.getFieldWithDefault(this,8,0)};TronWebProto.SmartContract.prototype.setOriginEnergyLimit=function(n){return y.Message.setProto3IntField(this,8,n)};TronWebProto.SmartContract.prototype.getCodeHash=function(){return y.Message.getFieldWithDefault(this,9,"")};TronWebProto.SmartContract.prototype.getCodeHash_asB64=function(){return y.Message.bytesAsB64(this.getCodeHash())};TronWebProto.SmartContract.prototype.getCodeHash_asU8=function(){return y.Message.bytesAsU8(this.getCodeHash())};TronWebProto.SmartContract.prototype.setCodeHash=function(n){return y.Message.setProto3BytesField(this,9,n)};TronWebProto.SmartContract.prototype.getTrxHash=function(){return y.Message.getFieldWithDefault(this,10,"")};TronWebProto.SmartContract.prototype.getTrxHash_asB64=function(){return y.Message.bytesAsB64(this.getTrxHash())};TronWebProto.SmartContract.prototype.getTrxHash_asU8=function(){return y.Message.bytesAsU8(this.getTrxHash())};TronWebProto.SmartContract.prototype.setTrxHash=function(n){return y.Message.setProto3BytesField(this,10,n)};TronWebProto.SmartContract.prototype.getVersion=function(){return y.Message.getFieldWithDefault(this,11,0)};TronWebProto.SmartContract.prototype.setVersion=function(n){return y.Message.setProto3IntField(this,11,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.ContractState.prototype.toObject=function(n){return TronWebProto.ContractState.toObject(n,this)},TronWebProto.ContractState.toObject=function(n,r){var o,s={energyUsage:y.Message.getFieldWithDefault(r,1,0),energyFactor:y.Message.getFieldWithDefault(r,2,0),updateCycle:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ContractState.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.ContractState;return TronWebProto.ContractState.deserializeBinaryFromReader(o,r)};TronWebProto.ContractState.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setEnergyUsage(s);break;case 2:var s=r.readInt64();n.setEnergyFactor(s);break;case 3:var s=r.readInt64();n.setUpdateCycle(s);break;default:r.skipField();break}}return n};TronWebProto.ContractState.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.ContractState.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ContractState.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEnergyUsage(),o!==0&&r.writeInt64(1,o),o=n.getEnergyFactor(),o!==0&&r.writeInt64(2,o),o=n.getUpdateCycle(),o!==0&&r.writeInt64(3,o)};TronWebProto.ContractState.prototype.getEnergyUsage=function(){return y.Message.getFieldWithDefault(this,1,0)};TronWebProto.ContractState.prototype.setEnergyUsage=function(n){return y.Message.setProto3IntField(this,1,n)};TronWebProto.ContractState.prototype.getEnergyFactor=function(){return y.Message.getFieldWithDefault(this,2,0)};TronWebProto.ContractState.prototype.setEnergyFactor=function(n){return y.Message.setProto3IntField(this,2,n)};TronWebProto.ContractState.prototype.getUpdateCycle=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.ContractState.prototype.setUpdateCycle=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.CreateSmartContract.prototype.toObject=function(n){return TronWebProto.CreateSmartContract.toObject(n,this)},TronWebProto.CreateSmartContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),newContract:(o=r.getNewContract())&&TronWebProto.SmartContract.toObject(n,o),callTokenValue:y.Message.getFieldWithDefault(r,3,0),tokenId:y.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.CreateSmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.CreateSmartContract;return TronWebProto.CreateSmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.CreateSmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new TronWebProto.SmartContract;r.readMessage(s,TronWebProto.SmartContract.deserializeBinaryFromReader),n.setNewContract(s);break;case 3:var s=r.readInt64();n.setCallTokenValue(s);break;case 4:var s=r.readInt64();n.setTokenId(s);break;default:r.skipField();break}}return n};TronWebProto.CreateSmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.CreateSmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.CreateSmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getNewContract(),o!=null&&r.writeMessage(2,o,TronWebProto.SmartContract.serializeBinaryToWriter),o=n.getCallTokenValue(),o!==0&&r.writeInt64(3,o),o=n.getTokenId(),o!==0&&r.writeInt64(4,o)};TronWebProto.CreateSmartContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.CreateSmartContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.CreateSmartContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.CreateSmartContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.CreateSmartContract.prototype.getNewContract=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract,2)};TronWebProto.CreateSmartContract.prototype.setNewContract=function(n){return y.Message.setWrapperField(this,2,n)};TronWebProto.CreateSmartContract.prototype.clearNewContract=function(){return this.setNewContract(void 0)};TronWebProto.CreateSmartContract.prototype.hasNewContract=function(){return y.Message.getField(this,2)!=null};TronWebProto.CreateSmartContract.prototype.getCallTokenValue=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.CreateSmartContract.prototype.setCallTokenValue=function(n){return y.Message.setProto3IntField(this,3,n)};TronWebProto.CreateSmartContract.prototype.getTokenId=function(){return y.Message.getFieldWithDefault(this,4,0)};TronWebProto.CreateSmartContract.prototype.setTokenId=function(n){return y.Message.setProto3IntField(this,4,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.TriggerSmartContract.prototype.toObject=function(n){return TronWebProto.TriggerSmartContract.toObject(n,this)},TronWebProto.TriggerSmartContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),callValue:y.Message.getFieldWithDefault(r,3,0),data:r.getData_asB64(),callTokenValue:y.Message.getFieldWithDefault(r,5,0),tokenId:y.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TriggerSmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.TriggerSmartContract;return TronWebProto.TriggerSmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.TriggerSmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setCallValue(s);break;case 4:var s=r.readBytes();n.setData(s);break;case 5:var s=r.readInt64();n.setCallTokenValue(s);break;case 6:var s=r.readInt64();n.setTokenId(s);break;default:r.skipField();break}}return n};TronWebProto.TriggerSmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.TriggerSmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TriggerSmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getCallValue(),o!==0&&r.writeInt64(3,o),o=n.getData_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getCallTokenValue(),o!==0&&r.writeInt64(5,o),o=n.getTokenId(),o!==0&&r.writeInt64(6,o)};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TriggerSmartContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.TriggerSmartContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.TriggerSmartContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.TriggerSmartContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.TriggerSmartContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.TriggerSmartContract.prototype.getCallValue=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.TriggerSmartContract.prototype.setCallValue=function(n){return y.Message.setProto3IntField(this,3,n)};TronWebProto.TriggerSmartContract.prototype.getData=function(){return y.Message.getFieldWithDefault(this,4,"")};TronWebProto.TriggerSmartContract.prototype.getData_asB64=function(){return y.Message.bytesAsB64(this.getData())};TronWebProto.TriggerSmartContract.prototype.getData_asU8=function(){return y.Message.bytesAsU8(this.getData())};TronWebProto.TriggerSmartContract.prototype.setData=function(n){return y.Message.setProto3BytesField(this,4,n)};TronWebProto.TriggerSmartContract.prototype.getCallTokenValue=function(){return y.Message.getFieldWithDefault(this,5,0)};TronWebProto.TriggerSmartContract.prototype.setCallTokenValue=function(n){return y.Message.setProto3IntField(this,5,n)};TronWebProto.TriggerSmartContract.prototype.getTokenId=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.TriggerSmartContract.prototype.setTokenId=function(n){return y.Message.setProto3IntField(this,6,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.ClearABIContract.prototype.toObject=function(n){return TronWebProto.ClearABIContract.toObject(n,this)},TronWebProto.ClearABIContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ClearABIContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.ClearABIContract;return TronWebProto.ClearABIContract.deserializeBinaryFromReader(o,r)};TronWebProto.ClearABIContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;default:r.skipField();break}}return n};TronWebProto.ClearABIContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.ClearABIContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ClearABIContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.ClearABIContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.ClearABIContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ClearABIContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ClearABIContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.ClearABIContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.ClearABIContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.ClearABIContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.ClearABIContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateSettingContract.prototype.toObject=function(n){return TronWebProto.UpdateSettingContract.toObject(n,this)},TronWebProto.UpdateSettingContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),consumeUserResourcePercent:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateSettingContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.UpdateSettingContract;return TronWebProto.UpdateSettingContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateSettingContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setConsumeUserResourcePercent(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateSettingContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.UpdateSettingContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateSettingContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getConsumeUserResourcePercent(),o!==0&&r.writeInt64(3,o)};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateSettingContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateSettingContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateSettingContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.UpdateSettingContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.UpdateSettingContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateSettingContract.prototype.getConsumeUserResourcePercent=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.UpdateSettingContract.prototype.setConsumeUserResourcePercent=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateEnergyLimitContract.prototype.toObject=function(n){return TronWebProto.UpdateEnergyLimitContract.toObject(n,this)},TronWebProto.UpdateEnergyLimitContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),originEnergyLimit:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateEnergyLimitContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.UpdateEnergyLimitContract;return TronWebProto.UpdateEnergyLimitContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateEnergyLimitContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setOriginEnergyLimit(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateEnergyLimitContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.UpdateEnergyLimitContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateEnergyLimitContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getOriginEnergyLimit(),o!==0&&r.writeInt64(3,o)};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateEnergyLimitContract.prototype.getOriginEnergyLimit=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.UpdateEnergyLimitContract.prototype.setOriginEnergyLimit=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContractDataWrapper.prototype.toObject=function(n){return TronWebProto.SmartContractDataWrapper.toObject(n,this)},TronWebProto.SmartContractDataWrapper.toObject=function(n,r){var o,s={smartContract:(o=r.getSmartContract())&&TronWebProto.SmartContract.toObject(n,o),runtimecode:r.getRuntimecode_asB64(),contractState:(o=r.getContractState())&&TronWebProto.ContractState.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContractDataWrapper.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContractDataWrapper;return TronWebProto.SmartContractDataWrapper.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContractDataWrapper.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.SmartContract;r.readMessage(s,TronWebProto.SmartContract.deserializeBinaryFromReader),n.setSmartContract(s);break;case 2:var s=r.readBytes();n.setRuntimecode(s);break;case 3:var s=new TronWebProto.ContractState;r.readMessage(s,TronWebProto.ContractState.deserializeBinaryFromReader),n.setContractState(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContractDataWrapper.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContractDataWrapper.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContractDataWrapper.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getSmartContract(),o!=null&&r.writeMessage(1,o,TronWebProto.SmartContract.serializeBinaryToWriter),o=n.getRuntimecode_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getContractState(),o!=null&&r.writeMessage(3,o,TronWebProto.ContractState.serializeBinaryToWriter)};TronWebProto.SmartContractDataWrapper.prototype.getSmartContract=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract,1)};TronWebProto.SmartContractDataWrapper.prototype.setSmartContract=function(n){return y.Message.setWrapperField(this,1,n)};TronWebProto.SmartContractDataWrapper.prototype.clearSmartContract=function(){return this.setSmartContract(void 0)};TronWebProto.SmartContractDataWrapper.prototype.hasSmartContract=function(){return y.Message.getField(this,1)!=null};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode_asB64=function(){return y.Message.bytesAsB64(this.getRuntimecode())};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode_asU8=function(){return y.Message.bytesAsU8(this.getRuntimecode())};TronWebProto.SmartContractDataWrapper.prototype.setRuntimecode=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.SmartContractDataWrapper.prototype.getContractState=function(){return y.Message.getWrapperField(this,TronWebProto.ContractState,3)};TronWebProto.SmartContractDataWrapper.prototype.setContractState=function(n){return y.Message.setWrapperField(this,3,n)};TronWebProto.SmartContractDataWrapper.prototype.clearContractState=function(){return this.setContractState(void 0)};TronWebProto.SmartContractDataWrapper.prototype.hasContractState=function(){return y.Message.getField(this,3)!=null};Ae.object.extend(rA,TronWebProto)});var sA=Et(oA=>{var Y=gr(),nr=Y,Lo=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Lo<"u"&&Lo||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();nr.exportSymbol("TronWebProto.VoteWitnessContract",null,Lo);nr.exportSymbol("TronWebProto.VoteWitnessContract.Vote",null,Lo);nr.exportSymbol("TronWebProto.WitnessCreateContract",null,Lo);nr.exportSymbol("TronWebProto.WitnessUpdateContract",null,Lo);TronWebProto.WitnessCreateContract=function(n){Y.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.WitnessCreateContract,Y.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.WitnessCreateContract.displayName="TronWebProto.WitnessCreateContract");TronWebProto.WitnessUpdateContract=function(n){Y.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.WitnessUpdateContract,Y.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.WitnessUpdateContract.displayName="TronWebProto.WitnessUpdateContract");TronWebProto.VoteWitnessContract=function(n){Y.Message.initialize(this,n,0,-1,TronWebProto.VoteWitnessContract.repeatedFields_,null)};nr.inherits(TronWebProto.VoteWitnessContract,Y.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.VoteWitnessContract.displayName="TronWebProto.VoteWitnessContract");TronWebProto.VoteWitnessContract.Vote=function(n){Y.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.VoteWitnessContract.Vote,Y.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.VoteWitnessContract.Vote.displayName="TronWebProto.VoteWitnessContract.Vote");Y.Message.GENERATE_TO_OBJECT&&(TronWebProto.WitnessCreateContract.prototype.toObject=function(n){return TronWebProto.WitnessCreateContract.toObject(n,this)},TronWebProto.WitnessCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),url:r.getUrl_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WitnessCreateContract.deserializeBinary=function(n){var r=new Y.BinaryReader(n),o=new TronWebProto.WitnessCreateContract;return TronWebProto.WitnessCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.WitnessCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setUrl(s);break;default:r.skipField();break}}return n};TronWebProto.WitnessCreateContract.prototype.serializeBinary=function(){var n=new Y.BinaryWriter;return TronWebProto.WitnessCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WitnessCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress=function(){return Y.Message.getFieldWithDefault(this,1,"")};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress_asB64=function(){return Y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress_asU8=function(){return Y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WitnessCreateContract.prototype.setOwnerAddress=function(n){return Y.Message.setProto3BytesField(this,1,n)};TronWebProto.WitnessCreateContract.prototype.getUrl=function(){return Y.Message.getFieldWithDefault(this,2,"")};TronWebProto.WitnessCreateContract.prototype.getUrl_asB64=function(){return Y.Message.bytesAsB64(this.getUrl())};TronWebProto.WitnessCreateContract.prototype.getUrl_asU8=function(){return Y.Message.bytesAsU8(this.getUrl())};TronWebProto.WitnessCreateContract.prototype.setUrl=function(n){return Y.Message.setProto3BytesField(this,2,n)};Y.Message.GENERATE_TO_OBJECT&&(TronWebProto.WitnessUpdateContract.prototype.toObject=function(n){return TronWebProto.WitnessUpdateContract.toObject(n,this)},TronWebProto.WitnessUpdateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),updateUrl:r.getUpdateUrl_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WitnessUpdateContract.deserializeBinary=function(n){var r=new Y.BinaryReader(n),o=new TronWebProto.WitnessUpdateContract;return TronWebProto.WitnessUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.WitnessUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 12:var s=r.readBytes();n.setUpdateUrl(s);break;default:r.skipField();break}}return n};TronWebProto.WitnessUpdateContract.prototype.serializeBinary=function(){var n=new Y.BinaryWriter;return TronWebProto.WitnessUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WitnessUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUpdateUrl_asU8(),o.length>0&&r.writeBytes(12,o)};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress=function(){return Y.Message.getFieldWithDefault(this,1,"")};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress_asB64=function(){return Y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress_asU8=function(){return Y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WitnessUpdateContract.prototype.setOwnerAddress=function(n){return Y.Message.setProto3BytesField(this,1,n)};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl=function(){return Y.Message.getFieldWithDefault(this,12,"")};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl_asB64=function(){return Y.Message.bytesAsB64(this.getUpdateUrl())};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl_asU8=function(){return Y.Message.bytesAsU8(this.getUpdateUrl())};TronWebProto.WitnessUpdateContract.prototype.setUpdateUrl=function(n){return Y.Message.setProto3BytesField(this,12,n)};TronWebProto.VoteWitnessContract.repeatedFields_=[2];Y.Message.GENERATE_TO_OBJECT&&(TronWebProto.VoteWitnessContract.prototype.toObject=function(n){return TronWebProto.VoteWitnessContract.toObject(n,this)},TronWebProto.VoteWitnessContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),votesList:Y.Message.toObjectList(r.getVotesList(),TronWebProto.VoteWitnessContract.Vote.toObject,n),support:Y.Message.getBooleanFieldWithDefault(r,3,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.VoteWitnessContract.deserializeBinary=function(n){var r=new Y.BinaryReader(n),o=new TronWebProto.VoteWitnessContract;return TronWebProto.VoteWitnessContract.deserializeBinaryFromReader(o,r)};TronWebProto.VoteWitnessContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new TronWebProto.VoteWitnessContract.Vote;r.readMessage(s,TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader),n.addVotes(s);break;case 3:var s=r.readBool();n.setSupport(s);break;default:r.skipField();break}}return n};TronWebProto.VoteWitnessContract.prototype.serializeBinary=function(){var n=new Y.BinaryWriter;return TronWebProto.VoteWitnessContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.VoteWitnessContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVotesList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter),o=n.getSupport(),o&&r.writeBool(3,o)};Y.Message.GENERATE_TO_OBJECT&&(TronWebProto.VoteWitnessContract.Vote.prototype.toObject=function(n){return TronWebProto.VoteWitnessContract.Vote.toObject(n,this)},TronWebProto.VoteWitnessContract.Vote.toObject=function(n,r){var o,s={voteAddress:r.getVoteAddress_asB64(),voteCount:Y.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.VoteWitnessContract.Vote.deserializeBinary=function(n){var r=new Y.BinaryReader(n),o=new TronWebProto.VoteWitnessContract.Vote;return TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader(o,r)};TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setVoteAddress(s);break;case 2:var s=r.readInt64();n.setVoteCount(s);break;default:r.skipField();break}}return n};TronWebProto.VoteWitnessContract.Vote.prototype.serializeBinary=function(){var n=new Y.BinaryWriter;return TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getVoteAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVoteCount(),o!==0&&r.writeInt64(2,o)};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress=function(){return Y.Message.getFieldWithDefault(this,1,"")};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress_asB64=function(){return Y.Message.bytesAsB64(this.getVoteAddress())};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress_asU8=function(){return Y.Message.bytesAsU8(this.getVoteAddress())};TronWebProto.VoteWitnessContract.Vote.prototype.setVoteAddress=function(n){return Y.Message.setProto3BytesField(this,1,n)};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteCount=function(){return Y.Message.getFieldWithDefault(this,2,0)};TronWebProto.VoteWitnessContract.Vote.prototype.setVoteCount=function(n){return Y.Message.setProto3IntField(this,2,n)};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress=function(){return Y.Message.getFieldWithDefault(this,1,"")};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress_asB64=function(){return Y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress_asU8=function(){return Y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.VoteWitnessContract.prototype.setOwnerAddress=function(n){return Y.Message.setProto3BytesField(this,1,n)};TronWebProto.VoteWitnessContract.prototype.getVotesList=function(){return Y.Message.getRepeatedWrapperField(this,TronWebProto.VoteWitnessContract.Vote,2)};TronWebProto.VoteWitnessContract.prototype.setVotesList=function(n){return Y.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.VoteWitnessContract.prototype.addVotes=function(n,r){return Y.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.VoteWitnessContract.Vote,r)};TronWebProto.VoteWitnessContract.prototype.clearVotesList=function(){return this.setVotesList([])};TronWebProto.VoteWitnessContract.prototype.getSupport=function(){return Y.Message.getBooleanFieldWithDefault(this,3,!1)};TronWebProto.VoteWitnessContract.prototype.setSupport=function(n){return Y.Message.setProto3BooleanField(this,3,n)};nr.object.extend(oA,TronWebProto)});var aA=Et(iA=>{var te=gr(),or=te,$o=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof $o<"u"&&$o||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();or.exportSymbol("TronWebProto.BuyStorageBytesContract",null,$o);or.exportSymbol("TronWebProto.BuyStorageContract",null,$o);or.exportSymbol("TronWebProto.SellStorageContract",null,$o);or.exportSymbol("TronWebProto.UpdateBrokerageContract",null,$o);TronWebProto.BuyStorageBytesContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.BuyStorageBytesContract,te.Message);or.DEBUG&&!COMPILED&&(TronWebProto.BuyStorageBytesContract.displayName="TronWebProto.BuyStorageBytesContract");TronWebProto.BuyStorageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.BuyStorageContract,te.Message);or.DEBUG&&!COMPILED&&(TronWebProto.BuyStorageContract.displayName="TronWebProto.BuyStorageContract");TronWebProto.SellStorageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.SellStorageContract,te.Message);or.DEBUG&&!COMPILED&&(TronWebProto.SellStorageContract.displayName="TronWebProto.SellStorageContract");TronWebProto.UpdateBrokerageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.UpdateBrokerageContract,te.Message);or.DEBUG&&!COMPILED&&(TronWebProto.UpdateBrokerageContract.displayName="TronWebProto.UpdateBrokerageContract");te.Message.GENERATE_TO_OBJECT&&(TronWebProto.BuyStorageBytesContract.prototype.toObject=function(n){return TronWebProto.BuyStorageBytesContract.toObject(n,this)},TronWebProto.BuyStorageBytesContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),bytes:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BuyStorageBytesContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.BuyStorageBytesContract;return TronWebProto.BuyStorageBytesContract.deserializeBinaryFromReader(o,r)};TronWebProto.BuyStorageBytesContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setBytes(s);break;default:r.skipField();break}}return n};TronWebProto.BuyStorageBytesContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.BuyStorageBytesContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BuyStorageBytesContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getBytes(),o!==0&&r.writeInt64(2,o)};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.BuyStorageBytesContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.BuyStorageBytesContract.prototype.getBytes=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.BuyStorageBytesContract.prototype.setBytes=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.BuyStorageContract.prototype.toObject=function(n){return TronWebProto.BuyStorageContract.toObject(n,this)},TronWebProto.BuyStorageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),quant:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BuyStorageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.BuyStorageContract;return TronWebProto.BuyStorageContract.deserializeBinaryFromReader(o,r)};TronWebProto.BuyStorageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.BuyStorageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.BuyStorageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BuyStorageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getQuant(),o!==0&&r.writeInt64(2,o)};TronWebProto.BuyStorageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.BuyStorageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.BuyStorageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.BuyStorageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.BuyStorageContract.prototype.getQuant=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.BuyStorageContract.prototype.setQuant=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.SellStorageContract.prototype.toObject=function(n){return TronWebProto.SellStorageContract.toObject(n,this)},TronWebProto.SellStorageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),storageBytes:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SellStorageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.SellStorageContract;return TronWebProto.SellStorageContract.deserializeBinaryFromReader(o,r)};TronWebProto.SellStorageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setStorageBytes(s);break;default:r.skipField();break}}return n};TronWebProto.SellStorageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.SellStorageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SellStorageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getStorageBytes(),o!==0&&r.writeInt64(2,o)};TronWebProto.SellStorageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.SellStorageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.SellStorageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.SellStorageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.SellStorageContract.prototype.getStorageBytes=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.SellStorageContract.prototype.setStorageBytes=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateBrokerageContract.prototype.toObject=function(n){return TronWebProto.UpdateBrokerageContract.toObject(n,this)},TronWebProto.UpdateBrokerageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),brokerage:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateBrokerageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.UpdateBrokerageContract;return TronWebProto.UpdateBrokerageContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateBrokerageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt32();n.setBrokerage(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateBrokerageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.UpdateBrokerageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateBrokerageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getBrokerage(),o!==0&&r.writeInt32(2,o)};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateBrokerageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateBrokerageContract.prototype.getBrokerage=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.UpdateBrokerageContract.prototype.setBrokerage=function(n){return te.Message.setProto3IntField(this,2,n)};or.object.extend(iA,TronWebProto)});var uA=Et(cA=>{var H=gr(),Zt=H,Zo=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Zo<"u"&&Zo||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),vt=sa();Zt.object.extend(proto,vt);Zt.exportSymbol("TronWebProto.AccountCreateContract",null,Zo);Zt.exportSymbol("TronWebProto.AccountPermissionUpdateContract",null,Zo);Zt.exportSymbol("TronWebProto.AccountUpdateContract",null,Zo);Zt.exportSymbol("TronWebProto.SetAccountIdContract",null,Zo);TronWebProto.AccountCreateContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};Zt.inherits(TronWebProto.AccountCreateContract,H.Message);Zt.DEBUG&&!COMPILED&&(TronWebProto.AccountCreateContract.displayName="TronWebProto.AccountCreateContract");TronWebProto.AccountUpdateContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};Zt.inherits(TronWebProto.AccountUpdateContract,H.Message);Zt.DEBUG&&!COMPILED&&(TronWebProto.AccountUpdateContract.displayName="TronWebProto.AccountUpdateContract");TronWebProto.SetAccountIdContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};Zt.inherits(TronWebProto.SetAccountIdContract,H.Message);Zt.DEBUG&&!COMPILED&&(TronWebProto.SetAccountIdContract.displayName="TronWebProto.SetAccountIdContract");TronWebProto.AccountPermissionUpdateContract=function(n){H.Message.initialize(this,n,0,-1,TronWebProto.AccountPermissionUpdateContract.repeatedFields_,null)};Zt.inherits(TronWebProto.AccountPermissionUpdateContract,H.Message);Zt.DEBUG&&!COMPILED&&(TronWebProto.AccountPermissionUpdateContract.displayName="TronWebProto.AccountPermissionUpdateContract");H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountCreateContract.prototype.toObject=function(n){return TronWebProto.AccountCreateContract.toObject(n,this)},TronWebProto.AccountCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),accountAddress:r.getAccountAddress_asB64(),type:H.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountCreateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountCreateContract;return TronWebProto.AccountCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setAccountAddress(s);break;case 3:var s=r.readEnum();n.setType(s);break;default:r.skipField();break}}return n};TronWebProto.AccountCreateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getAccountAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getType(),o!==0&&r.writeEnum(3,o)};TronWebProto.AccountCreateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountCreateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountCreateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountCreateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountCreateContract.prototype.getAccountAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountCreateContract.prototype.getAccountAddress_asB64=function(){return H.Message.bytesAsB64(this.getAccountAddress())};TronWebProto.AccountCreateContract.prototype.getAccountAddress_asU8=function(){return H.Message.bytesAsU8(this.getAccountAddress())};TronWebProto.AccountCreateContract.prototype.setAccountAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};TronWebProto.AccountCreateContract.prototype.getType=function(){return H.Message.getFieldWithDefault(this,3,0)};TronWebProto.AccountCreateContract.prototype.setType=function(n){return H.Message.setProto3EnumField(this,3,n)};H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountUpdateContract.prototype.toObject=function(n){return TronWebProto.AccountUpdateContract.toObject(n,this)},TronWebProto.AccountUpdateContract.toObject=function(n,r){var o,s={accountName:r.getAccountName_asB64(),ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountUpdateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountUpdateContract;return TronWebProto.AccountUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountName(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountUpdateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.AccountUpdateContract.prototype.getAccountName=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountUpdateContract.prototype.getAccountName_asB64=function(){return H.Message.bytesAsB64(this.getAccountName())};TronWebProto.AccountUpdateContract.prototype.getAccountName_asU8=function(){return H.Message.bytesAsU8(this.getAccountName())};TronWebProto.AccountUpdateContract.prototype.setAccountName=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountUpdateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};H.Message.GENERATE_TO_OBJECT&&(TronWebProto.SetAccountIdContract.prototype.toObject=function(n){return TronWebProto.SetAccountIdContract.toObject(n,this)},TronWebProto.SetAccountIdContract.toObject=function(n,r){var o,s={accountId:r.getAccountId_asB64(),ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SetAccountIdContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.SetAccountIdContract;return TronWebProto.SetAccountIdContract.deserializeBinaryFromReader(o,r)};TronWebProto.SetAccountIdContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountId(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.SetAccountIdContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.SetAccountIdContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SetAccountIdContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountId_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.SetAccountIdContract.prototype.getAccountId=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.SetAccountIdContract.prototype.getAccountId_asB64=function(){return H.Message.bytesAsB64(this.getAccountId())};TronWebProto.SetAccountIdContract.prototype.getAccountId_asU8=function(){return H.Message.bytesAsU8(this.getAccountId())};TronWebProto.SetAccountIdContract.prototype.setAccountId=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.SetAccountIdContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};TronWebProto.AccountPermissionUpdateContract.repeatedFields_=[4];H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountPermissionUpdateContract.prototype.toObject=function(n){return TronWebProto.AccountPermissionUpdateContract.toObject(n,this)},TronWebProto.AccountPermissionUpdateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),owner:(o=r.getOwner())&&vt.Permission.toObject(n,o),witness:(o=r.getWitness())&&vt.Permission.toObject(n,o),activesList:H.Message.toObjectList(r.getActivesList(),vt.Permission.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountPermissionUpdateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountPermissionUpdateContract;return TronWebProto.AccountPermissionUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountPermissionUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new vt.Permission;r.readMessage(s,vt.Permission.deserializeBinaryFromReader),n.setOwner(s);break;case 3:var s=new vt.Permission;r.readMessage(s,vt.Permission.deserializeBinaryFromReader),n.setWitness(s);break;case 4:var s=new vt.Permission;r.readMessage(s,vt.Permission.deserializeBinaryFromReader),n.addActives(s);break;default:r.skipField();break}}return n};TronWebProto.AccountPermissionUpdateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountPermissionUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountPermissionUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwner(),o!=null&&r.writeMessage(2,o,vt.Permission.serializeBinaryToWriter),o=n.getWitness(),o!=null&&r.writeMessage(3,o,vt.Permission.serializeBinaryToWriter),o=n.getActivesList(),o.length>0&&r.writeRepeatedMessage(4,o,vt.Permission.serializeBinaryToWriter)};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountPermissionUpdateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountPermissionUpdateContract.prototype.getOwner=function(){return H.Message.getWrapperField(this,vt.Permission,2)};TronWebProto.AccountPermissionUpdateContract.prototype.setOwner=function(n){return H.Message.setWrapperField(this,2,n)};TronWebProto.AccountPermissionUpdateContract.prototype.clearOwner=function(){return this.setOwner(void 0)};TronWebProto.AccountPermissionUpdateContract.prototype.hasOwner=function(){return H.Message.getField(this,2)!=null};TronWebProto.AccountPermissionUpdateContract.prototype.getWitness=function(){return H.Message.getWrapperField(this,vt.Permission,3)};TronWebProto.AccountPermissionUpdateContract.prototype.setWitness=function(n){return H.Message.setWrapperField(this,3,n)};TronWebProto.AccountPermissionUpdateContract.prototype.clearWitness=function(){return this.setWitness(void 0)};TronWebProto.AccountPermissionUpdateContract.prototype.hasWitness=function(){return H.Message.getField(this,3)!=null};TronWebProto.AccountPermissionUpdateContract.prototype.getActivesList=function(){return H.Message.getRepeatedWrapperField(this,vt.Permission,4)};TronWebProto.AccountPermissionUpdateContract.prototype.setActivesList=function(n){return H.Message.setRepeatedWrapperField(this,4,n)};TronWebProto.AccountPermissionUpdateContract.prototype.addActives=function(n,r){return H.Message.addToRepeatedWrapperField(this,4,n,TronWebProto.Permission,r)};TronWebProto.AccountPermissionUpdateContract.prototype.clearActivesList=function(){return this.setActivesList([])};Zt.object.extend(cA,TronWebProto)});var dA=Et(lA=>{var ae=gr(),Kr=ae,$s=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof $s<"u"&&$s||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();Kr.exportSymbol("TronWebProto.ProposalApproveContract",null,$s);Kr.exportSymbol("TronWebProto.ProposalCreateContract",null,$s);Kr.exportSymbol("TronWebProto.ProposalDeleteContract",null,$s);TronWebProto.ProposalApproveContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalApproveContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalApproveContract.displayName="TronWebProto.ProposalApproveContract");TronWebProto.ProposalCreateContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalCreateContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalCreateContract.displayName="TronWebProto.ProposalCreateContract");TronWebProto.ProposalDeleteContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalDeleteContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalDeleteContract.displayName="TronWebProto.ProposalDeleteContract");ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalApproveContract.prototype.toObject=function(n){return TronWebProto.ProposalApproveContract.toObject(n,this)},TronWebProto.ProposalApproveContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),proposalId:ae.Message.getFieldWithDefault(r,2,0),isAddApproval:ae.Message.getBooleanFieldWithDefault(r,3,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalApproveContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalApproveContract;return TronWebProto.ProposalApproveContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalApproveContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setProposalId(s);break;case 3:var s=r.readBool();n.setIsAddApproval(s);break;default:r.skipField();break}}return n};TronWebProto.ProposalApproveContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalApproveContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalApproveContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getProposalId(),o!==0&&r.writeInt64(2,o),o=n.getIsAddApproval(),o&&r.writeBool(3,o)};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalApproveContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalApproveContract.prototype.getProposalId=function(){return ae.Message.getFieldWithDefault(this,2,0)};TronWebProto.ProposalApproveContract.prototype.setProposalId=function(n){return ae.Message.setProto3IntField(this,2,n)};TronWebProto.ProposalApproveContract.prototype.getIsAddApproval=function(){return ae.Message.getBooleanFieldWithDefault(this,3,!1)};TronWebProto.ProposalApproveContract.prototype.setIsAddApproval=function(n){return ae.Message.setProto3BooleanField(this,3,n)};ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalCreateContract.prototype.toObject=function(n){return TronWebProto.ProposalCreateContract.toObject(n,this)},TronWebProto.ProposalCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),parametersMap:(o=r.getParametersMap())?o.toObject(n,void 0):[]};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalCreateContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalCreateContract;return TronWebProto.ProposalCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=n.getParametersMap();r.readMessage(s,function(i,a){ae.Map.deserializeBinary(i,a,ae.BinaryReader.prototype.readInt64,ae.BinaryReader.prototype.readInt64,null,0,0)});break;default:r.skipField();break}}return n};TronWebProto.ProposalCreateContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getParametersMap(!0),o&&o.getLength()>0&&o.serializeBinary(2,r,ae.BinaryWriter.prototype.writeInt64,ae.BinaryWriter.prototype.writeInt64)};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalCreateContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalCreateContract.prototype.getParametersMap=function(n){return ae.Message.getMapField(this,2,n,null)};TronWebProto.ProposalCreateContract.prototype.clearParametersMap=function(){return this.getParametersMap().clear(),this};ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalDeleteContract.prototype.toObject=function(n){return TronWebProto.ProposalDeleteContract.toObject(n,this)},TronWebProto.ProposalDeleteContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),proposalId:ae.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalDeleteContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalDeleteContract;return TronWebProto.ProposalDeleteContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalDeleteContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setProposalId(s);break;default:r.skipField();break}}return n};TronWebProto.ProposalDeleteContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalDeleteContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalDeleteContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getProposalId(),o!==0&&r.writeInt64(2,o)};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalDeleteContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalDeleteContract.prototype.getProposalId=function(){return ae.Message.getFieldWithDefault(this,2,0)};TronWebProto.ProposalDeleteContract.prototype.setProposalId=function(n){return ae.Message.setProto3IntField(this,2,n)};Kr.object.extend(lA,TronWebProto)});var AA=Et(pA=>{var x=gr(),sr=x,Jo=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Jo<"u"&&Jo||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();sr.exportSymbol("TronWebProto.ExchangeCreateContract",null,Jo);sr.exportSymbol("TronWebProto.ExchangeInjectContract",null,Jo);sr.exportSymbol("TronWebProto.ExchangeTransactionContract",null,Jo);sr.exportSymbol("TronWebProto.ExchangeWithdrawContract",null,Jo);TronWebProto.ExchangeCreateContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};sr.inherits(TronWebProto.ExchangeCreateContract,x.Message);sr.DEBUG&&!COMPILED&&(TronWebProto.ExchangeCreateContract.displayName="TronWebProto.ExchangeCreateContract");TronWebProto.ExchangeInjectContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};sr.inherits(TronWebProto.ExchangeInjectContract,x.Message);sr.DEBUG&&!COMPILED&&(TronWebProto.ExchangeInjectContract.displayName="TronWebProto.ExchangeInjectContract");TronWebProto.ExchangeWithdrawContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};sr.inherits(TronWebProto.ExchangeWithdrawContract,x.Message);sr.DEBUG&&!COMPILED&&(TronWebProto.ExchangeWithdrawContract.displayName="TronWebProto.ExchangeWithdrawContract");TronWebProto.ExchangeTransactionContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};sr.inherits(TronWebProto.ExchangeTransactionContract,x.Message);sr.DEBUG&&!COMPILED&&(TronWebProto.ExchangeTransactionContract.displayName="TronWebProto.ExchangeTransactionContract");x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeCreateContract.prototype.toObject=function(n){return TronWebProto.ExchangeCreateContract.toObject(n,this)},TronWebProto.ExchangeCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),firstTokenId:r.getFirstTokenId_asB64(),firstTokenBalance:x.Message.getFieldWithDefault(r,3,0),secondTokenId:r.getSecondTokenId_asB64(),secondTokenBalance:x.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeCreateContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeCreateContract;return TronWebProto.ExchangeCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setFirstTokenId(s);break;case 3:var s=r.readInt64();n.setFirstTokenBalance(s);break;case 4:var s=r.readBytes();n.setSecondTokenId(s);break;case 5:var s=r.readInt64();n.setSecondTokenBalance(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeCreateContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFirstTokenId_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFirstTokenBalance(),o!==0&&r.writeInt64(3,o),o=n.getSecondTokenId_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getSecondTokenBalance(),o!==0&&r.writeInt64(5,o)};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeCreateContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId=function(){return x.Message.getFieldWithDefault(this,2,"")};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId_asB64=function(){return x.Message.bytesAsB64(this.getFirstTokenId())};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId_asU8=function(){return x.Message.bytesAsU8(this.getFirstTokenId())};TronWebProto.ExchangeCreateContract.prototype.setFirstTokenId=function(n){return x.Message.setProto3BytesField(this,2,n)};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenBalance=function(){return x.Message.getFieldWithDefault(this,3,0)};TronWebProto.ExchangeCreateContract.prototype.setFirstTokenBalance=function(n){return x.Message.setProto3IntField(this,3,n)};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId=function(){return x.Message.getFieldWithDefault(this,4,"")};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId_asB64=function(){return x.Message.bytesAsB64(this.getSecondTokenId())};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId_asU8=function(){return x.Message.bytesAsU8(this.getSecondTokenId())};TronWebProto.ExchangeCreateContract.prototype.setSecondTokenId=function(n){return x.Message.setProto3BytesField(this,4,n)};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenBalance=function(){return x.Message.getFieldWithDefault(this,5,0)};TronWebProto.ExchangeCreateContract.prototype.setSecondTokenBalance=function(n){return x.Message.setProto3IntField(this,5,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeInjectContract.prototype.toObject=function(n){return TronWebProto.ExchangeInjectContract.toObject(n,this)},TronWebProto.ExchangeInjectContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeInjectContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeInjectContract;return TronWebProto.ExchangeInjectContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeInjectContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeInjectContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeInjectContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeInjectContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o)};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeInjectContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeInjectContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeInjectContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeInjectContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeInjectContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeInjectContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeInjectContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeInjectContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeInjectContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeWithdrawContract.prototype.toObject=function(n){return TronWebProto.ExchangeWithdrawContract.toObject(n,this)},TronWebProto.ExchangeWithdrawContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeWithdrawContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeWithdrawContract;return TronWebProto.ExchangeWithdrawContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeWithdrawContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeWithdrawContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeWithdrawContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeWithdrawContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o)};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeWithdrawContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeWithdrawContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeWithdrawContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeWithdrawContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeWithdrawContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeWithdrawContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeTransactionContract.prototype.toObject=function(n){return TronWebProto.ExchangeTransactionContract.toObject(n,this)},TronWebProto.ExchangeTransactionContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0),expected:x.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeTransactionContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeTransactionContract;return TronWebProto.ExchangeTransactionContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeTransactionContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;case 5:var s=r.readInt64();n.setExpected(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeTransactionContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeTransactionContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeTransactionContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o),o=n.getExpected(),o!==0&&r.writeInt64(5,o)};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeTransactionContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeTransactionContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeTransactionContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeTransactionContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeTransactionContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeTransactionContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeTransactionContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeTransactionContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeTransactionContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};TronWebProto.ExchangeTransactionContract.prototype.getExpected=function(){return x.Message.getFieldWithDefault(this,5,0)};TronWebProto.ExchangeTransactionContract.prototype.setExpected=function(n){return x.Message.setProto3IntField(this,5,n)};sr.object.extend(pA,TronWebProto)});var vu={};Lt(vu,{txCheck:()=>Zs,txCheckWithArgs:()=>aa,txJsonToPb:()=>ia,txJsonToPbWithArgs:()=>bA,txPbToRawDataHex:()=>Wu,txPbToTxID:()=>Su});var gA,xw,Dw,Nw,Uw,_w,jw,zw,Vw,Gw,Lw,fe,dh,ph,Ah,fh,mh,gh,hh,yh,hA,bh,Th,Ph,wh,fA,Ch,Bh,Wh,Sh,vh,Ih,Ho,Ko,Mh,mA,Rh,Fh,kh,Oh,Eh,xh,Dh,Nh,Uh,_h,jh,zh,re,tt,io,Vh,Ce,Gh,Lh,$h,Zh,Jh,Hh,Kh,Xh,Yh,qh,Qh,ey,ty,ry,ny,oy,sy,iy,ay,cy,uy,ly,dy,py,Ay,fy,my,gy,hy,yy,by,Ty,Py,yA,ia,bA,TA,Wu,Zs,aa,Su,Js=se(()=>{gA=ye(require("@tronweb3/google-protobuf/google/protobuf/any_pb.js"),1),xw=ye(sa(),1),Dw=ye(Qp(),1),Nw=ye(tA(),1),Uw=ye(nA(),1),_w=ye(Bu(),1),jw=ye(sA(),1),zw=ye(aA(),1),Vw=ye(uA(),1),Gw=ye(dA(),1),Lw=ye(AA(),1);Hn();er();Br();un();({Transaction:fe,Permission:dh,Key:ph}=globalThis.TronWebProto),{TransferContract:Ah,FreezeBalanceContract:fh,UnfreezeBalanceContract:mh,WithdrawBalanceContract:gh,FreezeBalanceV2Contract:hh,UnfreezeBalanceV2Contract:yh,WithdrawExpireUnfreezeContract:hA,DelegateResourceContract:bh,UnDelegateResourceContract:Th}=globalThis.TronWebProto,{TransferAssetContract:Ph,ParticipateAssetIssueContract:wh,AssetIssueContract:fA,UpdateAssetContract:Ch}=globalThis.TronWebProto,{TriggerSmartContract:Bh,ClearABIContract:Wh,UpdateEnergyLimitContract:Sh,UpdateSettingContract:vh,CreateSmartContract:Ih,SmartContract:Ho}=globalThis.TronWebProto,{ResourceCode:Ko}=globalThis.TronWebProto,{WitnessCreateContract:Mh,VoteWitnessContract:mA}=globalThis.TronWebProto,{UpdateBrokerageContract:Rh}=globalThis.TronWebProto,{AccountCreateContract:Fh,AccountUpdateContract:kh,SetAccountIdContract:Oh,AccountPermissionUpdateContract:Eh}=globalThis.TronWebProto,{ProposalCreateContract:xh,ProposalDeleteContract:Dh,ProposalApproveContract:Nh}=globalThis.TronWebProto,{ExchangeCreateContract:Uh,ExchangeInjectContract:_h,ExchangeWithdrawContract:jh,ExchangeTransactionContract:zh}=globalThis.TronWebProto,re=n=>!n||n.length===0?new Uint8Array([]):new Uint8Array(ca.address.toHex(n).match(/.{1,2}/g).map(r=>parseInt(r,16))),tt=n=>!n||n.length===0?new Uint8Array([]):new Uint8Array((cn(n)?n:ca.toHex(n)).replace(/^0x/,"").match(/.{1,2}/g).map(r=>parseInt(r,16))),io=(n,r)=>tt(r?ca.fromUtf8(n).replace(/^0x/,""):n.replace(/^0x/,"")),Vh=(n,r=!0)=>(r?"0x":"")+(0,k.keccak256)(Buffer.from(n,"utf-8")).toString().substring(2),Ce=(n,r,o,s)=>{let i=new gA.default.Any;i.pack(n.serializeBinary(),"protocol."+o);let a=new fe.Contract;a.setType(r),a.setParameter(i),s&&a.setPermissionId(s);let c=new fe.raw;c.addContract(a);let u=new fe;return u.setRawData(c),u},Gh=(n,r)=>{let{to_address:o,owner_address:s,amount:i}=n,a=new Ah;return a.setToAddress(re(o)),a.setOwnerAddress(re(s)),a.setAmount(i),Ce(a,fe.Contract.ContractType.TRANSFERCONTRACT,"TransferContract",r.Permission_id)},Lh=(n,r)=>{let{to_address:o,owner_address:s,amount:i,asset_name:a}=n,c=new Ph;return c.setToAddress(re(o)),c.setOwnerAddress(re(s)),c.setAssetName(io(a,r.visible)),c.setAmount(i),Ce(c,fe.Contract.ContractType.TRANSFERASSETCONTRACT,"TransferAssetContract",r.Permission_id)},$h=(n,r)=>{let o=new wh;return o.setToAddress(re(n.to_address)),o.setOwnerAddress(re(n.owner_address)),o.setAssetName(io(n.asset_name,r.visible)),o.setAmount(n.amount),Ce(o,fe.Contract.ContractType.PARTICIPATEASSETISSUECONTRACT,"ParticipateAssetIssueContract",r.Permission_id)},Zh=(n,r)=>{let o=new Bh,{owner_address:s,contract_address:i,parameter:a="",function_selector:c,call_value:u,call_token_value:l,token_id:p,data:A}=n;if(o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setCallValue(u),A)o.setData(tt(A));else if(c){let g=Vh(c).substring(2,10)+a;o.setData(tt(g))}return p&&o.setTokenId(p),l&&o.setCallTokenValue(l),Ce(o,fe.Contract.ContractType.TRIGGERSMARTCONTRACT,"TriggerSmartContract",r.Permission_id)},Jh=(n,r)=>{let o=new fh,{owner_address:s,frozen_balance:i,frozen_duration:a,resource:c,receiver_address:u}=n;return o.setOwnerAddress(re(s)),o.setFrozenBalance(i),o.setFrozenDuration(a),c&&o.setResource(Ko[c]),u&&o.setReceiverAddress(re(u)),Ce(o,fe.Contract.ContractType.FREEZEBALANCECONTRACT,"FreezeBalanceContract",r.Permission_id)},Hh=(n,r)=>{let o=new mh,{owner_address:s,resource:i,receiver_address:a}=n;return o.setOwnerAddress(re(s)),i&&o.setResource(Ko[i]),a&&o.setReceiverAddress(re(a)),Ce(o,fe.Contract.ContractType.UNFREEZEBALANCECONTRACT,"UnfreezeBalanceContract",r.Permission_id)},Kh=(n,r)=>{let o=new gh,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Ce(o,fe.Contract.ContractType.WITHDRAWBALANCECONTRACT,"WithdrawBalanceContract",r.Permission_id)},Xh=(n,r)=>{let o=new hh,{owner_address:s,frozen_balance:i,resource:a}=n;return o.setOwnerAddress(re(s)),o.setFrozenBalance(i),o.setResource(Ko[a]),Ce(o,fe.Contract.ContractType.FREEZEBALANCEV2CONTRACT,"FreezeBalanceV2Contract",r.Permission_id)},Yh=(n,r)=>{let o=new hA,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Ce(o,fe.Contract.ContractType.CANCELALLUNFREEZEV2CONTRACT,"CancelAllUnfreezeV2Contract",r.Permission_id)},qh=(n,r)=>{let o=new yh,{owner_address:s,unfreeze_balance:i,resource:a}=n;return o.setOwnerAddress(re(s)),o.setUnfreezeBalance(i),o.setResource(Ko[a]),Ce(o,fe.Contract.ContractType.UNFREEZEBALANCEV2CONTRACT,"UnfreezeBalanceV2Contract",r.Permission_id)},Qh=(n,r)=>{let o=new bh,{owner_address:s,receiver_address:i,balance:a,resource:c,lock:u=!1,lock_period:l}=n;return o.setOwnerAddress(re(s)),o.setBalance(a),o.setResource(Ko[c]),o.setLock(u),o.setLockPeriod(l),o.setReceiverAddress(re(i)),Ce(o,fe.Contract.ContractType.DELEGATERESOURCECONTRACT,"DelegateResourceContract",r.Permission_id)},ey=(n,r)=>{let o=new Th,{owner_address:s,receiver_address:i,balance:a,resource:c}=n;return o.setOwnerAddress(re(s)),o.setBalance(a),o.setResource(Ko[c]),o.setReceiverAddress(re(i)),Ce(o,fe.Contract.ContractType.UNDELEGATERESOURCECONTRACT,"UnDelegateResourceContract",r.Permission_id)},ty=(n,r)=>{let o=new hA,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Ce(o,fe.Contract.ContractType.WITHDRAWEXPIREUNFREEZECONTRACT,"WithdrawExpireUnfreezeContract",r.Permission_id)},ry=(n,r)=>{let o=new Mh,{owner_address:s,url:i}=n;return o.setOwnerAddress(re(s)),o.setUrl(tt(i.replace(/^0x/,""))),Ce(o,fe.Contract.ContractType.WITNESSCREATECONTRACT,"WitnessCreateContract",r.Permission_id)},ny=(n,r)=>{let o=new mA,{owner_address:s,votes:i}=n;return o.setOwnerAddress(re(s)),i.forEach(a=>{let c=new mA.Vote,{vote_address:u,vote_count:l}=a;c.setVoteAddress(re(u));let p=parseInt(l);c.setVoteCount(p),o.addVotes(c)}),Ce(o,fe.Contract.ContractType.VOTEWITNESSCONTRACT,"VoteWitnessContract",r.Permission_id)},oy=(n,r)=>{let o=n?.new_contract?{owner_address:n.owner_address,call_token_value:n.call_token_value,token_id:n.token_id,...n.new_contract}:n,{owner_address:s,consume_user_resource_percent:i,origin_energy_limit:a,abi:c,bytecode:u="",parameter:l="",call_value:p,call_token_value:A,token_id:g,name:P}=o,{origin_address:b}=o,W=new Ih;W.setOwnerAddress(re(s)),g&&W.setTokenId(g),A&&W.setCallTokenValue(A);let S=new Ho;if(c){let F;typeof c=="string"?F=JSON.parse(c):F=c?.entrys||[];let U=new Ho.ABI,V=X=>{let de=new Ho.ABI.Entry.Param,{indexed:oe,name:ot,type:xe}=X;return oe===!0&&de.setIndexed(!0),de.setName(ot),de.setType(xe),de},L=F.map(X=>{let{anonymous:de,constant:oe,name:ot,inputs:xe,outputs:Ve,type:dt,payable:Vt,stateMutability:pt}=X,Ie=new Ho.ABI.Entry;return Ie.setAnonymous(de),Ie.setConstant(oe),Ie.setName(ot),xe&&Ie.setInputsList(xe.map(De=>V(De))),Ve&&Ie.setOutputsList(Ve.map(De=>V(De))),dt&&Ie.setType(Ho.ABI.Entry.EntryType[dt.toUpperCase()]),Ie.setPayable(Vt),pt&&Ie.setStatemutability(Ho.ABI.Entry.StateMutabilityType[pt.toUpperCase()]),Ie});U.setEntrysList(L),S.setAbi(U)}if(p&&S.setCallValue(p),S.setConsumeUserResourcePercent(i),S.setOriginEnergyLimit(a),b||(b=s),S.setOriginAddress(re(b)),u){let F=u.replace(/^0x/,"")+l.replace(/^0x/,"");S.setBytecode(tt(F))}return S.setName(P),W.setNewContract(S),Ce(W,fe.Contract.ContractType.CREATESMARTCONTRACT,"CreateSmartContract",r.Permission_id)},sy=(n,r)=>{let{contract_address:o,owner_address:s}=n,i=new Wh;return i.setOwnerAddress(re(s)),i.setContractAddress(re(o)),Ce(i,fe.Contract.ContractType.CLEARABICONTRACT,"ClearABIContract",r.Permission_id)},iy=(n,r)=>{let{brokerage:o,owner_address:s}=n,i=new Rh;return i.setOwnerAddress(re(s)),i.setBrokerage(o),Ce(i,fe.Contract.ContractType.UPDATEBROKERAGECONTRACT,"UpdateBrokerageContract",r.Permission_id)},ay=(n,r)=>{let{owner_address:o,name:s,abbr:i,description:a,url:c,total_supply:u,trx_num:l,num:p,start_time:A,end_time:g,precision:P,free_asset_net_limit:b,public_free_asset_net_limit:W,public_free_asset_net_usage:S=0,public_latest_free_net_time:F=0,vote_score:U=0,frozen_supply:V}=n,L=new fA;if(L.setOwnerAddress(re(o)),s&&L.setName(tt(s.replace(/^0x/,""))),i&&L.setAbbr(tt(i.replace(/^0x/,""))),L.setTotalSupply(u),L.setNum(p),L.setEndTime(g),L.setStartTime(A),L.setTrxNum(l),L.setVoteScore(U),P&&L.setPrecision(P),F&&L.setPublicLatestFreeNetTime(F),a&&L.setDescription(tt(a.replace(/^0x/,""))),c&&L.setUrl(tt(c.replace(/^0x/,""))),L.setPublicFreeAssetNetUsage(S),L.setFreeAssetNetLimit(b),L.setPublicFreeAssetNetLimit(W),V){let X=new fA.FrozenSupply;X.setFrozenAmount(V.length?V[0].frozen_amount:V.frozen_amount),X.setFrozenDays(V.length?V[0].frozen_days:V.frozen_days),L.addFrozenSupply(X)}return Ce(L,fe.Contract.ContractType.ASSETISSUECONTRACT,"AssetIssueContract",r.Permission_id)},cy=(n,r)=>{let o=new Fh,{account_address:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountAddress(re(s.replace(/^0x/,""))),Ce(o,fe.Contract.ContractType.ACCOUNTCREATECONTRACT,"AccountCreateContract",r.Permission_id)},uy=(n,r)=>{let o=new kh,{account_name:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountName(tt(s.replace(/^0x/,""))),Ce(o,fe.Contract.ContractType.ACCOUNTUPDATECONTRACT,"AccountUpdateContract",r.Permission_id)},ly=(n,r)=>{let o=new Oh,{account_id:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountId(tt(s.replace(/^0x/,""))),Ce(o,fe.Contract.ContractType.SETACCOUNTIDCONTRACT,"SetAccountIdContract",r.Permission_id)},dy=(n,r)=>{let o=new xh,{owner_address:s,parameters:i}=n;return o.setOwnerAddress(re(s)),i.forEach(a=>{o.getParametersMap().set(a.key,a.value)}),Ce(o,fe.Contract.ContractType.PROPOSALCREATECONTRACT,"ProposalCreateContract",r.Permission_id)},py=(n,r)=>{let o=new Dh,{owner_address:s,proposal_id:i}=n;return o.setOwnerAddress(re(s)),o.setProposalId(i),Ce(o,fe.Contract.ContractType.PROPOSALDELETECONTRACT,"ProposalDeleteContract",r.Permission_id)},Ay=(n,r)=>{let o=new Nh,{owner_address:s,proposal_id:i,is_add_approval:a}=n;return o.setOwnerAddress(re(s)),o.setProposalId(i),o.setIsAddApproval(a),Ce(o,fe.Contract.ContractType.PROPOSALAPPROVECONTRACT,"ProposalApproveContract",r.Permission_id)},fy=(n,r)=>{let o=new Uh,{owner_address:s,first_token_id:i,first_token_balance:a,second_token_id:c,second_token_balance:u}=n;return o.setOwnerAddress(re(s)),o.setFirstTokenId(io(i,r.visible)),o.setFirstTokenBalance(a),o.setSecondTokenId(io(c,r.visible)),o.setSecondTokenBalance(u),Ce(o,fe.Contract.ContractType.EXCHANGECREATECONTRACT,"ExchangeCreateContract",r.Permission_id)},my=(n,r)=>{let o=new _h,{owner_address:s,exchange_id:i,token_id:a,quant:c}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(io(a,r.visible)),o.setQuant(c),Ce(o,fe.Contract.ContractType.EXCHANGEINJECTCONTRACT,"ExchangeInjectContract",r.Permission_id)},gy=(n,r)=>{let o=new jh,{owner_address:s,exchange_id:i,token_id:a,quant:c}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(io(a,r.visible)),o.setQuant(c),Ce(o,fe.Contract.ContractType.EXCHANGEWITHDRAWCONTRACT,"ExchangeWithdrawContract",r.Permission_id)},hy=(n,r)=>{let o=new zh,{owner_address:s,exchange_id:i,token_id:a,quant:c,expected:u}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(io(a,r.visible)),o.setQuant(c),o.setExpected(u),Ce(o,fe.Contract.ContractType.EXCHANGETRANSACTIONCONTRACT,"ExchangeTransactionContract",r.Permission_id)},yy=(n,r)=>{let o=new vh,{owner_address:s,contract_address:i,consume_user_resource_percent:a}=n;return o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setConsumeUserResourcePercent(a),Ce(o,fe.Contract.ContractType.UPDATESETTINGCONTRACT,"UpdateSettingContract",r.Permission_id)},by=(n,r)=>{let o=new Sh,{owner_address:s,contract_address:i,origin_energy_limit:a}=n;return o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setOriginEnergyLimit(a),Ce(o,fe.Contract.ContractType.UPDATEENERGYLIMITCONTRACT,"UpdateEnergyLimitContract",r.Permission_id)},Ty=(n,r)=>{let o=new Eh,{owner_address:s,owner:i,witness:a,actives:c}=n;o.setOwnerAddress(re(s));let u=p=>isNaN(p)?p==="Active"?2:p==="Witness"?1:0:p,l=p=>{let A=new dh,{type:g,id:P,permission_name:b,threshold:W,parentId:S,operations:F,keys:U}=p;return A.setType(u(g)),A.setId(P),A.setPermissionName(b),A.setThreshold(W),S&&A.setParentId(S),F&&A.setOperations(tt(F)),U&&A.setKeysList(U.map(V=>{let L=new ph;return L.setAddress(re(V.address)),L.setWeight(V.weight),L})),A};return i&&o.setOwner(l(i)),a&&o.setWitness(l(a)),c&&(Array.isArray(c)?o.setActivesList(c.map(p=>l(p))):o.setActivesList([l(c)])),Ce(o,fe.Contract.ContractType.ACCOUNTPERMISSIONUPDATECONTRACT,"AccountPermissionUpdateContract",r.Permission_id)},Py=(n,r)=>{let o=new Ch,{owner_address:s,description:i,url:a,new_limit:c,new_public_limit:u}=n;return o.setOwnerAddress(re(s)),i&&o.setDescription(tt(i.replace(/^0x/,""))),a&&o.setUrl(tt(a.replace(/^0x/,""))),c&&o.setNewLimit(c),u&&o.setNewPublicLimit(u),Ce(o,fe.Contract.ContractType.UPDATEASSETCONTRACT,"UpdateAssetContract",r.Permission_id)},yA=(n,r,o)=>{switch(n.type){case"TransferContract":return Gh(r,o);case"TransferAssetContract":return Lh(r,o);case"ParticipateAssetIssueContract":return $h(r,o);case"TriggerSmartContract":return Zh(r,o);case"FreezeBalanceContract":return Jh(r,o);case"UnfreezeBalanceContract":return Hh(r,o);case"WithdrawBalanceContract":return Kh(r,o);case"FreezeBalanceV2Contract":return Xh(r,o);case"CancelAllUnfreezeV2Contract":return Yh(r,o);case"UnfreezeBalanceV2Contract":return qh(r,o);case"DelegateResourceContract":return Qh(r,o);case"UnDelegateResourceContract":return ey(r,o);case"WithdrawExpireUnfreezeContract":return ty(r,o);case"WitnessCreateContract":return ry(r,o);case"VoteWitnessContract":return ny(r,o);case"CreateSmartContract":return oy(r,o);case"ClearABIContract":return sy(r,o);case"UpdateBrokerageContract":return iy(r,o);case"AssetIssueContract":return ay(r,o);case"AccountCreateContract":return cy(r,o);case"AccountUpdateContract":return uy(r,o);case"SetAccountIdContract":return ly(r,o);case"ProposalCreateContract":return dy(r,o);case"ProposalDeleteContract":return py(r,o);case"ProposalApproveContract":return Ay(r,o);case"ExchangeCreateContract":return fy(r,o);case"ExchangeInjectContract":return my(r,o);case"ExchangeWithdrawContract":return gy(r,o);case"ExchangeTransactionContract":return hy(r,o);case"UpdateSettingContract":return yy(r,o);case"UpdateEnergyLimitContract":return by(r,o);case"AccountPermissionUpdateContract":return Ty(r,o);case"UpdateAssetContract":return Py(r,o)}},ia=n=>{let r=n.raw_data,o=r.contract[0],s=o.parameter.value,i={Permission_id:o.Permission_id,visible:n.visible},a=yA(o,s,i),c=a.getRawData();return c.setRefBlockBytes(tt(r.ref_block_bytes)),c.setRefBlockHash(tt(r.ref_block_hash)),r.data&&c.setData(tt(r.data)),r.fee_limit&&c.setFeeLimit(r.fee_limit),r.expiration&&c.setExpiration(r.expiration),r.timestamp&&c.setTimestamp(r.timestamp),a.setRawData(c),a},bA=(n,r={},o={})=>{let s=n.raw_data,i=s.contract[0],a=yA(i,r,{Permission_id:r?.Permission_id}),c=a.getRawData();return c.setRefBlockBytes(tt(s.ref_block_bytes)),c.setRefBlockHash(tt(s.ref_block_hash)),o.data&&c.setData(tt(o.data.replace(/^0x/,""))),(o.fee_limit||r.fee_limit)&&c.setFeeLimit(o.fee_limit||r.fee_limit),s.expiration&&c.setExpiration(s.expiration),s.timestamp&&c.setTimestamp(s.timestamp),a.setRawData(c),a},TA=(n,r)=>{let o=r.getRawData().serializeBinary(),s=it(o),i=(0,k.sha256)(o);return s.toLowerCase()===n.raw_data_hex.toLowerCase()&&i.replace(/^0x/,"").toLowerCase()===n.txID.replace(/^0x/,"").toLowerCase()},Wu=n=>it(n.getRawData().serializeBinary()),Zs=n=>{let r=ia(n);return TA(n,r)},aa=(n,r,o)=>{let s=bA(n,r,o);return TA(n,s)},Su=n=>{let r=n.getRawData().serializeBinary();return(0,k.sha256)(r)}});function It(n){return ie.fromUtf8(n).replace(/^0x/,"")}function ua(n){return JSON.parse(JSON.stringify(n))}function PA(n,r,o){if(n.Error)throw new Error(n.Error);if(n.result&&n.result.message)throw new Error(ie.toUtf8(n.result.message));if(aa(n,r,o))return n;throw new Error("Invalid transaction")}function wA(n,r,o){if(n.Error)throw new Error(n.Error);if(n.result&&n.result.message)throw new Error(ie.toUtf8(n.result.message));if(!(o._isConstant||o.estimateEnergy)){if(aa(n.transaction,r,o))return n;throw new Error("Invalid transaction")}return n}function CA(n,r){return"41"+(0,k.keccak256)(Buffer.from(r+n,"hex")).toString().substring(2).slice(24)}function wy(n){return n.request("wallet/getblock",{detail:!1},"post").then(r=>({ref_block_bytes:r.block_header.raw_data.number.toString(16).slice(-4).padStart(4,"0"),ref_block_hash:r.blockID.slice(16,32),expiration:r.block_header.raw_data.timestamp+60*1e3,timestamp:r.block_header.raw_data.timestamp}))}function BA(n={}){if(typeof n.ref_block_bytes>"u"&&typeof n.ref_block_hash>"u"&&typeof n.expiration>"u"&&typeof n.timestamp>"u")return!1;if(typeof n.ref_block_bytes!="string")throw new Error("Invalid ref_block_bytes provided.");if(typeof n.ref_block_hash!="string")throw new Error("Invalid ref_block_hash provided.");if(typeof n.expiration!="number")throw new Error("Invalid expiration provided.");if(typeof n.timestamp!="number")throw new Error("Invalid timestamp provided.");return!0}async function me(n,r,o,s,i={}){let a={visible:!1,txID:"",raw_data_hex:"",raw_data:{contract:[{parameter:{value:o,type_url:`type.googleapis.com/protocol.${r}`},type:r}],...BA(i)?{}:await wy(n.fullNode),...i}};s&&(a.raw_data.contract[0].Permission_id=s);let c=ia(a);return a.txID=Su(c).replace(/^0x/,""),a.raw_data_hex=Wu(c).toLowerCase(),a}function be(n={}){let r={};return BA(n.blockHeader)&&(r.ref_block_bytes=n.blockHeader.ref_block_bytes,r.ref_block_hash=n.blockHeader.ref_block_hash,r.expiration=n.blockHeader.expiration,r.timestamp=n.blockHeader.timestamp),r}var WA=se(()=>{Br();Js();er()});var ao,Iu=se(()=>{Br();er();Qt();ks();au();un();lu();WA();ao=class{tronWeb;validator;constructor(r){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.validator=new Uo}async sendTrx(r,o=0,s=this.tronWeb.defaultAddress.hex,i={}){o=parseInt(o),this.validator.notValid([{name:"recipient",type:"address",value:r},{name:"origin",type:"address",value:s},{names:["recipient","origin"],type:"notEqual",msg:"Cannot transfer TRX to the same account"},{name:"amount",type:"integer",gt:0,value:o}]);let a={to_address:$(r),owner_address:$(s),amount:o},c=be(i);return me(this.tronWeb,pe.TransferContract,a,i?.permissionId,c)}async sendToken(r,o=0,s,i=this.tronWeb.defaultAddress.hex,a={}){o=parseInt(o),this.validator.notValid([{name:"recipient",type:"address",value:r},{name:"origin",type:"address",value:i},{names:["recipient","origin"],type:"notEqual",msg:"Cannot transfer tokens to the same account"},{name:"amount",type:"integer",gt:0,value:o},{name:"token ID",type:"tokenId",value:s}]);let c={to_address:$(r),owner_address:$(i),asset_name:It(s),amount:o},u=be(a);return me(this.tronWeb,pe.TransferAssetContract,c,a?.permissionId,u)}async purchaseToken(r,o,s=0,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"buyer",type:"address",value:i},{name:"issuer",type:"address",value:r},{names:["buyer","issuer"],type:"notEqual",msg:"Cannot purchase tokens from same account"},{name:"amount",type:"integer",gt:0,value:s},{name:"token ID",type:"tokenId",value:o}]);let c={to_address:$(r),owner_address:$(i),asset_name:It(o),amount:parseInt(s)},u=be(a);return me(this.tronWeb,pe.ParticipateAssetIssueContract,c,a?.permissionId,u)}async freezeBalance(r=0,o=3,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a,c={}){this.validator.notValid([{name:"origin",type:"address",value:i},{name:"receiver",type:"address",value:a,optional:!0},{name:"amount",type:"integer",gt:0,value:r},{name:"duration",type:"integer",gte:3,value:o},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let u={owner_address:$(i),frozen_balance:parseInt(r),frozen_duration:parseInt(String(o))};s!=="BANDWIDTH"&&(u.resource=s),yt(a)&&$(a)!==$(i)&&(u.receiver_address=$(a));let l=be(c);return me(this.tronWeb,pe.FreezeBalanceContract,u,c?.permissionId,l)}async unfreezeBalance(r="BANDWIDTH",o=this.tronWeb.defaultAddress.hex,s,i={}){this.validator.notValid([{name:"origin",type:"address",value:o},{name:"receiver",type:"address",value:s,optional:!0},{name:"resource",type:"resource",value:r,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:$(o)};r!=="BANDWIDTH"&&(a.resource=r),yt(s)&&$(s)!==$(o)&&(a.receiver_address=$(s));let c=be(i);return me(this.tronWeb,pe.UnfreezeBalanceContract,a,i?.permissionId,c)}async freezeBalanceV2(r=0,o="BANDWIDTH",s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"origin",type:"address",value:s},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:$(s),frozen_balance:parseInt(r)};o!=="BANDWIDTH"&&(a.resource=o);let c=be(i);return me(this.tronWeb,pe.FreezeBalanceV2Contract,a,i?.permissionId,c)}async unfreezeBalanceV2(r=0,o="BANDWIDTH",s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"origin",type:"address",value:s},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:$(s),unfreeze_balance:parseInt(r)};o!=="BANDWIDTH"&&(a.resource=o);let c=be(i);return me(this.tronWeb,pe.UnfreezeBalanceV2Contract,a,i?.permissionId,c)}async cancelUnfreezeBalanceV2(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:$(r)},i=be(o);return me(this.tronWeb,pe.CancelAllUnfreezeV2Contract,s,o?.permissionId,i)}async delegateResource(r=0,o,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a=!1,c,u={}){if(this.validator.notValid([{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'},{name:"receiver",type:"address",value:o},{name:"origin",type:"address",value:i},{name:"lock",type:"boolean",value:a},{name:"lock period",type:"integer",gte:0,value:c,optional:!0}]),$(o)===$(i))throw new Error("Receiver address must not be the same as owner address");let l={owner_address:$(i),receiver_address:$(o),balance:parseInt(r)};s!=="BANDWIDTH"&&(l.resource=s),a&&(l.lock=a,yt(c)&&(l.lock_period=c));let p=be(u);return me(this.tronWeb,pe.DelegateResourceContract,l,u?.permissionId,p)}async undelegateResource(r=0,o,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a={}){if(this.validator.notValid([{name:"origin",type:"address",value:i},{name:"receiver",type:"address",value:o},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]),$(o)===$(i))throw new Error("Receiver address must not be the same as owner address");let c={owner_address:$(i),receiver_address:$(o),balance:parseInt(r)};s!=="BANDWIDTH"&&(c.resource=s);let u=be(a);return me(this.tronWeb,pe.UnDelegateResourceContract,c,a?.permissionId,u)}async withdrawExpireUnfreeze(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:$(r)},i=be(o);return me(this.tronWeb,pe.WithdrawExpireUnfreezeContract,s,o?.permissionId,i)}async withdrawBlockRewards(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:$(r)},i=be(o);return me(this.tronWeb,pe.WithdrawBalanceContract,s,o?.permissionId,i)}async applyForSR(r=this.tronWeb.defaultAddress.hex,o="",s={}){this.validator.notValid([{name:"origin",type:"address",value:r},{name:"url",type:"url",value:o,msg:"Invalid url provided"},{name:"url",type:"string",value:o,lte:256,msg:"Invalid url provided"}]);let i={owner_address:$(r),url:It(o)},a=be(s);return me(this.tronWeb,pe.WitnessCreateContract,i,s?.permissionId,a)}async vote(r={},o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"voter",type:"address",value:o},{name:"votes",type:"notEmptyObject",value:r}]);let i=Object.entries(r);for(let[l,p]of i)this.validator.notValid([{name:"SR",type:"address",value:l},{name:"vote count",type:"integer",gt:0,value:p,msg:"Invalid vote count provided for SR: "+l}]);let a=i.map(([l,p])=>({vote_address:$(l),vote_count:parseInt(p)})),c={owner_address:$(o),votes:a},u=be(s);return me(this.tronWeb,pe.VoteWitnessContract,c,s?.permissionId,u)}async createSmartContract(r={},o=this.tronWeb.defaultAddress.hex){let s=r.feeLimit||this.tronWeb.feeLimit,i=r.userFeePercentage;typeof i!="number"&&!i&&(i=100);let a=r.originEnergyLimit||1e7,c=r.callValue||0,u=r.tokenValue,l=r.tokenId||r.token_id,{abi:p}=r,{parameters:A=[]}=r,g="",{bytecode:P=!1,name:b=""}=r;if(p&&at(p))try{p=JSON.parse(p)}catch{throw new Error("Invalid options.abi provided")}let W=p,S=W;if(W.entrys&&(S=W.entrys),!Kn(S))throw new Error("Invalid options.abi provided");let F=S.some(Ve=>Ve.type==="constructor"&&Ve.stateMutability.toLowerCase()==="payable");if(this.validator.notValid([{name:"bytecode",type:"hex",value:P},{name:"feeLimit",type:"integer",value:s,gt:0},{name:"callValue",type:"integer",value:c,gte:0},{name:"userFeePercentage",type:"integer",value:i,gte:0,lte:100},{name:"originEnergyLimit",type:"integer",value:a,gte:0,lte:1e7},{name:"parameters",type:"array",value:A},{name:"issuer",type:"address",value:o},{name:"tokenValue",type:"integer",value:u,gte:0,optional:!0},{name:"tokenId",type:"integer",value:l,gte:0,optional:!0}]),!F&&(c>0||u>0))throw new Error("When contract is not payable, options.callValue and options.tokenValue must be 0");let{rawParameter:U,funcABIV2:V,parametersV2:L}=r;if(U&&at(U))g=U.replace(/^(0x)/,"");else if(V)g=No(V,L).replace(/^(0x)/,"");else{let Ve=S.find(dt=>dt.type==="constructor");if(typeof Ve<"u"&&Ve){let dt=new k.AbiCoder,Vt=[],pt=[];if(Ve=Ve.inputs,A.length!=Ve.length)throw new Error(`constructor needs ${Ve.length} but ${A.length} provided`);for(let Ie=0;Ie<A.length;Ie++){let De=Ve[Ie].type,At=A[Ie];if(!De||!at(De)||!De.length)throw new Error("Invalid parameter type provided: "+De);let ft=Gt=>Kn(Gt)?Gt.map(Ar=>ft(Ar)):$(Gt).replace(pn,"0x");De==="address"||De.match(/^([^\x5b]*)(\x5b|$)/)?.[0]==="address["?At=ft(At):/trcToken/.test(De)&&(De=De.replace(/trcToken/,"uint256")),Vt.push(De),pt.push(At)}try{g=dt.encode(Vt,pt).replace(/^(0x)/,"")}catch(Ie){throw new Error(Ie)}}else g=""}let X={owner_address:$(o),fee_limit:parseInt(s),call_value:parseInt(c),consume_user_resource_percent:i,origin_energy_limit:a,abi:JSON.stringify(p),bytecode:P,parameter:g,name:b};yt(u)&&(X.call_token_value=parseInt(u)),yt(l)&&(X.token_id=parseInt(l));let de={};de.owner_address=X.owner_address,yt(X.call_token_value)&&(de.call_token_value=X.call_token_value),yt(X.token_id)&&(de.token_id=X.token_id);let oe=de.new_contract={};X.abi?oe.abi={entrys:JSON.parse(X.abi)}:oe.abi={},X.call_value&&(oe.call_value=X.call_value),oe.consume_user_resource_percent=X.consume_user_resource_percent,oe.origin_energy_limit=X.origin_energy_limit,oe.origin_address=X.origin_address??X.owner_address,X.bytecode+X.parameter&&(oe.bytecode=(X.bytecode+X.parameter).replace(/^0x/,"")),yt(X.name)&&(oe.name=X.name);let ot=be(r),xe=await me(this.tronWeb,pe.CreateSmartContract,de,r?.permissionId,{...ot,fee_limit:X.fee_limit});return xe.contract_address=CA(X.owner_address,xe.txID),xe}async triggerSmartContract(r,o,s,i,a){let c=[r,o,s,i,a];return typeof c[2]!="object"&&(c[2]={feeLimit:c[2],callValue:c[3]},c.splice(3,1)),c[2]?.txLocal?this._triggerSmartContractLocal(...c):this._triggerSmartContract(...c)}async triggerConstantContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s._isConstant=!0,this._triggerSmartContract(r,o,s,i,a)}async triggerConfirmedConstantContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s._isConstant=!0,s.confirmed=!0,this._triggerSmartContract(r,o,s,i,a)}async estimateEnergy(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s.estimateEnergy=!0,await this._triggerSmartContract(r,o,s,i,a)}async deployConstantContract(r={input:"",ownerAddress:""}){let{input:o,ownerAddress:s,tokenId:i,tokenValue:a,callValue:c=0}=r;this.validator.notValid([{name:"input",type:"not-empty-string",value:o},{name:"callValue",type:"integer",value:c,gte:0},{name:"owner",type:"address",value:s},{name:"tokenValue",type:"integer",value:a,gte:0,optional:!0},{name:"tokenId",type:"integer",value:i,gte:0,optional:!0}]);let u={data:o,owner_address:$(s),call_value:c};i&&(u.token_id=i),a&&(u.call_token_value=a);let l=`wallet${r.confirmed?"solidity":""}/estimateenergy`,p=await this.tronWeb[r.confirmed?"solidityNode":"fullNode"].request(l,u,"post");if(p.Error)throw new Error(p.Error);if(p.result&&p.result.message)throw new Error(this.tronWeb.toUtf8(p.result.message));return p}_getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p){let A={contract_address:$(r),owner_address:$(a)};if(o&&at(o)){o=o.replace(/\s*/g,"");let g;if(i.length){let P=new k.AbiCoder,b=[],W=[];for(let S=0;S<i.length;S++){let{value:F}=i[S],{type:U}=i[S];if(!U||!at(U)||!U.length)throw new Error("Invalid parameter type provided: "+U);let V=L=>Kn(L)?L.map(X=>V(X)):$(L).replace(pn,"0x");(U==="address"||U.match(/^([^\x5b]*)(\x5b|$)/)?.[0]==="address[")&&(F=V(F)),b.push(U),W.push(F)}try{b=b.map(S=>(/trcToken/.test(S)&&(S=S.replace(/trcToken/,"uint256")),S)),g=P.encode(b,W).replace(/^(0x)/,"")}catch(S){throw new Error(S)}}else g="";s.funcABIV2&&(g=No(s.funcABIV2,s.parametersV2).replace(/^(0x)/,"")),s.shieldedParameter&&at(s.shieldedParameter)&&(g=s.shieldedParameter.replace(/^(0x)/,"")),s.rawParameter&&at(s.rawParameter)&&(g=s.rawParameter.replace(/^(0x)/,"")),A.function_selector=o,A.parameter=g}else s.input&&(A.data=s.input);return A.call_value=parseInt(l),yt(c)&&(A.call_token_value=parseInt(c)),yt(u)&&(A.token_id=parseInt(u)),s._isConstant||s.estimateEnergy||(A.fee_limit=parseInt(p)),s.permissionId&&(A.Permission_id=s.permissionId),A}async _triggerSmartContractLocal(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){let{tokenValue:c,tokenId:u,callValue:l,feeLimit:p}=Object.assign({callValue:0,feeLimit:this.tronWeb.feeLimit},s);this.validator.notValid([{name:"feeLimit",type:"integer",value:p,gt:0},{name:"callValue",type:"integer",value:l,gte:0},{name:"parameters",type:"array",value:i},{name:"contract",type:"address",value:r},{name:"issuer",type:"address",value:a,optional:!0},{name:"tokenValue",type:"integer",value:c,gte:0,optional:!0},{name:"tokenId",type:"integer",value:u,gte:0,optional:!0}]);let A=this._getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p);A.function_selector&&(A.data=(0,k.keccak256)(Buffer.from(A.function_selector,"utf-8")).toString().substring(2,10)+A.parameter);let g={data:A.data,owner_address:A.owner_address,contract_address:A.contract_address};A.call_value&&(g.call_value=A.call_value),A.call_token_value&&(g.call_token_value=A.call_token_value),A.token_id&&(g.token_id=A.token_id);let P=be(s),b=await me(this.tronWeb,pe.TriggerSmartContract,g,s.permissionId,{...P,fee_limit:A.fee_limit});return{result:{result:!0},transaction:b}}async _triggerSmartContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){let{tokenValue:c,tokenId:u,callValue:l,feeLimit:p}=Object.assign({callValue:0,feeLimit:this.tronWeb.feeLimit},s);this.validator.notValid([{name:"feeLimit",type:"integer",value:p,gt:0},{name:"callValue",type:"integer",value:l,gte:0},{name:"parameters",type:"array",value:i},{name:"contract",type:"address",value:r},{name:"issuer",type:"address",value:a,optional:!0},{name:"tokenValue",type:"integer",value:c,gte:0,optional:!0},{name:"tokenId",type:"integer",value:u,gte:0,optional:!0}]);let A=this._getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p),g="triggersmartcontract";s._isConstant?g="triggerconstantcontract":s.estimateEnergy&&(g="estimateenergy"),g=`wallet${s.confirmed?"solidity":""}/${g}`;let P=await this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(g,A,"post");return wA(P,A,s)}async clearABI(r,o=this.tronWeb.defaultAddress.hex,s={}){if(!ie.isAddress(r))throw new Error("Invalid contract address provided");if(!ie.isAddress(o))throw new Error("Invalid owner address provided");let i={contract_address:$(r),owner_address:$(o)};this.tronWeb.trx.cache.contracts[r]&&delete this.tronWeb.trx.cache.contracts[r];let a=be(s);return me(this.tronWeb,pe.ClearABIContract,i,s?.permissionId,a)}async updateBrokerage(r,o=this.tronWeb.defaultAddress.hex,s={}){if(!yt(r))throw new Error("Invalid brokerage provided");if(!Hr(r)||r<0||r>100)throw new Error("Brokerage must be an integer between 0 and 100");if(!ie.isAddress(o))throw new Error("Invalid owner address provided");let i={brokerage:parseInt(r),owner_address:$(o)},a=be(s);return me(this.tronWeb,pe.UpdateBrokerageContract,i,s?.permissionId,a)}async createToken(r={},o=this.tronWeb.defaultAddress.hex){let{name:s=!1,abbreviation:i=!1,description:a="",url:c=!1,totalSupply:u=0,trxRatio:l=1,tokenRatio:p=1,saleStart:A=Date.now(),saleEnd:g=!1,freeBandwidth:P=0,freeBandwidthLimit:b=0,frozenAmount:W=0,frozenDuration:S=0,voteScore:F,precision:U}=r;if(this.validator.notValid([{name:"Supply amount",type:"positive-integer",value:u},{name:"TRX ratio",type:"positive-integer",value:l},{name:"Token ratio",type:"positive-integer",value:p},{name:"token abbreviation",type:"string",value:i,lte:32,gt:0},{name:"token name",type:"not-empty-string",value:s},{name:"token description",type:"string",value:a,lte:200},{name:"token url",type:"url",value:c},{name:"token url",type:"string",value:c,lte:256},{name:"issuer",type:"address",value:o},{name:"sale start timestamp",type:"integer",value:A,gte:Date.now()},{name:"sale end timestamp",type:"integer",value:g,gt:A},{name:"Frozen supply",type:"integer",value:W,gte:0},{name:"Frozen duration",type:"integer",value:S,gte:0}]),yt(F)&&(!Hr(F)||F<=0))throw new Error("voteScore must be a positive integer greater than 0");if(yt(U)&&(!Hr(U)||U<0||U>6))throw new Error("precision must be a positive integer >= 0 and <= 6");let V={owner_address:$(o),name:It(s),abbr:It(i),description:It(a),url:It(c),total_supply:parseInt(u),trx_num:parseInt(l),num:parseInt(p),start_time:parseInt(A),end_time:parseInt(g),frozen_supply:[{frozen_amount:parseInt(W),frozen_days:parseInt(S)}]};["name","abbr","description","url"].forEach(X=>{V[X]||delete V[X]}),parseInt(W)>0||delete V.frozen_supply,P&&!isNaN(parseInt(P))&&parseInt(P)>=0&&(V.free_asset_net_limit=parseInt(P)),b&&!isNaN(parseInt(b))&&parseInt(b)>=0&&(V.public_free_asset_net_limit=parseInt(b)),U&&!isNaN(parseInt(U))&&(V.precision=parseInt(U)),F&&!isNaN(parseInt(F))&&(V.vote_score=parseInt(F));let L=be(r);return me(this.tronWeb,pe.AssetIssueContract,V,r?.permissionId,L)}async createAccount(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"account",type:"address",value:r},{name:"origin",type:"address",value:o}]);let i={owner_address:$(o),account_address:$(r)},a=be(s);return me(this.tronWeb,pe.AccountCreateContract,i,s?.permissionId,a)}async updateAccount(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"Name",type:"string",lte:200,gt:0,value:r,msg:"Invalid accountName"},{name:"origin",type:"address",value:o}]);let i={account_name:It(r),owner_address:$(o)},a=be(s);return me(this.tronWeb,pe.AccountUpdateContract,i,s?.permissionId,a)}async setAccountId(r,o=this.tronWeb.defaultAddress.hex,s={}){r&&at(r)&&r.startsWith("0x")&&(r=r.slice(2)),this.validator.notValid([{name:"accountId",type:"hex",value:r},{name:"accountId",type:"string",lte:32,gte:8,value:r},{name:"origin",type:"address",value:o}]);let i={account_id:r,owner_address:$(o)},a=be(s);return me(this.tronWeb,pe.SetAccountIdContract,i,s?.permissionId,a)}async updateToken(r={},o=this.tronWeb.defaultAddress.hex){let{description:s="",url:i=!1,freeBandwidth:a=0,freeBandwidthLimit:c=0}=r;this.validator.notValid([{name:"token description",type:"string",value:s,lte:200},{name:"token url",type:"url",value:i},{name:"token url",type:"string",value:i,lte:256},{name:"issuer",type:"address",value:o}]);let u={owner_address:$(o),description:It(s),url:It(i)};a&&!isNaN(parseInt(a))&&parseInt(a)>=0&&(u.new_limit=parseInt(a)),c&&!isNaN(parseInt(c))&&parseInt(c)>=0&&(u.new_public_limit=parseInt(c));let l=be(r);return me(this.tronWeb,pe.UpdateAssetContract,u,r?.permissionId,l)}async sendAsset(r,o=0,s,i=this.tronWeb.defaultAddress.hex,a={}){return this.sendToken(r,o,s,i,a)}async purchaseAsset(r,o,s=0,i=this.tronWeb.defaultAddress.hex,a={}){return this.purchaseToken(r,o,s,i,a)}async createAsset(r,o){return this.createToken(r,o)}async updateAsset(r={},o=this.tronWeb.defaultAddress.hex){return this.updateToken(r,o)}async createProposal(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"issuer",type:"address",value:o}]);let i="Invalid proposal parameters provided";if(!r)throw new Error(i);let a=Kn(r)?r:[r];for(let l of a)if(!vn(l))throw new Error(i);let c={owner_address:$(o),parameters:a},u=be(s);return me(this.tronWeb,pe.ProposalCreateContract,c,s?.permissionId,u)}async deleteProposal(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"issuer",type:"address",value:o},{name:"proposalID",type:"integer",value:r,gte:0}]);let i={owner_address:$(o),proposal_id:parseInt(r)},a=be(s);return me(this.tronWeb,pe.ProposalDeleteContract,i,s?.permissionId,a)}async voteProposal(r,o=!1,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"voter",type:"address",value:s},{name:"proposalID",type:"integer",value:r,gte:0},{name:"has approval",type:"boolean",value:o}]);let a={owner_address:$(s),proposal_id:parseInt(r),is_add_approval:o},c=be(i);return me(this.tronWeb,pe.ProposalApproveContract,a,i?.permissionId,c)}async createTRXExchange(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:r},{name:"token balance",type:"positive-integer",value:o},{name:"trx balance",type:"positive-integer",value:s}]);let c={owner_address:$(i),first_token_id:It(r),first_token_balance:o,second_token_id:"5f",second_token_balance:s},u=be(a);return me(this.tronWeb,pe.ExchangeCreateContract,c,a?.permissionId,u)}async createTokenExchange(r,o,s,i,a=this.tronWeb.defaultAddress.hex,c={}){this.validator.notValid([{name:"owner",type:"address",value:a},{name:"first token name",type:"not-empty-string",value:r},{name:"second token name",type:"not-empty-string",value:s},{name:"first token balance",type:"positive-integer",value:o},{name:"second token balance",type:"positive-integer",value:i}]);let u={owner_address:$(a),first_token_id:It(r),first_token_balance:o,second_token_id:It(s),second_token_balance:i},l=be(c);return me(this.tronWeb,pe.ExchangeCreateContract,u,c?.permissionId,l)}async injectExchangeTokens(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:o},{name:"token amount",type:"integer",value:s,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let c={owner_address:$(i),exchange_id:parseInt(r),token_id:It(o),quant:parseInt(s)},u=be(a);return me(this.tronWeb,pe.ExchangeInjectContract,c,a?.permissionId,u)}async withdrawExchangeTokens(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:o},{name:"token amount",type:"integer",value:s,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let c={owner_address:$(i),exchange_id:parseInt(r),token_id:It(o),quant:parseInt(s)},u=be(a);return me(this.tronWeb,pe.ExchangeWithdrawContract,c,a?.permissionId,u)}async tradeExchangeTokens(r,o,s,i,a=this.tronWeb.defaultAddress.hex,c={}){this.validator.notValid([{name:"owner",type:"address",value:a},{name:"token name",type:"not-empty-string",value:o},{name:"tokenAmountSold",type:"integer",value:s,gte:1},{name:"tokenAmountExpected",type:"integer",value:i,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let u={owner_address:$(a),exchange_id:parseInt(r),token_id:ie.fromAscii(o).replace(/^0x/,""),quant:parseInt(s),expected:parseInt(i)},l=be(c);return me(this.tronWeb,pe.ExchangeTransactionContract,u,c?.permissionId,l)}async updateSetting(r,o,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"owner",type:"address",value:s},{name:"contract",type:"address",value:r},{name:"userFeePercentage",type:"integer",value:o,gte:0,lte:100}]);let a={owner_address:$(s),contract_address:$(r),consume_user_resource_percent:o},c=be(i);return me(this.tronWeb,pe.UpdateSettingContract,a,i?.permissionId,c)}async updateEnergyLimit(r,o=0,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"owner",type:"address",value:s},{name:"contract",type:"address",value:r},{name:"originEnergyLimit",type:"integer",value:o,gte:0,lte:1e7}]);let a={owner_address:$(s),contract_address:$(r),origin_energy_limit:o},c=be(i);return me(this.tronWeb,pe.UpdateEnergyLimitContract,a,i?.permissionId,c)}checkPermissions(r,o){if(r){if(r.type!==o||!r.permission_name||!at(r.permission_name)||!Hr(r.threshold)||r.threshold<1||!r.keys)return!1;for(let s of r.keys)if(!ie.isAddress(s.address)||!Hr(s.weight)||s.weight>r.threshold||s.weight<1||o===2&&!r.operations)return!1}return!0}async updateAccountPermissions(r=this.tronWeb.defaultAddress.hex,o,s,i,a={}){if(!ie.isAddress(r))throw new Error("Invalid ownerAddress provided");if(!this.checkPermissions(o,0))throw new Error("Invalid ownerPermissions provided");if(!this.checkPermissions(s,1))throw new Error("Invalid witnessPermissions provided");Array.isArray(i)||(i=[i]);for(let l of i)if(!this.checkPermissions(l,2))throw new Error("Invalid activesPermissions provided");let c={owner_address:$(r)};if(o){let l=ua(o);"type"in l&&delete l.type,l.keys=l.keys?.map(({address:p,weight:A})=>({address:this.tronWeb.address.toHex(p),weight:A})),c.owner=l}if(s){let l=ua(s);l.type="Witness",l.keys=l.keys.map(({address:p,weight:A})=>({address:this.tronWeb.address.toHex(p),weight:A})),c.witness=l}if(i){let l=ua(i);l.forEach(p=>{p.type="Active"}),l.forEach(p=>{p.keys=p.keys.map(({address:A,weight:g})=>({address:this.tronWeb.address.toHex(A),weight:g}))}),c.actives=l}let u=be(a);return me(this.tronWeb,pe.AccountPermissionUpdateContract,c,a?.permissionId,u)}async newTxID(r,o={}){if(o?.txLocal){let s=r.raw_data.contract[0];try{let i=await me(this.tronWeb,s.type,s.parameter.value,s.Permission_id,{fee_limit:r.raw_data.fee_limit,data:r.raw_data.data,ref_block_bytes:r.raw_data.ref_block_bytes,ref_block_hash:r.raw_data.ref_block_hash,expiration:r.raw_data.expiration,timestamp:r.raw_data.timestamp});return i.signature=r.signature,i.visible=r.visible,i}catch{throw new Error("Error generating a new transaction id.")}}try{let s=await this.tronWeb.fullNode.request("wallet/getsignweight",r,"post");return typeof r.visible=="boolean"&&(s.transaction.transaction.visible=r.visible),PA(s.transaction.transaction,{...r.raw_data.contract[0].parameter.value,Permission_id:r.raw_data.contract[0].Permission_id},{data:r.raw_data.data,fee_limit:r.raw_data.fee_limit})}catch{throw new Error("Error generating a new transaction id.")}}async alterTransaction(r,o={}){if(Reflect.has(r,"signature"))throw new Error("You can not extend the expiration of a signed transaction.");if(o.data){if(o.dataFormat!=="hex"&&(o.data=ie.toHex(o.data)),o.data=o.data.replace(/^0x/,""),o.data.length===0)throw new Error("Invalid data provided");r.raw_data.data=o.data}if(o.extension){if(o.extension=parseInt(o.extension*1e3),isNaN(o.extension)||r.raw_data.expiration+o.extension<=Date.now()+3e3)throw new Error("Invalid extension provided");r.raw_data.expiration+=o.extension}return await this.newTxID(r,{txLocal:o.txLocal})}async extendExpiration(r,o,s={}){return await this.alterTransaction(r,{extension:o,txLocal:s?.txLocal})}async addUpdateData(r,o,s="utf8",i={}){return this.alterTransaction(r,{data:o,dataFormat:s,txLocal:i?.txLocal})}}});function On(n){return ie.address.toHex(n)}var SA,vA,co,Mu=se(()=>{Br();En();er();Qt();au();Js();Mn();SA=`TRON Signed Message:
|
|
3
|
-
32`,
|
|
4
|
-
32`;co=class n{tronWeb;cache;validator;signMessage;sendAsset;send;sendTrx;broadcast;broadcastHex;signTransaction;constructor(r){this.tronWeb=r,this.cache={contracts:{}},this.validator=new Uo,this.signMessage=this.sign,this.sendAsset=this.sendToken,this.send=this.sendTransaction,this.sendTrx=this.sendTransaction,this.broadcast=this.sendRawTransaction,this.broadcastHex=this.sendHexTransaction,this.signTransaction=this.sign}_parseToken(r){return{...r,name:this.tronWeb.toUtf8(r.name),abbr:r.abbr&&this.tronWeb.toUtf8(r.abbr),description:r.description&&this.tronWeb.toUtf8(r.description),url:r.url&&this.tronWeb.toUtf8(r.url)}}getCurrentBlock(){return this.tronWeb.fullNode.request("wallet/getnowblock")}getConfirmedCurrentBlock(){return this.tronWeb.solidityNode.request("walletsolidity/getnowblock")}async getBlock(r=this.tronWeb.defaultBlock){if(r===!1)throw new Error("No block identifier provided");return r=="earliest"&&(r=0),r=="latest"?this.getCurrentBlock():isNaN(+r)&&D.isHex(r.toString())?this.getBlockByHash(r):this.getBlockByNumber(r)}async getBlockByHash(r){let o=await this.tronWeb.fullNode.request("wallet/getblockbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Block not found");return o}async getBlockByNumber(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid block number provided");return this.tronWeb.fullNode.request("wallet/getblockbynum",{num:parseInt(r)},"post").then(o=>{if(!Object.keys(o).length)throw new Error("Block not found");return o})}async getBlockTransactionCount(r=this.tronWeb.defaultBlock){let{transactions:o=[]}=await this.getBlock(r);return o.length}async getTransactionFromBlock(r=this.tronWeb.defaultBlock,o){let{transactions:s}=await this.getBlock(r);if(!s)throw new Error("Transaction not found in block");if(o>=0&&o<s.length)return s[o];throw new Error("Invalid transaction index provided")}async getTransactionsFromBlock(r=this.tronWeb.defaultBlock){let{transactions:o}=await this.getBlock(r);if(!o)throw new Error("Transaction not found in block");return o}async getTransaction(r){let o=await this.tronWeb.fullNode.request("wallet/gettransactionbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Transaction not found");return o}async getConfirmedTransaction(r){let o=await this.tronWeb.solidityNode.request("walletsolidity/gettransactionbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Transaction not found");return o}getUnconfirmedTransactionInfo(r){return this.tronWeb.fullNode.request("wallet/gettransactioninfobyid",{value:r},"post")}getTransactionInfo(r){return this.tronWeb.solidityNode.request("walletsolidity/gettransactioninfobyid",{value:r},"post")}getTransactionsToAddress(r=this.tronWeb.defaultAddress.hex,o=30,s=0){return this.getTransactionsRelated(this.tronWeb.address.toHex(r),"to",o,s)}getTransactionsFromAddress(r=this.tronWeb.defaultAddress.hex,o=30,s=0){return this.getTransactionsRelated(this.tronWeb.address.toHex(r),"from",o,s)}async getTransactionsRelated(r=this.tronWeb.defaultAddress.hex,o="all",s=30,i=0){if(!["to","from","all"].includes(o))throw new Error('Invalid direction provided: Expected "to", "from" or "all"');if(o=="all"){let[a,c]=await Promise.all([this.getTransactionsRelated(r,"from",s,i),this.getTransactionsRelated(r,"to",s,i)]);return[...a.map(u=>(u.direction="from",u)),...c.map(u=>(u.direction="to",u))].sort((u,l)=>l.raw_data.timestamp-u.raw_data.timestamp)}if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!D.isInteger(s)||s<0||i&&s<1)throw new Error("Invalid limit provided");if(!D.isInteger(i)||i<0)throw new Error("Invalid offset provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.solidityNode.request(`walletextension/gettransactions${o}this`,{account:{address:r},offset:i,limit:s},"post").then(({transaction:a})=>a)}async getAccount(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.solidityNode.request("walletsolidity/getaccount",{address:r},"post")}getAccountById(r){return this.getAccountInfoById(r,{confirmed:!0})}async getAccountInfoById(r,o){return this.validator.notValid([{name:"accountId",type:"hex",value:r},{name:"accountId",type:"string",lte:32,gte:8,value:r}]),r.startsWith("0x")&&(r=r.slice(2)),this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getaccountbyid`,{account_id:r},"post")}async getBalance(r=this.tronWeb.defaultAddress.hex){let{balance:o=0}=await this.getAccount(r);return o}async getUnconfirmedAccount(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getaccount",{address:r},"post")}getUnconfirmedAccountById(r){return this.getAccountInfoById(r,{confirmed:!1})}async getUnconfirmedBalance(r=this.tronWeb.defaultAddress.hex){let{balance:o=0}=await this.getUnconfirmedAccount(r);return o}async getBandwidth(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getaccountnet",{address:r},"post").then(({freeNetUsed:o=0,freeNetLimit:s=0,NetUsed:i=0,NetLimit:a=0})=>s-o+(a-i))}async getTokensIssuedByAddress(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getassetissuebyaccount",{address:r},"post").then(({assetIssue:o})=>o?o.map(i=>this._parseToken(i)).reduce((i,a)=>(i[a.name]=a,i),{}):{})}async getTokenFromID(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuebyname",{value:this.tronWeb.fromUtf8(r)},"post").then(o=>{if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}async listNodes(){let{nodes:r=[]}=await this.tronWeb.fullNode.request("wallet/listnodes");return r.map(({address:{host:o,port:s}})=>`${this.tronWeb.toUtf8(o)}:${s}`)}async getBlockRange(r=0,o=30){if(!D.isInteger(r)||r<0)throw new Error("Invalid start of range provided");if(!D.isInteger(o)||o<r)throw new Error("Invalid end of range provided");if(o+1-r>100)throw new Error("Invalid range size, which should be no more than 100.");return this.tronWeb.fullNode.request("wallet/getblockbylimitnext",{startNum:parseInt(r),endNum:parseInt(o)+1},"post").then(({block:s=[]})=>s)}async listSuperRepresentatives(){let{witnesses:r=[]}=await this.tronWeb.fullNode.request("wallet/listwitnesses");return r}async listTokens(r=0,o=0){if(!D.isInteger(r)||r<0||o&&r<1)throw new Error("Invalid limit provided");if(!D.isInteger(o)||o<0)throw new Error("Invalid offset provided");return r?this.tronWeb.fullNode.request("wallet/getpaginatedassetissuelist",{offset:parseInt(o),limit:parseInt(r)},"post").then(({assetIssue:s=[]})=>s.map(i=>this._parseToken(i))):this.tronWeb.fullNode.request("wallet/getassetissuelist").then(({assetIssue:s=[]})=>s.map(i=>this._parseToken(i)))}async timeUntilNextVoteCycle(){let{num:r=-1}=await this.tronWeb.fullNode.request("wallet/getnextmaintenancetime");if(r==-1)throw new Error("Failed to get time until next vote cycle");return Math.floor(r/1e3)}async getContract(r){if(!this.tronWeb.isAddress(r))throw new Error("Invalid contract address provided");if(this.cache.contracts[r])return this.cache.contracts[r];r=this.tronWeb.address.toHex(r);let o=await this.tronWeb.fullNode.request("wallet/getcontract",{value:r});if(o.Error)throw new Error("Contract does not exist");return this.cache.contracts[r]=o,o}ecRecover(r){return n.ecRecover(r)}static ecRecover(r){if(!Zs(r))throw new Error("Invalid transaction");if(!r.signature?.length)throw new Error("Transaction is not signed");if(r.signature.length===1){let o=la(r.txID,r.signature[0]);return ie.address.fromHex(o)}return r.signature.map(o=>{let s=la(r.txID,o);return ie.address.fromHex(s)})}async verifyMessage(r,o,s=this.tronWeb.defaultAddress.base58,i=!0){if(!D.isHex(r))throw new Error("Expected hex message input");if(n.verifySignature(r,s,o,i))return!0;throw new Error("Signature does not match")}static verifySignature(r,o,s,i=!0){r=r.replace(/^0x/,"");let a=[...(0,k.toUtf8Bytes)(i?SA:vA),...D.code.hexStr2byteArray(r)],c=(0,k.keccak256)(new Uint8Array(a)),u=(0,k.recoverAddress)(c,k.Signature.from(`0x${s.replace(/^0x/,"")}`)),l=ht+u.substr(2);return ie.address.fromHex(l)==ie.address.fromHex(o)}async verifyMessageV2(r,o){return n.verifyMessageV2(r,o)}static verifyMessageV2(r,o){return D.message.verifyMessage(r,o)}verifyTypedData(r,o,s,i,a=this.tronWeb.defaultAddress.base58){if(n.verifyTypedData(r,o,s,i,a))return!0;throw new Error("Signature does not match")}static verifyTypedData(r,o,s,i,a){let c=D._TypedDataEncoder.hash(r,o,s),u=(0,k.recoverAddress)(c,k.Signature.from(`0x${i.replace(/^0x/,"")}`)),l=ht+u.substr(2);return ie.address.fromHex(l)==ie.address.fromHex(a)}async sign(r,o=this.tronWeb.defaultPrivateKey,s=!0,i=!1){if(D.isString(r)){if(!D.isHex(r))throw new Error("Expected hex message input");return n.signString(r,o,s)}if(!D.isObject(r))throw new Error("Invalid transaction provided");if(!i&&r.signature)throw new Error("Transaction is already signed");if(!i){if(this.tronWeb.address.toHex(this.tronWeb.address.fromPrivateKey(o)).toLowerCase()!==this.tronWeb.address.toHex(r.raw_data.contract[0].parameter.value.owner_address))throw new Error("Private key does not match address in transaction");if(!Zs(r))throw new Error("Invalid transaction")}return D.crypto.signTransaction(o,r)}static signString(r,o,s=!0){r=r.replace(/^0x/,"");let i=`0x${o.replace(/^0x/,"")}`,a=new k.SigningKey(i),c=[...(0,k.toUtf8Bytes)(s?SA:vA),...D.code.hexStr2byteArray(r)],u=(0,k.keccak256)(new Uint8Array(c)),l=a.sign(u);return["0x",l.r.substring(2),l.s.substring(2),Number(l.v).toString(16)].join("")}signMessageV2(r,o=this.tronWeb.defaultPrivateKey){return n.signMessageV2(r,o)}static signMessageV2(r,o){return D.message.signMessage(r,o)}_signTypedData(r,o,s,i=this.tronWeb.defaultPrivateKey){return n._signTypedData(r,o,s,i)}static _signTypedData(r,o,s,i){return D.crypto._signTypedData(r,o,s,i)}async multiSign(r,o=this.tronWeb.defaultPrivateKey,s=0){if(!D.isObject(r)||!r.raw_data||!r.raw_data.contract)throw new Error("Invalid transaction provided");if(!r.raw_data.contract[0].Permission_id&&s>0){r.raw_data.contract[0].Permission_id=s;let i=this.tronWeb.address.toHex(this.tronWeb.address.fromPrivateKey(o)).toLowerCase(),a=await this.getSignWeight(r,s);if(a.result.code==="PERMISSION_ERROR")throw new Error(a.result.message);let c=!1;if(a.permission.keys.map(u=>{u.address===i&&(c=!0)}),!c)throw new Error(o+" has no permission to sign");if(a.approved_list&&a.approved_list.indexOf(i)!=-1)throw new Error(o+" already sign transaction");if(a.transaction&&a.transaction.transaction)r=a.transaction.transaction,s>0&&(r.raw_data.contract[0].Permission_id=s);else throw new Error("Invalid transaction provided")}if(!Zs(r))throw new Error("Invalid transaction");return D.crypto.signTransaction(o,r)}async getApprovedList(r){if(!D.isObject(r))throw new Error("Invalid transaction provided");return this.tronWeb.fullNode.request("wallet/getapprovedlist",r,"post")}async getSignWeight(r,o){if(!D.isObject(r)||!r.raw_data||!r.raw_data.contract)throw new Error("Invalid transaction provided");return D.isInteger(o)?r.raw_data.contract[0].Permission_id=parseInt(o):typeof r.raw_data.contract[0].Permission_id!="number"&&(r.raw_data.contract[0].Permission_id=0),this.tronWeb.fullNode.request("wallet/getsignweight",r,"post")}async sendRawTransaction(r){if(!D.isObject(r))throw new Error("Invalid transaction provided");if(!r.signature||!D.isArray(r.signature))throw new Error("Transaction is not signed");return{...await this.tronWeb.fullNode.request("wallet/broadcasttransaction",r,"post"),transaction:r}}async sendHexTransaction(r){if(!D.isHex(r))throw new Error("Invalid hex transaction provided");let o={transaction:r},s=await this.tronWeb.fullNode.request("wallet/broadcasthex",o,"post");return s.result?{...s,transaction:JSON.parse(s.transaction),hexTransaction:r}:s}async sendTransaction(r,o,s={}){if(typeof s=="string"&&(s={privateKey:s}),!this.tronWeb.isAddress(r))throw new Error("Invalid recipient provided");if(!D.isInteger(o)||o<=0)throw new Error("Invalid amount provided");if(s={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...s},!s.privateKey&&!s.address)throw new Error("Function requires either a private key or address to be set");let i=s.privateKey?this.tronWeb.address.fromPrivateKey(s.privateKey):s.address,a=await this.tronWeb.transactionBuilder.sendTrx(r,o,i),c=await this.sign(a,s.privateKey);return await this.sendRawTransaction(c)}async sendToken(r,o,s,i={}){if(typeof i=="string"&&(i={privateKey:i}),!this.tronWeb.isAddress(r))throw new Error("Invalid recipient provided");if(!D.isInteger(o)||o<=0)throw new Error("Invalid amount provided");if(D.isInteger(s)&&(s=s.toString()),!D.isString(s))throw new Error("Invalid token ID provided");if(i={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...i},!i.privateKey&&!i.address)throw new Error("Function requires either a private key or address to be set");let a=i.privateKey?this.tronWeb.address.fromPrivateKey(i.privateKey):i.address,c=await this.tronWeb.transactionBuilder.sendToken(r,o,s,a),u=await this.sign(c,i.privateKey);return await this.sendRawTransaction(u)}async freezeBalance(r=0,o=3,s="BANDWIDTH",i={},a){if(typeof i=="string"&&(i={privateKey:i}),!["BANDWIDTH","ENERGY"].includes(s))throw new Error('Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"');if(!D.isInteger(r)||r<=0)throw new Error("Invalid amount provided");if(!D.isInteger(o)||o<3)throw new Error("Invalid duration provided, minimum of 3 days");if(i={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...i},!i.privateKey&&!i.address)throw new Error("Function requires either a private key or address to be set");let c=i.privateKey?this.tronWeb.address.fromPrivateKey(i.privateKey):i.address,u=await this.tronWeb.transactionBuilder.freezeBalance(r,o,s,c,a),l=await this.sign(u,i.privateKey);return await this.sendRawTransaction(l)}async unfreezeBalance(r="BANDWIDTH",o={},s){if(typeof o=="string"&&(o={privateKey:o}),!["BANDWIDTH","ENERGY"].includes(r))throw new Error('Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"');if(o={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...o},!o.privateKey&&!o.address)throw new Error("Function requires either a private key or address to be set");let i=o.privateKey?this.tronWeb.address.fromPrivateKey(o.privateKey):o.address,a=await this.tronWeb.transactionBuilder.unfreezeBalance(r,i,s),c=await this.sign(a,o.privateKey);return await this.sendRawTransaction(c)}async updateAccount(r,o={}){if(typeof o=="string"&&(o={privateKey:o}),!D.isString(r)||!r.length)throw new Error("Name must be a string");if(o={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...o},!o.privateKey&&!o.address)throw Error("Function requires either a private key or address to be set");let s=o.privateKey?this.tronWeb.address.fromPrivateKey(o.privateKey):o.address,i=await this.tronWeb.transactionBuilder.updateAccount(r,s),a=await this.sign(i,o.privateKey);return await this.sendRawTransaction(a)}async getProposal(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid proposalID provided");return this.tronWeb.fullNode.request("wallet/getproposalbyid",{id:parseInt(r)},"post")}async listProposals(){let{proposals:r=[]}=await this.tronWeb.fullNode.request("wallet/listproposals",{},"post");return r}async getChainParameters(){let{chainParameter:r=[]}=await this.tronWeb.fullNode.request("wallet/getchainparameters",{},"post");return r}async getAccountResources(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb.fullNode.request("wallet/getaccountresource",{address:this.tronWeb.address.toHex(r)},"post")}async getDelegatedResourceV2(r=this.tronWeb.defaultAddress.hex,o=this.tronWeb.defaultAddress.hex,s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!this.tronWeb.isAddress(o))throw new Error("Invalid address provided");return this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getdelegatedresourcev2`,{fromAddress:On(r),toAddress:On(o)},"post")}async getDelegatedResourceAccountIndexV2(r=this.tronWeb.defaultAddress.hex,o={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getdelegatedresourceaccountindexv2`,{value:On(r)},"post")}async getCanDelegatedMaxSize(r=this.tronWeb.defaultAddress.hex,o="BANDWIDTH",s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.validator.notValid([{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]),this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getcandelegatedmaxsize`,{owner_address:On(r),type:o==="ENERGY"?1:0},"post")}async getAvailableUnfreezeCount(r=this.tronWeb.defaultAddress.hex,o={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getavailableunfreezecount`,{owner_address:On(r)},"post")}async getCanWithdrawUnfreezeAmount(r=this.tronWeb.defaultAddress.hex,o=Date.now(),s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!D.isInteger(o)||o<0)throw new Error("Invalid timestamp provided");return this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getcanwithdrawunfreezeamount`,{owner_address:On(r),timestamp:o},"post")}async getExchangeByID(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid exchangeID provided");return this.tronWeb.fullNode.request("wallet/getexchangebyid",{id:r},"post")}async listExchanges(){return this.tronWeb.fullNode.request("wallet/listexchanges",{},"post").then(({exchanges:r=[]})=>r)}async listExchangesPaginated(r=10,o=0){return this.tronWeb.fullNode.request("wallet/getpaginatedexchangelist",{limit:r,offset:o},"post").then(({exchanges:s=[]})=>s)}async getNodeInfo(){return this.tronWeb.fullNode.request("wallet/getnodeinfo",{},"post")}async getTokenListByName(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuelistbyname",{value:this.tronWeb.fromUtf8(r)},"post").then(o=>{if(Array.isArray(o.assetIssue))return o.assetIssue.map(s=>this._parseToken(s));if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}getTokenByID(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuebyid",{value:r},"post").then(o=>{if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}async getReward(r,o={}){return o.confirmed=!0,this._getReward(r,o)}async getUnconfirmedReward(r,o={}){return o.confirmed=!1,this._getReward(r,o)}async getBrokerage(r,o={}){return o.confirmed=!0,this._getBrokerage(r,o)}async getUnconfirmedBrokerage(r,o={}){return o.confirmed=!1,this._getBrokerage(r,o)}async _getReward(r=this.tronWeb.defaultAddress.hex,o){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={address:On(r)};return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getReward`,s,"post").then((i={reward:void 0})=>{if(typeof i.reward>"u")throw new Error("Not found.");return i.reward})}async _getBrokerage(r=this.tronWeb.defaultAddress.hex,o){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={address:On(r)};return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getBrokerage`,s,"post").then((i={})=>{if(typeof i.brokerage>"u")throw new Error("Not found.");return i.brokerage})}async getBandwidthPrices(){return this.tronWeb.fullNode.request("wallet/getbandwidthprices",{},"post").then((r={})=>{if(typeof r.prices>"u")throw new Error("Not found.");return r.prices})}async getEnergyPrices(){return this.tronWeb.fullNode.request("wallet/getenergyprices",{},"post").then((r={})=>{if(typeof r.prices>"u")throw new Error("Not found.");return r.prices})}}});var Cy,Ru,Hs,Fu=se(()=>{En();ks();Mn();Cy=n=>{if("stateMutability"in n&&(n.stateMutability=n.stateMutability?n.stateMutability.toLowerCase():"nonpayable"),n.type=n.type?n.type.toLowerCase():"",n.type==="fallback"||n.type==="receive")return"0x";let r=new D.ethersUtils.Interface([n]),o;if(n.type==="event"?o=r.getEvent(n.name):o=r.getFunction(n.name),o)return o.format("sighash");throw new Error("unknown function")},Ru=(n,r)=>su(n,r),Hs=class{tronWeb;contract;abi;name;inputs;outputs;functionSelector;signature;defaultOptions;constructor(r,o){this.tronWeb=r.tronWeb,this.contract=r,this.abi=o,this.name=o.name||o.type,this.inputs=o.inputs||[],this.outputs=[],"outputs"in o&&o.outputs&&(this.outputs=o.outputs),this.functionSelector=Cy(o),this.signature=ku(this.functionSelector,!1).slice(0,8),this.defaultOptions={feeLimit:this.tronWeb.feeLimit,callValue:0,userFeePercentage:100,shouldPollResponse:!1}}decodeInput(r){let o=JSON.parse(JSON.stringify(this.abi));return o.outputs=o.inputs,Ru(o,"0x"+r)}onMethod(...r){let o="";return this.abi&&!/event/i.test(this.abi.type)&&(o=No(this.abi,r)),{call:async(s={})=>(s={...s,rawParameter:o},await this._call([],[],s)),send:async(s={},i=this.tronWeb.defaultPrivateKey)=>(s={...s,rawParameter:o},await this._send([],[],s,i))}}async _call(r,o,s={}){if(r.length!==o.length)throw new Error("Invalid argument count provided");if(!this.contract.address)throw new Error("Smart contract is missing address");if(!this.contract.deployed)throw new Error("Calling smart contracts requires you to load the contract first");if("stateMutability"in this.abi){let{stateMutability:l}=this.abi;if(l&&!["pure","view"].includes(l.toLowerCase()))throw new Error(`Methods with state mutability "${l}" must use send()`)}s={...this.defaultOptions,from:this.tronWeb.defaultAddress.hex,...s,_isConstant:!0};let i=o.map((l,p)=>({type:r[p],value:l})),a=await this.tronWeb.transactionBuilder.triggerSmartContract(this.contract.address,this.functionSelector,s,i,s.from?this.tronWeb.address.toHex(s.from):void 0);if(!D.hasProperty(a,"constant_result"))throw new Error("Failed to execute");let c=a.constant_result[0].length;if(c===0||c%64===8){let l="The call has been reverted or has thrown an error.";if(c!==0){l+=" Error message: ";let p="",A=a.constant_result[0].substring(8);for(let g=0;g<c-8;g+=64)p+=this.tronWeb.toUtf8(A.substring(g,g+64));l+=p.replace(/(\u0000|\u000b|\f)+/g," ").replace(/ +/g," ").replace(/\s+$/g,"")}throw new Error(l)}let u=Ru(this.abi,"0x"+a.constant_result[0]);return u.length===1&&Object.keys(u).length===1&&(u=u[0]),u}async _send(r,o,s={},i=this.tronWeb.defaultPrivateKey){if(r.length!==o.length)throw new Error("Invalid argument count provided");if(!this.contract.address)throw new Error("Smart contract is missing address");if(!this.contract.deployed)throw new Error("Calling smart contracts requires you to load the contract first");let{stateMutability:a}=this.abi;if(["pure","view"].includes(a.toLowerCase()))throw new Error(`Methods with state mutability "${a}" must use call()`);["payable"].includes(a.toLowerCase())||(s.callValue=0),s={...this.defaultOptions,from:this.tronWeb.defaultAddress.hex,...s};let c=o.map((P,b)=>({type:r[b],value:P})),u=i?this.tronWeb.address.fromPrivateKey(i):this.tronWeb.defaultAddress.base58,l=await this.tronWeb.transactionBuilder.triggerSmartContract(this.contract.address,this.functionSelector,s,c,this.tronWeb.address.toHex(u));if(!l.result||!l.result.result)throw new Error("Unknown error: "+JSON.stringify(l,null,2));let p=await this.tronWeb.trx.sign(l.transaction,i);if(!p.signature)throw i?new Error("Invalid private key provided"):new Error("Transaction was not signed properly");let A=await this.tronWeb.trx.sendRawTransaction(p);if(A.code){let P={error:A.code,message:A.code};A.message&&(P.message=this.tronWeb.toUtf8(A.message));let b=new Error(P.message);throw b.error=A.code,b}if(!s.shouldPollResponse)return p.txID;let g=async P=>{if(P===(s.pollTimes||20)){let S=new Error("Cannot find result in solidity node");throw S.error="Cannot find result in solidity node",S.transaction=p,S}let b=await this.tronWeb.trx.getTransactionInfo(p.txID);if(!Object.keys(b).length)return await new Promise(S=>setTimeout(S,3e3)),g(P+1);if(b.result&&b.result==="FAILED"){let S=new Error(this.tronWeb.toUtf8(b.resMessage));throw S.error=this.tronWeb.toUtf8(b.resMessage),S.transaction=p,S.output=b,S}if(!D.hasProperty(b,"contractResult")){let S=new Error("Failed to execute: "+JSON.stringify(b,null,2));throw S.error="Failed to execute: "+JSON.stringify(b,null,2),S.transaction=p,S.output=b,S}if(s.rawResponse)return b;let W=Ru(this.abi,"0x"+b.contractResult[0]);return W.length===1&&Object.keys(W).length===1&&(W=W[0]),s.keepTxID?[p.txID,W]:W};return g(0)}}});var uo,Ou=se(()=>{Br();En();Fu();Fu();uo=class{tronWeb;abi;address;eventListener;bytecode;deployed;lastBlock;methods;methodInstances;props;constructor(r,o=[],s){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.address=s,this.abi=o,this.eventListener=!1,this.bytecode=!1,this.deployed=!1,this.lastBlock=!1,this.methods={},this.methodInstances={},this.props=[],D.address.isAddress(s)?this.deployed=!0:this.address=!1,this.loadAbi(o)}hasProperty(r){return this.hasOwnProperty(r)||this.__proto__.hasOwnProperty(r)}loadAbi(r){this.abi=r,this.methods={},this.props.forEach(o=>delete this[o]),r.forEach(o=>{if(!o.type||/constructor|error/i.test(o.type))return;let s=new Hs(this,o),i=s.onMethod.bind(s),{name:a,functionSelector:c,signature:u}=s;this.methods[a]=i,this.methods[c]=i,this.methods[u]=i,this.methodInstances[a]=s,this.methodInstances[c]=s,this.methodInstances[u]=s,this.hasProperty(a)||(this[a]=i,this.props.push(a)),this.hasProperty(c)||(this[c]=i,this.props.push(c)),this.hasProperty(u)||(this[u]=i,this.props.push(u))})}decodeInput(r){let o=r.substring(0,8),s=r.substring(8);if(!this.methodInstances[o])throw new Error("Contract method "+o+" not found");return{name:this.methodInstances[o].name,params:this.methodInstances[o].decodeInput(s)}}async new(r,o=this.tronWeb.defaultPrivateKey){let s=this.tronWeb.address.fromPrivateKey(o),i=await this.tronWeb.transactionBuilder.createSmartContract(r,s),a=await this.tronWeb.trx.sign(i,o),c=await this.tronWeb.trx.sendRawTransaction(a);if(c.code)throw{error:c.code,message:this.tronWeb.toUtf8(c.message)};return await D.sleep(3e3),this.at(a.contract_address)}async at(r){try{let o=await this.tronWeb.trx.getContract(r);if(!o.contract_address)throw new Error("Unknown error: "+JSON.stringify(o,null,2));return this.address=o.contract_address,this.bytecode=o.bytecode,this.deployed=!0,this.loadAbi(o.abi?o.abi.entrys?o.abi.entrys:[]:[]),this}catch(o){throw o.toString().includes("does not exist")?new Error("Contract has not been deployed on the network"):new Error(o)}}}});var IA,lo,Eu=se(()=>{Br();En();IA=ye(require("semver"),1),lo=class{tronWeb;pluginNoOverride;disablePlugins;constructor(r,o={}){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.pluginNoOverride=["register"],this.disablePlugins=!!o.disablePlugins}register(r,o){let s={requires:"0.0.0",components:{}},i={libs:[],plugged:[],skipped:[],error:void 0};if(this.disablePlugins)return i.error="This instance of TronWeb has plugins disabled.",i;let a=new r(this.tronWeb);if(D.isFunction(a.pluginInterface)&&(s=a.pluginInterface(o)),IA.default.satisfies(ie.version,s.requires))if(s.fullClass){let c=a.constructor.name,u=c.substring(0,1).toLowerCase()+c.substring(1);c!==u&&(Object.assign(ie,{[c]:r}),Object.assign(this.tronWeb,{[u]:a}),i.libs.push(c))}else for(let c in s.components){if(!this.tronWeb.hasOwnProperty(c))continue;let u=s.components[c],l=this.tronWeb[c].pluginNoOverride||[];for(let p in u){if(p==="constructor"||this.tronWeb[c][p]&&(l.includes(p)||/^_/.test(p))){i.skipped.push(p);continue}this.tronWeb[c][p]=u[p].bind(this.tronWeb[c]),i.plugged.push(p)}}else throw new Error("The plugin is not compatible with this version of TronWeb");return i}}});var po,xu=se(()=>{Br();En();Li();po=class{tronWeb;constructor(r){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r}setServer(r,o="healthcheck"){if(!r)return this.tronWeb.eventServer=void 0;if(D.isString(r)&&(r=new ro(r)),!this.tronWeb.isValidProvider(r))throw new Error("Invalid event server provided");this.tronWeb.eventServer=r,this.tronWeb.eventServer.isConnected=()=>this.tronWeb.eventServer.request(o).then(()=>!0).catch(()=>!1)}async getEventsByContractAddress(r,o={}){let s=Object.assign({limit:20},o),{eventName:i,blockNumber:a,onlyUnconfirmed:c,onlyConfirmed:u,minBlockTimestamp:l,maxBlockTimestamp:p,orderBy:A,fingerprint:g}=s,{limit:P}=s;if(!this.tronWeb.eventServer)throw new Error("No event server configured");if(!this.tronWeb.isAddress(r))throw new Error("Invalid contract address provided");if(typeof l<"u"&&!D.isInteger(l))throw new Error("Invalid minBlockTimestamp provided");if(typeof p<"u"&&!D.isInteger(p))throw new Error("Invalid maxBlockTimestamp provided");D.isInteger(P)&&P>200&&(console.warn("Defaulting to maximum accepted limit: 200"),P=200);let b={};i&&(b.event_name=i),a&&(b.block_number=a),typeof c=="boolean"&&(b.only_unconfirmed=c),typeof u=="boolean"&&(b.only_confirmed=u),l&&(b.min_block_timestamp=l),p&&(b.max_block_timestamp=p),A&&(b.order_by=A),g&&(b.fingerprint=g),D.isInteger(P)&&(b.limit=P);let W=await this.tronWeb.eventServer.request(`v1/contracts/${this.tronWeb.address.fromHex(r)}/events?${new URLSearchParams(b).toString()}`);if(W.success)return W;throw new Error(W.error)}async getEventsByTransactionID(r,o={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let s={};return typeof o.only_unconfirmed=="boolean"&&(s.only_unconfirmed=o.only_unconfirmed),typeof o.only_confirmed=="boolean"&&(s.only_confirmed=o.only_confirmed),this.tronWeb.eventServer.request(`v1/transactions/${r}/events?${new URLSearchParams(s).toString()}`).then(i=>{if(i.success)return i;throw new Error(JSON.parse(i.error).message)})}async getEventsByBlockNumber(r,o={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let s={};return typeof o.only_confirmed=="boolean"&&(s.only_confirmed=o.only_confirmed),o.limit&&(s.limit=o.limit),o.fingerprint&&(s.fingerprint=o.fingerprint),this.tronWeb.eventServer.request(`v1/blocks/${r}/events?${new URLSearchParams(s).toString()}`).then(i=>{if(i.success)return i;throw new Error(i.error)})}async getEventsOfLatestBlock(r={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let o={};return typeof r.only_confirmed=="boolean"&&(o.only_confirmed=r.only_confirmed),this.tronWeb.eventServer.request(`v1/blocks/latest/events?${new URLSearchParams(o).toString()}`).then(s=>{if(s.success)return s;throw new Error(s.error)})}}});function RA(n){return!!n&&typeof n=="object"&&(!!n.fullNode||!!n.fullHost)}var da,FA,kA,MA,By,Wy,ie,ca,Br=se(()=>{Li();En();da=require("bignumber.js"),FA=ye(require("eventemitter3"),1),kA=ye(require("semver"),1);Iu();Mu();Ou();Eu();xu();er();Qt();un();MA="4.7.1",By=15e7,Wy="6.0.0";ie=class n extends FA.default{providers;BigNumber;transactionBuilder;trx;plugin;event;version;static version=Wy;utils;defaultBlock;defaultPrivateKey;defaultAddress;fullnodeVersion;feeLimit;fullNode;solidityNode;eventServer;constructor(r,o="",s,i=""){super();let a,c=!1,u=!1;RA(r)?(a=r.fullNode||r.fullHost,o=r.solidityNode||r.fullHost,s=r.eventServer||r.fullHost,c=r.headers||!1,u=r.eventHeaders||c,i=r.privateKey):a=r,D.isString(a)&&(a=new bt.HttpProvider(a)),D.isString(o)&&(o=new bt.HttpProvider(o)),D.isString(s)&&(s=new bt.HttpProvider(s)),this.event=new po(this),this.transactionBuilder=new ao(this),this.trx=new co(this),this.plugin=new lo(this,{disablePlugins:RA(r)?r.disablePlugins:!1}),this.utils=D,this.setFullNode(a),this.setSolidityNode(o),this.setEventServer(s),this.providers=bt,this.BigNumber=da.BigNumber,this.defaultBlock=!1,this.defaultPrivateKey=!1,this.defaultAddress={hex:!1,base58:!1},this.version=n.version,this.sha3=n.sha3,this.fromUtf8=n.fromUtf8,this.address=n.address,this.toAscii=n.toAscii,this.toUtf8=n.toUtf8,this.isAddress=n.isAddress,this.fromAscii=n.fromAscii,this.toHex=n.toHex,this.toBigNumber=n.toBigNumber,this.toDecimal=n.toDecimal,this.fromDecimal=n.fromDecimal,this.toSun=n.toSun,this.fromSun=n.fromSun,this.createAccount=n.createAccount,this.createRandom=n.createRandom,this.fromMnemonic=n.fromMnemonic,i&&this.setPrivateKey(i),this.fullnodeVersion=MA,this.feeLimit=By,c&&this.setFullNodeHeader(c),u&&this.setEventHeader(u)}async getFullnodeVersion(){try{let r=await this.trx.getNodeInfo();this.fullnodeVersion=r.configNodeInfo.codeVersion,this.fullnodeVersion.split(".").length===2&&(this.fullnodeVersion+=".0")}catch{this.fullnodeVersion=MA}}setDefaultBlock(r=!1){if([!1,"latest","earliest",0].includes(r))return this.defaultBlock=r;if(!D.isInteger(r)||!r)throw new Error("Invalid block ID provided");return this.defaultBlock=Math.abs(r)}setPrivateKey(r){try{this.setAddress(n.address.fromPrivateKey(r))}catch{throw new Error("Invalid private key provided")}this.defaultPrivateKey=r,this.emit("privateKeyChanged",r)}setAddress(r){if(!n.isAddress(r))throw new Error("Invalid address provided");let o=n.address.toHex(r),s=n.address.fromHex(r);this.defaultPrivateKey&&n.address.fromPrivateKey(this.defaultPrivateKey)!==s&&(this.defaultPrivateKey=!1),this.defaultAddress={hex:o,base58:s},this.emit("addressChanged",{hex:o,base58:s})}fullnodeSatisfies(r){return kA.default.satisfies(this.fullnodeVersion,r)}isValidProvider(r){return Object.values(bt).some(o=>r instanceof o)}setFullNode(r){if(at(r)&&(r=new bt.HttpProvider(r)),!this.isValidProvider(r))throw new Error("Invalid full node provided");this.fullNode=r,this.fullNode.setStatusPage("wallet/getnowblock")}setSolidityNode(r){if(D.isString(r)&&(r=new bt.HttpProvider(r)),!this.isValidProvider(r))throw new Error("Invalid solidity node provided");this.solidityNode=r,this.solidityNode.setStatusPage("walletsolidity/getnowblock")}setEventServer(r,o){this.event.setServer(r,o)}setHeader(r={}){let o=new bt.HttpProvider(this.fullNode.host,3e4,"","",r),s=new bt.HttpProvider(this.solidityNode.host,3e4,"","",r),i=new bt.HttpProvider(this.eventServer.host,3e4,"","",r);this.setFullNode(o),this.setSolidityNode(s),this.setEventServer(i)}setFullNodeHeader(r={}){let o=new bt.HttpProvider(this.fullNode.host,3e4,"","",r),s=new bt.HttpProvider(this.solidityNode.host,3e4,"","",r);this.setFullNode(o),this.setSolidityNode(s)}setEventHeader(r={}){let o=new bt.HttpProvider(this.eventServer.host,3e4,"","",r);this.setEventServer(o)}currentProviders(){return{fullNode:this.fullNode,solidityNode:this.solidityNode,eventServer:this.eventServer}}currentProvider(){return this.currentProviders()}getEventResult(...r){return this.event.getEventsByContractAddress(...r)}getEventByTransactionID(...r){return this.event.getEventsByTransactionID(...r)}contract(r=[],o){return new uo(this,r,o)}address;static get address(){return{fromHex(r){return Kc(r)},toHex(r){return $(r)},toChecksumAddress(r){return Vi(r)},isChecksumAddress(r){return Xc(r)},fromPrivateKey(r,o=!1){return Yc(r,o)}}}sha3;static sha3(r,o=!0){return(o?"0x":"")+(0,k.keccak256)(Buffer.from(r,"utf-8")).toString().substring(2)}toHex;static toHex(r){if(D.isBoolean(r))return n.fromDecimal(+r);if(D.isBigNumber(r))return n.fromDecimal(r);if(typeof r=="object")return n.fromUtf8(JSON.stringify(r));if(D.isString(r)){if(/^(-|)0x/.test(r))return r;if(!isFinite(r)||/^\s*$/.test(r))return n.fromUtf8(r)}let o=n.fromDecimal(r);if(o==="0xNaN")throw new Error("The passed value is not convertible to a hex string");return o}toUtf8;static toUtf8(r){if(D.isHex(r))return r=r.replace(/^0x/,""),Buffer.from(r,"hex").toString("utf8");throw new Error("The passed value is not a valid hex string")}fromUtf8;static fromUtf8(r){if(!D.isString(r))throw new Error("The passed value is not a valid utf-8 string");return"0x"+Buffer.from(r,"utf8").toString("hex")}toAscii;static toAscii(r){if(D.isHex(r)){let o="",s=0,i=r.length;for(r.substring(0,2)==="0x"&&(s=2);s<i;s+=2){let a=parseInt(r.substr(s,2),16);o+=String.fromCharCode(a)}return o}else throw new Error("The passed value is not a valid hex string")}fromAscii;static fromAscii(r,o){if(!D.isString(r))throw new Error("The passed value is not a valid utf-8 string");return"0x"+Buffer.from(r,"ascii").toString("hex").padEnd(o,"0")}toDecimal;static toDecimal(r){return n.toBigNumber(r).toNumber()}fromDecimal;static fromDecimal(r){let o=n.toBigNumber(r),s=o.toString(16);return o.isLessThan(0)?"-0x"+s.substr(1):"0x"+s}fromSun;static fromSun(r){let o=n.toBigNumber(r).div(1e6);return D.isBigNumber(r)?o:o.toString(10)}toSun;static toSun(r){let o=n.toBigNumber(r).times(1e6);return D.isBigNumber(r)?o:o.toString(10)}toBigNumber;static toBigNumber(r=0){return D.isBigNumber(r)?r:D.isString(r)&&/^(-|)0x/.test(r)?new da.BigNumber(r.replace("0x",""),16):new da.BigNumber(r.toString(10),10)}isAddress;static isAddress(r=""){return to(r)}createAccount;static async createAccount(){return D.accounts.generateAccount()}createRandom;static createRandom(...r){return D.accounts.generateRandom(...r)}fromMnemonic;static fromMnemonic(...r){return D.accounts.generateAccountWithMnemonic(...r)}async isConnected(){return{fullNode:await this.fullNode.isConnected(),solidityNode:await this.solidityNode.isConnected(),eventServer:this.eventServer&&await this.eventServer.isConnected()}}},ca=ie});function Sy(n){return ie.address.toHex(n).replace(pn,"0x")}function vy(n){return ie.address.toHex(n)}function Ry(n){let r=(0,j.getBytes)(n),o=r.length%32;return o?(0,j.concat)([r,DA.slice(o)]):(0,j.hexlify)(r)}function EA(n){return function(r){return(0,j.assertArgument)(typeof r=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,r),r}}function pa(n){{let r=n.match(/^(u?)int(\d*)$/);if(r){let o=r[1]==="",s=parseInt(r[2]||"256");(0,j.assertArgument)(s%8===0&&s!==0&&s<=256&&(r[2]==null||r[2]===String(s)),"invalid numeric width","type",n);let i=(0,j.mask)(My,o?s-1:s),a=o?(i+UA)*Iy:NA;return function(c){let u=(0,j.getBigInt)(c,"value");return(0,j.assertArgument)(u>=a&&u<=i,`value out-of-bounds for ${n}`,"value",u),(0,j.toBeHex)(o?(0,j.toTwos)(u,256):u,32)}}}{let r=n.match(/^bytes(\d+)$/);if(r){let o=parseInt(r[1]);return(0,j.assertArgument)(o!==0&&o<=32&&r[1]===String(o),"invalid bytes width","type",n),function(s){let i=(0,j.getBytes)(s);return(0,j.assertArgument)(i.length===o,`invalid length for ${n}`,"value",s),Ry(s)}}}switch(n){case"trcToken":return pa("uint256");case"address":return function(r){return(0,j.zeroPadValue)(Sy(r),32)};case"bool":return function(r){return r?Fy:ky};case"bytes":return function(r){return(0,j.keccak256)(r)};case"string":return function(r){return(0,j.id)(r)}}return null}function xA(n,r){return`${n}(${r.map(({name:o,type:s})=>s+" "+o).join(",")})`}var j,DA,Iy,NA,UA,My,Fy,ky,OA,Du,Oy,Xo,Aa=se(()=>{Br();j=require("ethers");Qt();DA=new Uint8Array(32);DA.fill(0);Iy=BigInt(-1),NA=BigInt(0),UA=BigInt(1),My=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");Fy=(0,j.toBeHex)(UA,32),ky=(0,j.toBeHex)(NA,32),OA={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Du=["name","version","chainId","verifyingContract","salt"];Oy={name:EA("name"),version:EA("version"),chainId:function(n){let r=(0,j.getBigInt)(n,"domain.chainId");return(0,j.assertArgument)(r>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(r)?Number(r):(0,j.toQuantity)(r)},verifyingContract:function(n){try{return vy(n).toLowerCase()}catch{}(0,j.assertArgument)(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){let r=(0,j.getBytes)(n,"domain.salt");return(0,j.assertArgument)(r.length===32,'invalid domain value "salt"',"domain.salt",n),(0,j.hexlify)(r)}};Xo=class n{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(r){this.#e=JSON.stringify(r),this.#t=new Map,this.#n=new Map;let o=new Map,s=new Map,i=new Map;Object.keys(r).forEach(u=>{o.set(u,new Set),s.set(u,[]),i.set(u,new Set)});for(let u in r){let l=new Set;for(let p of r[u]){(0,j.assertArgument)(!l.has(p.name),`duplicate variable name ${JSON.stringify(p.name)} in ${JSON.stringify(u)}`,"types",r),l.add(p.name);let A=p.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;(0,j.assertArgument)(A!==u,`circular type reference to ${JSON.stringify(A)}`,"types",r),!pa(A)&&((0,j.assertArgument)(s.has(A),`unknown type ${JSON.stringify(A)}`,"types",r),s.get(A).push(u),o.get(u).add(A))}}let a=Array.from(s.keys()).filter(u=>s.get(u).length===0);(0,j.assertArgument)(a.length!==0,"missing primary type","types",r),(0,j.assertArgument)(a.length===1,`ambiguous primary types or unused types: ${a.map(u=>JSON.stringify(u)).join(", ")}`,"types",r),(0,j.defineProperties)(this,{primaryType:a[0]});function c(u,l){(0,j.assertArgument)(!l.has(u),`circular type reference to ${JSON.stringify(u)}`,"types",r),l.add(u);for(let p of o.get(u))if(s.has(p)){c(p,l);for(let A of l)i.get(A).add(p)}l.delete(u)}c(this.primaryType,new Set);for(let[u,l]of i){let p=Array.from(l);p.sort(),this.#t.set(u,xA(u,r[u])+p.map(A=>xA(A,r[A])).join(""))}}getEncoder(r){let o=this.#n.get(r);return o||(o=this.#r(r),this.#n.set(r,o)),o}#r(r){{let i=pa(r);if(i)return i}let o=r.match(/^(.*)(\x5b(\d*)\x5d)$/);if(o){let i=o[1],a=this.getEncoder(i);return c=>{(0,j.assertArgument)(!o[3]||parseInt(o[3])===c.length,`array length mismatch; expected length ${parseInt(o[3])}`,"value",c);let u=c.map(a);return this.#t.has(i)&&(u=u.map(j.keccak256)),(0,j.keccak256)((0,j.concat)(u))}}let s=this.types[r];if(s){let i=(0,j.id)(this.#t.get(r));return a=>{let c=s.map(({name:u,type:l})=>{let p=this.getEncoder(l)(a[u]);return this.#t.has(l)?(0,j.keccak256)(p):p});return c.unshift(i),(0,j.concat)(c)}}(0,j.assertArgument)(!1,`unknown type: ${r}`,"type",r)}encodeType(r){let o=this.#t.get(r);return(0,j.assertArgument)(o,`unknown type: ${JSON.stringify(r)}`,"name",r),o}encodeData(r,o){return this.getEncoder(r)(o)}hashStruct(r,o){return(0,j.keccak256)(this.encodeData(r,o))}encode(r){return this.encodeData(this.primaryType,r)}hash(r){return this.hashStruct(this.primaryType,r)}_visit(r,o,s){if(pa(r))return s(r,o);let i=r.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i)return(0,j.assertArgument)(!i[3]||parseInt(i[3])===o.length,`array length mismatch; expected length ${parseInt(i[3])}`,"value",o),o.map(c=>this._visit(i[1],c,s));let a=this.types[r];if(a)return a.reduce((c,{name:u,type:l})=>(c[u]=this._visit(l,o[u],s),c),{});(0,j.assertArgument)(!1,`unknown type: ${r}`,"type",r)}visit(r,o){return this._visit(this.primaryType,r,o)}static from(r){return new n(r)}static getPrimaryType(r){return n.from(r).primaryType}static hashStruct(r,o,s){return n.from(o).hashStruct(r,s)}static hashDomain(r){let o=[];for(let s in r){if(r[s]==null)continue;let i=OA[s];(0,j.assertArgument)(i,`invalid typed-data domain key: ${JSON.stringify(s)}`,"domain",r),o.push({name:s,type:i})}return o.sort((s,i)=>Du.indexOf(s.name)-Du.indexOf(i.name)),n.hashStruct("EIP712Domain",{EIP712Domain:o},r)}static encode(r,o,s){return(0,j.concat)(["0x1901",n.hashDomain(r),n.from(o).hash(s)])}static hash(r,o,s){return(0,j.keccak256)(n.encode(r,o,s))}static async resolveNames(r,o,s,i){r=Object.assign({},r);for(let u in r)r[u]==null&&delete r[u];let a={};r.verifyingContract&&!(0,j.isHexString)(r.verifyingContract,20)&&(a[r.verifyingContract]="0x");let c=n.from(o);c.visit(s,(u,l)=>(u==="address"&&!(0,j.isHexString)(l,20)&&(a[l]="0x"),l));for(let u in a)a[u]=await i(u);return r.verifyingContract&&a[r.verifyingContract]&&(r.verifyingContract=a[r.verifyingContract]),s=c.visit(s,(u,l)=>u==="address"&&a[l]?a[l]:l),{domain:r,value:s}}static getPayload(r,o,s){n.hashDomain(r);let i={},a=[];Du.forEach(l=>{let p=r[l];p!=null&&(i[l]=Oy[l](p),a.push({name:l,type:OA[l]}))});let c=n.from(o),u=Object.assign({},o);return(0,j.assertArgument)(u.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",o),u.EIP712Domain=a,c.encode(s),{types:u,domain:i,primaryType:c.primaryType,message:c.visit(s,(l,p)=>{if(l.match(/^bytes(\d*)/))return(0,j.hexlify)((0,j.getBytes)(p));if(l.match(/^u?int/))return(0,j.getBigInt)(p).toString();switch(l){case"trcToken":return(0,j.getBigInt)(p).toString();case"address":return p.toLowerCase();case"bool":return!!p;case"string":return(0,j.assertArgument)(typeof p=="string","invalid string","value",p),p}(0,j.assertArgument)(!1,"unsupported type","type",l)})}}}});var _u={};Lt(_u,{ECKeySign:()=>Uu,SHA256:()=>Xr,_signTypedData:()=>Uy,arrayToBase64String:()=>Dy,computeAddress:()=>Ks,decode58Check:()=>jy,decodeBase58Address:()=>Qc,ecRecover:()=>la,genPriKey:()=>Nu,getAddressFromPriKey:()=>Xs,getAddressFromPriKeyBase64String:()=>Gy,getBase58CheckAddress:()=>Cr,getBase58CheckAddressFromPriKeyBase64String:()=>zy,getHexStrAddressFromPriKeyBase64String:()=>Vy,getPubKeyFromPriKey:()=>Ao,getRowBytesFromTransactionBase64:()=>_y,isAddressValid:()=>eu,passwordToAddress:()=>Ly,pkToAddress:()=>Do,sha3:()=>ku,signBytes:()=>Ny,signTransaction:()=>xy});function Ey(n){return gt(it(n).padStart(64,"0"))}function Cr(n){let r=Xr(n),s=Xr(r).slice(0,4);return s=n.concat(s),nu(s)}function Qc(n){if(typeof n!="string"||n.length<=4)return!1;let r=Rs(n);if(n.length<=4)return!1;let s=r.length-4,i=r.slice(s);r=r.slice(0,s);let a=Xr(r),u=Xr(a).slice(0,4);if(i[0]==u[0]&&i[1]==u[1]&&i[2]==u[2]&&i[3]==u[3])return r;throw new Error("Invalid address provided")}function xy(n,r){typeof n=="string"&&(n=gt(n));let o=r.txID,s=Uu(gt(o),n);return Array.isArray(r.signature)?r.signature.includes(s)||r.signature.push(s):r.signature=[s],r}function la(n,r){n="0x"+n.replace(/^0x/,""),r="0x"+r.replace(/^0x/,"");let o=(0,k.recoverAddress)($c(n),k.Signature.from(r));return ht+o.substring(2)}function Dy(n){return btoa(String.fromCharCode(...n))}function Ny(n,r){typeof n=="string"&&(n=gt(n));let o=Xr(r);return Uu(o,n)}function Uy(n,r,o,s){let i=`0x${s.replace(/^0x/,"")}`,a=new k.SigningKey(i),c=Xo.hash(n,r,o),u=a.sign(c);return["0x",u.r.substring(2),u.s.substring(2),Number(u.v).toString(16)].join("")}function _y(n){let r=an(n);return globalThis.proto.protocol.Transaction.deserializeBinary(r).getRawData().serializeBinary()}function Nu(){let n=fa.secp256k1.utils.randomPrivateKey(),r=it(n);return r=r.padStart(64,"0"),gt(r)}function Ks(n){n.length===65&&(n=n.slice(1));let r=(0,k.keccak256)(new Uint8Array(n)).toString().substring(2),o=ht+r.substring(24);return gt(o)}function Xs(n){let r=Ao(n);return Ks(r)}function jy(n){let r=Rs(n);if(r.length<=4)return!1;let o=r.slice(0,r.length-4),s=Xr(o),i=Xr(s);return i[0]===r[o.length]&&i[1]===r[o.length+1]&&i[2]===r[o.length+2]&&i[3]===r[o.length+3]?o:!1}function eu(n){if(typeof n!="string"||n.length!==Jc)return!1;let r=Rs(n);if(r.length!==25||r[0]!==Hc)return!1;let o=r.slice(21);r=r.slice(0,21);let s=Xr(r),a=Xr(s).slice(0,4);return o[0]==a[0]&&o[1]==a[1]&&o[2]==a[2]&&o[3]==a[3]}function zy(n){let r=an(n),o=Ao(r),s=Ks(o);return Cr(s)}function Vy(n){let r=an(n),o=Ao(r),s=Ks(o);return it(s)}function Gy(n){let r=an(n),o=Ao(r),s=Ks(o);return Ws(s)}function Ao(n){let r=fa.secp256k1.ProjectivePoint.fromPrivateKey(new Uint8Array(Ey(n))),o=r.x,s=r.y,i=o.toString(16).padStart(64,"0"),a=s.toString(16).padStart(64,"0"),c=`04${i}${a}`;return gt(c)}function Uu(n,r){let o=fa.secp256k1.sign(it(n),it(r)),s=o.r.toString(16),i=o.s.toString(16),a=o.recovery+27;return s.padStart(64,"0")+i.padStart(64,"0")+Oo(a)}function Xr(n){let r=it(n),o=(0,k.sha256)("0x"+r).replace(/^0x/,"");return gt(o)}function Ly(n){let r=an(n),o=Xs(r);return Cr(o)}function Do(n,r=!1){let o=gt(n,r),s=Xs(o);return Cr(s)}function ku(n,r=!0){return(r?"0x":"")+(0,k.keccak256)(Buffer.from(n,"utf-8")).toString().substring(2)}var fa,Mn=se(()=>{Qt();Eo();Gi();Hn();er();Aa();fa=require("ethereum-cryptography/secp256k1")});var ju={};Lt(ju,{generateAccount:()=>Zy,generateAccountWithMnemonic:()=>Hy,generateRandom:()=>Jy});function Zy(){let n=Nu(),r=Ao(n),o=Xs(n),s=it(n),i=it(r);return{privateKey:s,publicKey:i,address:{base58:Cr(o),hex:it(o)}}}function Jy(n="",r=zi,o){let s=k.HDNodeWallet.createRandom(n,r,o);return{mnemonic:s.mnemonic,privateKey:s.privateKey,publicKey:s.signingKey.publicKey,address:Do(s.privateKey.replace(/^0x/,"")),path:s.path}}function Hy(n,r=zi,o="",s=null){if(!String(r).match(/^m\/44\'\/195\'/))throw new Error($y);let i=k.HDNodeWallet.fromMnemonic(k.Mnemonic.fromPhrase(n,o,s),r);return{mnemonic:i.mnemonic,privateKey:i.privateKey,publicKey:i.signingKey.publicKey,address:Do(i.privateKey.replace(/^0x/,""))}}var $y,zu=se(()=>{Hn();Mn();er();Qt();$y="Invalid tron path provided"});var Gu={};Lt(Gu,{TRON_MESSAGE_PREFIX:()=>_A,hashMessage:()=>Vu,signMessage:()=>Ky,verifyMessage:()=>Xy});function Vu(n){return typeof n=="string"?n=(0,k.toUtf8Bytes)(n):Array.isArray(n)&&(n=new Uint8Array(n)),(0,k.keccak256)((0,k.concat)([(0,k.toUtf8Bytes)(_A),(0,k.toUtf8Bytes)(String(n.length)),n]))}function Ky(n,r){r.match(/^0x/)||(r="0x"+r);let o=new k.SigningKey(r),s=Vu(n),i=o.sign(s);return Lc(i)}function Xy(n,r){r.match(/^0x/)||(r="0x"+r);let o=(0,k.recoverAddress)(Vu(n),r);return Cr(gt(o.replace(/^0x/,ht)))}var _A,Lu=se(()=>{er();Qt();Mn();Eo();_A=`TRON Signed Message:
|
|
5
|
-
`});var Yy,D,En=se(()=>{zu();Qt();Gi();Hn();Mn();Eo();ks();Lu();er();Aa();Js();un();zu();Qt();Gi();Hn();Mn();Eo();ks();Lu();er();Aa();Js();un();Yy={...xc,address:qc,code:kc,accounts:ju,base58:ou,bytes:Rc,crypto:_u,abi:iu,message:Gu,_TypedDataEncoder:Xo,transaction:vu,ethersUtils:Zc},D=Yy});var jA=se(()=>{});var zA=se(()=>{});var VA=se(()=>{});var GA=se(()=>{});var LA=se(()=>{});var $A=se(()=>{});var $u,ZA,JA,HA,KA=se(()=>{(function(n){n[n.BANDWIDTH=0]="BANDWIDTH",n[n.ENERGY=1]="ENERGY",n[n.TRON_POWER=2]="TRON_POWER"})($u||($u={}));(function(n){n.ENOUGH_PERMISSION="ENOUGH_PERMISSION",n.NOT_ENOUGH_PERMISSION="NOT_ENOUGH_PERMISSION",n.SIGNATURE_FORMAT_ERROR="SIGNATURE_FORMAT_ERROR",n.COMPUTE_ADDRESS_ERROR="COMPUTE_ADDRESS_ERROR",n.PERMISSION_ERROR="PERMISSION_ERROR",n.OTHER_ERROR="OTHER_ERROR"})(ZA||(ZA={}));(function(n){n[n.SUCCESS=0]="SUCCESS",n[n.SIGERROR=1]="SIGERROR",n[n.CONTRACT_VALIDATE_ERROR=2]="CONTRACT_VALIDATE_ERROR",n[n.CONTRACT_EXE_ERROR=3]="CONTRACT_EXE_ERROR",n[n.BANDWITH_ERROR=4]="BANDWITH_ERROR",n[n.DUP_TRANSACTION_ERROR=5]="DUP_TRANSACTION_ERROR",n[n.TAPOS_ERROR=6]="TAPOS_ERROR",n[n.TOO_BIG_TRANSACTION_ERROR=7]="TOO_BIG_TRANSACTION_ERROR",n[n.TRANSACTION_EXPIRATION_ERROR=8]="TRANSACTION_EXPIRATION_ERROR",n[n.SERVER_BUSY=9]="SERVER_BUSY",n[n.NO_CONNECTION=10]="NO_CONNECTION",n[n.NOT_ENOUGH_EFFECTIVE_CONNECTION=11]="NOT_ENOUGH_EFFECTIVE_CONNECTION",n[n.OTHER_ERROR=20]="OTHER_ERROR"})(JA||(JA={}));(function(n){n[n.PENDING=0]="PENDING",n[n.DISAPPROVED=1]="DISAPPROVED",n[n.APPROVED=2]="APPROVED",n[n.CANCELED=3]="CANCELED"})(HA||(HA={}))});var XA=se(()=>{});var ma={};Lt(ma,{AccountType:()=>uu,ContractType:()=>pe,Permission_PermissionType:()=>cu,ResourceCode:()=>$u});var YA=se(()=>{jA();zA();lu();VA();GA();LA();$A();KA();XA()});var qA={};Lt(qA,{BigNumber:()=>Zu.BigNumber,Contract:()=>uo,Event:()=>po,Plugin:()=>lo,TransactionBuilder:()=>ao,TronWeb:()=>ie,Trx:()=>co,Types:()=>ma,default:()=>qy,providers:()=>bt,utils:()=>D});var Zu,qy,QA=se(()=>{En();Zu=require("bignumber.js");Li();Iu();Mu();Ou();xu();Eu();Br();YA();qy={utils:D,BigNumber:Zu.BigNumber,providers:bt,TransactionBuilder:ao,Trx:co,Contract:uo,Event:po,Plugin:lo,TronWeb:ie,Types:ma}});function Da(n){try{return(0,xa.fromBase58)(n).length===fb}catch{return!1}}function cr(n){return gb(n)&&hb(n)===ci}function ss(n){return cr(n)}function mb(n){return n.includes("::")?dl(n):n}function dl(n){let[r,o]=n.split("::"),s=n.slice(r.length+o.length+4),i=s.includes("<")?s.slice(0,s.indexOf("<")):s,a=s.includes("<")?(0,xa.splitGenericParameters)(s.slice(s.indexOf("<")+1,s.lastIndexOf(">"))).map(c=>mb(c.trim())):[];return{address:le(r),module:o,name:i,typeParams:a}}function ui(n){let{address:r,module:o,name:s,typeParams:i}=typeof n=="string"?dl(n):n,a=i?.length>0?`<${i.map(c=>typeof c=="string"?c:ui(c)).join(",")}>`:"";return`${r}::${o}::${s}${a}`}function le(n,r=!1){let o=n.toLowerCase();return!r&&o.startsWith("0x")&&(o=o.slice(2)),`0x${o.padStart(ci*2,"0")}`}function Jt(n,r=!1){return le(n,r)}function gb(n){return/^(0x|0X)?[a-fA-F0-9]+$/.test(n)&&n.length%2===0}function hb(n){return/^(0x|0X)/.test(n)?(n.length-2)/2:n.length/2}var xa,fb,ci,Ht=se(()=>{xa=require("@mysten/bcs"),fb=32;ci=32});var Uf,yb,bb,hn,pl=se(()=>{Uf=require("@mysten/bcs");Ht();yb=/^vector<(.+)>$/,bb=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/,hn=class n{static parseFromStr(r,o=!1){if(r==="address")return{address:null};if(r==="bool")return{bool:null};if(r==="u8")return{u8:null};if(r==="u16")return{u16:null};if(r==="u32")return{u32:null};if(r==="u64")return{u64:null};if(r==="u128")return{u128:null};if(r==="u256")return{u256:null};if(r==="signer")return{signer:null};let s=r.match(yb);if(s)return{vector:n.parseFromStr(s[1],o)};let i=r.match(bb);if(i)return{struct:{address:o?le(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:n.parseStructTypeArgs(i[5],o)}};throw new Error(`Encountered unexpected token when parsing type args for ${r}`)}static parseStructTypeArgs(r,o=!1){return(0,Uf.splitGenericParameters)(r).map(s=>n.parseFromStr(s,o))}static tagToString(r){if("bool"in r)return"bool";if("u8"in r)return"u8";if("u16"in r)return"u16";if("u32"in r)return"u32";if("u64"in r)return"u64";if("u128"in r)return"u128";if("u256"in r)return"u256";if("address"in r)return"address";if("signer"in r)return"signer";if("vector"in r)return`vector<${n.tagToString(r.vector)}>`;if("struct"in r){let o=r.struct,s=o.typeParams.map(n.tagToString).join(", ");return`${o.address}::${o.module}::${o.name}${s?`<${s}>`:""}`}throw new Error("Invalid TypeTag")}}});function Tb(n){return I.bcs.u64({name:"unsafe_u64",...n}).transform({input:r=>r,output:r=>Number(r)})}function Pb(n){return I.bcs.enum("Option",{None:null,Some:n})}function Rl(n){return I.bcs.struct(`IntentMessage<${n.name}>`,{intent:Ml,value:n})}var I,ze,ur,Kt,Al,fl,ml,gl,Na,kr,hl,yl,bl,Tl,Pl,wl,Cl,Bl,Wl,Sl,vl,Il,Ml,Fl,kl,Ol,El,_f,wb,xl,jf,zf,Dl=se(()=>{I=require("@mysten/bcs");Ht();pl();ze=I.bcs.bytes(ci).transform({validate:n=>{let r=typeof n=="string"?n:(0,I.toHex)(n);if(!r||!cr(le(r)))throw new Error(`Invalid Sui address ${r}`)},input:n=>typeof n=="string"?(0,I.fromHex)(le(n)):n,output:n=>le((0,I.toHex)(n))}),ur=I.bcs.vector(I.bcs.u8()).transform({name:"ObjectDigest",input:n=>(0,I.fromBase58)(n),output:n=>(0,I.toBase58)(new Uint8Array(n)),validate:n=>{if((0,I.fromBase58)(n).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Kt=I.bcs.struct("SuiObjectRef",{objectId:ze,version:I.bcs.u64(),digest:ur}),Al=I.bcs.struct("SharedObjectRef",{objectId:ze,initialSharedVersion:I.bcs.u64(),mutable:I.bcs.bool()}),fl=I.bcs.enum("ObjectArg",{ImmOrOwnedObject:Kt,SharedObject:Al,Receiving:Kt}),ml=I.bcs.enum("CallArg",{Pure:I.bcs.struct("Pure",{bytes:I.bcs.vector(I.bcs.u8()).transform({input:n=>typeof n=="string"?(0,I.fromBase64)(n):n,output:n=>(0,I.toBase64)(new Uint8Array(n))})}),Object:fl}),gl=I.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:I.bcs.lazy(()=>gl),struct:I.bcs.lazy(()=>wl),u16:null,u32:null,u256:null}),Na=gl.transform({input:n=>typeof n=="string"?hn.parseFromStr(n,!0):n,output:n=>hn.tagToString(n)}),kr=I.bcs.enum("Argument",{GasCoin:null,Input:I.bcs.u16(),Result:I.bcs.u16(),NestedResult:I.bcs.tuple([I.bcs.u16(),I.bcs.u16()])}),hl=I.bcs.struct("ProgrammableMoveCall",{package:ze,module:I.bcs.string(),function:I.bcs.string(),typeArguments:I.bcs.vector(Na),arguments:I.bcs.vector(kr)}),yl=I.bcs.enum("Command",{MoveCall:hl,TransferObjects:I.bcs.struct("TransferObjects",{objects:I.bcs.vector(kr),address:kr}),SplitCoins:I.bcs.struct("SplitCoins",{coin:kr,amounts:I.bcs.vector(kr)}),MergeCoins:I.bcs.struct("MergeCoins",{destination:kr,sources:I.bcs.vector(kr)}),Publish:I.bcs.struct("Publish",{modules:I.bcs.vector(I.bcs.vector(I.bcs.u8()).transform({input:n=>typeof n=="string"?(0,I.fromBase64)(n):n,output:n=>(0,I.toBase64)(new Uint8Array(n))})),dependencies:I.bcs.vector(ze)}),MakeMoveVec:I.bcs.struct("MakeMoveVec",{type:Pb(Na).transform({input:n=>n===null?{None:!0}:{Some:n},output:n=>n.Some??null}),elements:I.bcs.vector(kr)}),Upgrade:I.bcs.struct("Upgrade",{modules:I.bcs.vector(I.bcs.vector(I.bcs.u8()).transform({input:n=>typeof n=="string"?(0,I.fromBase64)(n):n,output:n=>(0,I.toBase64)(new Uint8Array(n))})),dependencies:I.bcs.vector(ze),package:ze,ticket:kr})}),bl=I.bcs.struct("ProgrammableTransaction",{inputs:I.bcs.vector(ml),commands:I.bcs.vector(yl)}),Tl=I.bcs.enum("TransactionKind",{ProgrammableTransaction:bl,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Pl=I.bcs.enum("TransactionExpiration",{None:null,Epoch:Tb()}),wl=I.bcs.struct("StructTag",{address:ze,module:I.bcs.string(),name:I.bcs.string(),typeParams:I.bcs.vector(gl)}),Cl=I.bcs.struct("GasData",{payment:I.bcs.vector(Kt),owner:ze,price:I.bcs.u64(),budget:I.bcs.u64()}),Bl=I.bcs.struct("TransactionDataV1",{kind:Tl,sender:ze,gasData:Cl,expiration:Pl}),Wl=I.bcs.enum("TransactionData",{V1:Bl}),Sl=I.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),vl=I.bcs.enum("IntentVersion",{V0:null}),Il=I.bcs.enum("AppId",{Sui:null}),Ml=I.bcs.struct("Intent",{scope:Sl,version:vl,appId:Il});Fl=I.bcs.enum("CompressedSignature",{ED25519:I.bcs.fixedArray(64,I.bcs.u8()),Secp256k1:I.bcs.fixedArray(64,I.bcs.u8()),Secp256r1:I.bcs.fixedArray(64,I.bcs.u8()),ZkLogin:I.bcs.vector(I.bcs.u8())}),kl=I.bcs.enum("PublicKey",{ED25519:I.bcs.fixedArray(32,I.bcs.u8()),Secp256k1:I.bcs.fixedArray(33,I.bcs.u8()),Secp256r1:I.bcs.fixedArray(33,I.bcs.u8()),ZkLogin:I.bcs.vector(I.bcs.u8())}),Ol=I.bcs.struct("MultiSigPkMap",{pubKey:kl,weight:I.bcs.u8()}),El=I.bcs.struct("MultiSigPublicKey",{pk_map:I.bcs.vector(Ol),threshold:I.bcs.u16()}),_f=I.bcs.struct("MultiSig",{sigs:I.bcs.vector(Fl),bitmap:I.bcs.u16(),multisig_pk:El}),wb=I.bcs.vector(I.bcs.u8()).transform({input:n=>typeof n=="string"?(0,I.fromBase64)(n):n,output:n=>(0,I.toBase64)(new Uint8Array(n))}),xl=I.bcs.struct("SenderSignedTransaction",{intentMessage:Rl(Wl),txSignatures:I.bcs.vector(wb)}),jf=I.bcs.vector(xl,{name:"SenderSignedData"}),zf=I.bcs.struct("PasskeyAuthenticator",{authenticatorData:I.bcs.vector(I.bcs.u8()),clientDataJson:I.bcs.string(),userSignature:I.bcs.vector(I.bcs.u8())})});var M,Cb,Bb,Vf,Wb,Sb,vb,Gf,Lf,is,Ib,Nl,Mb,Rb,Fb,kb,Ob,Eb,$f,Zf=se(()=>{M=require("@mysten/bcs");Dl();Cb=M.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:M.bcs.struct("UnableToFetchPackage",{packageId:ze}),NotAPackage:M.bcs.struct("NotAPackage",{objectId:ze}),IncompatibleUpgrade:null,DigestDoesNotMatch:M.bcs.struct("DigestDoesNotMatch",{digest:M.bcs.vector(M.bcs.u8())}),UnknownUpgradePolicy:M.bcs.struct("UnknownUpgradePolicy",{policy:M.bcs.u8()}),PackageIDDoesNotMatch:M.bcs.struct("PackageIDDoesNotMatch",{packageId:ze,ticketId:ze})}),Bb=M.bcs.struct("ModuleId",{address:ze,name:M.bcs.string()}),Vf=M.bcs.struct("MoveLocation",{module:Bb,function:M.bcs.u16(),instruction:M.bcs.u16(),functionName:M.bcs.option(M.bcs.string())}),Wb=M.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:M.bcs.struct("IndexOutOfBounds",{idx:M.bcs.u16()}),SecondaryIndexOutOfBounds:M.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:M.bcs.u16(),secondaryIdx:M.bcs.u16()}),InvalidResultArity:M.bcs.struct("InvalidResultArity",{resultIdx:M.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),Sb=M.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),vb=M.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:M.bcs.struct("MoveObjectTooBig",{objectSize:M.bcs.u64(),maxObjectSize:M.bcs.u64()}),MovePackageTooBig:M.bcs.struct("MovePackageTooBig",{objectSize:M.bcs.u64(),maxObjectSize:M.bcs.u64()}),CircularObjectOwnership:M.bcs.struct("CircularObjectOwnership",{object:ze}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:M.bcs.option(Vf),MoveAbort:M.bcs.tuple([Vf,M.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:M.bcs.struct("CommandArgumentError",{argIdx:M.bcs.u16(),kind:Wb}),TypeArgumentError:M.bcs.struct("TypeArgumentError",{argumentIdx:M.bcs.u16(),kind:Sb}),UnusedValueWithoutDrop:M.bcs.struct("UnusedValueWithoutDrop",{resultIdx:M.bcs.u16(),secondaryIdx:M.bcs.u16()}),InvalidPublicFunctionReturnType:M.bcs.struct("InvalidPublicFunctionReturnType",{idx:M.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:M.bcs.struct("EffectsTooLarge",{currentSize:M.bcs.u64(),maxSize:M.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:M.bcs.struct("PackageUpgradeError",{upgradeError:Cb}),WrittenObjectsTooLarge:M.bcs.struct("WrittenObjectsTooLarge",{currentSize:M.bcs.u64(),maxSize:M.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:M.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:M.bcs.vector(ze)}),AddressDeniedForCoin:M.bcs.struct("AddressDeniedForCoin",{address:ze,coinType:M.bcs.string()}),CoinTypeGlobalPause:M.bcs.struct("CoinTypeGlobalPause",{coinType:M.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Gf=M.bcs.enum("ExecutionStatus",{Success:null,Failed:M.bcs.struct("ExecutionFailed",{error:vb,command:M.bcs.option(M.bcs.u64())})}),Lf=M.bcs.struct("GasCostSummary",{computationCost:M.bcs.u64(),storageCost:M.bcs.u64(),storageRebate:M.bcs.u64(),nonRefundableStorageFee:M.bcs.u64()}),is=M.bcs.enum("Owner",{AddressOwner:ze,ObjectOwner:ze,Shared:M.bcs.struct("Shared",{initialSharedVersion:M.bcs.u64()}),Immutable:null}),Ib=M.bcs.struct("TransactionEffectsV1",{status:Gf,executedEpoch:M.bcs.u64(),gasUsed:Lf,modifiedAtVersions:M.bcs.vector(M.bcs.tuple([ze,M.bcs.u64()])),sharedObjects:M.bcs.vector(Kt),transactionDigest:ur,created:M.bcs.vector(M.bcs.tuple([Kt,is])),mutated:M.bcs.vector(M.bcs.tuple([Kt,is])),unwrapped:M.bcs.vector(M.bcs.tuple([Kt,is])),deleted:M.bcs.vector(Kt),unwrappedThenDeleted:M.bcs.vector(Kt),wrapped:M.bcs.vector(Kt),gasObject:M.bcs.tuple([Kt,is]),eventsDigest:M.bcs.option(ur),dependencies:M.bcs.vector(ur)}),Nl=M.bcs.tuple([M.bcs.u64(),ur]),Mb=M.bcs.enum("ObjectIn",{NotExist:null,Exist:M.bcs.tuple([Nl,is])}),Rb=M.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:M.bcs.tuple([ur,is]),PackageWrite:Nl}),Fb=M.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),kb=M.bcs.struct("EffectsObjectChange",{inputState:Mb,outputState:Rb,idOperation:Fb}),Ob=M.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Nl,MutateDeleted:M.bcs.u64(),ReadDeleted:M.bcs.u64(),Cancelled:M.bcs.u64(),PerEpochConfig:null}),Eb=M.bcs.struct("TransactionEffectsV2",{status:Gf,executedEpoch:M.bcs.u64(),gasUsed:Lf,transactionDigest:ur,gasObjectIndex:M.bcs.option(M.bcs.u32()),eventsDigest:M.bcs.option(ur),dependencies:M.bcs.vector(ur),lamportVersion:M.bcs.u64(),changedObjects:M.bcs.vector(M.bcs.tuple([ze,kb])),unchangedSharedObjects:M.bcs.vector(M.bcs.tuple([ze,Ob])),auxDataDigest:M.bcs.option(ur)}),$f=M.bcs.enum("TransactionEffects",{V1:Ib,V2:Eb})});var Or,xb,R,Pt=se(()=>{Or=require("@mysten/bcs");Dl();Zf();pl();xb=require("@mysten/bcs"),R={...Or.bcs,U8:Or.bcs.u8(),U16:Or.bcs.u16(),U32:Or.bcs.u32(),U64:Or.bcs.u64(),U128:Or.bcs.u128(),U256:Or.bcs.u256(),ULEB128:Or.bcs.uleb128(),Bool:Or.bcs.bool(),String:Or.bcs.string(),Address:ze,AppId:Il,Argument:kr,CallArg:ml,CompressedSignature:Fl,GasData:Cl,Intent:Ml,IntentMessage:Rl,IntentScope:Sl,IntentVersion:vl,MultiSig:_f,MultiSigPkMap:Ol,MultiSigPublicKey:El,ObjectArg:fl,ObjectDigest:ur,ProgrammableMoveCall:hl,ProgrammableTransaction:bl,PublicKey:kl,SenderSignedData:jf,SenderSignedTransaction:xl,SharedObjectRef:Al,StructTag:wl,SuiObjectRef:Kt,Command:yl,TransactionData:Wl,TransactionDataV1:Bl,TransactionExpiration:Pl,TransactionKind:Tl,TypeTag:Na,TransactionEffects:$f,PasskeyAuthenticator:zf}});function jT(n,r=["<",">"]){let[o,s]=r,i=[],a="",c=0;for(let u=0;u<n.length;u++){let l=n[u];if(l===o&&c++,l===s&&c--,c===0&&l===","){i.push(a.trim()),a="";continue}a+=l}return i.push(a.trim()),i}function kt(n){if(typeof n!="string")throw new Error(`Illegal type passed as a name of the type: ${n}`);let[r,o]=["<",">"],s=n.indexOf(r),i=Array.from(n).reverse().indexOf(o);if(s===-1&&i===-1)return{typeName:n,typeArgs:[]};if(s===-1||i===-1)throw new Error(`Unclosed generic in name '${n}'`);let a=n.slice(0,s),c=jT(n.slice(s+1,n.length-i-1),[r,o]);return{typeName:a,typeArgs:c}}function ym(n){return!n||typeof n!="object"||Array.isArray(n)?!1:"GasCoin"in n||"Input"in n||"Result"in n||"NestedResult"in n}function ce(n,r){return ym(r)?r:n.object(r)}function br(n,r,o){if(ym(r))return ce(n,r);function s(p){let{typeName:A,typeArgs:g}=kt(p);switch(A){case"bool":return R.Bool;case"u8":return R.U8;case"u16":return R.U16;case"u32":return R.U32;case"u64":return R.U64;case"u128":return R.U128;case"u256":return R.U256;case"address":return R.Address;case"0x1::string::String":case"0x1::ascii::String":return R.String;case"0x2::object::ID":return R.Address;case"0x1::option::Option":return R.option(s(g[0]));case"vector":return R.vector(s(g[0]));default:throw new Error(`invalid primitive type ${p}`)}}function i(p){for(let A of p){if(typeof A>"u"||A===null)return!0;if(Array.isArray(A))return i(A)}return!1}function a(p){for(let A of p){if(!Array.isArray(A)){if(A===null)continue;switch(typeof A){case"string":case"number":case"bigint":case"boolean":continue;default:return!1}}return a(A)}return!0}function c(p){for(let A of p){if(!Array.isArray(A))switch(typeof A){case"string":case"number":case"bigint":case"boolean":return!0;default:continue}return c(A)}return!1}let{typeName:u,typeArgs:l}=kt(o);switch(u){case"0x1::option::Option":if(r===null)return n.pure.option("bool",null);if(a([r]))return n.pure(s(o).serialize(r));if(c([r]))throw new Error("mixing primitive and TransactionArgument values is not supported");return n.moveCall({target:"0x1::option::some",typeArguments:[l[0]],arguments:[br(n,r,l[0])]});case"vector":if(!Array.isArray(r))throw new Error("expected an array for vector type");if(r.length===0)return n.pure(R.vector(R.Bool).serialize([]));if(i(r))throw new Error("the provided array contains undefined or null values");if(a(r))return n.pure(s(o).serialize(r));if(c(r))throw new Error("mixing primitive and TransactionArgument values is not supported");return n.makeMoveVec({type:l[0],elements:r});default:return n.pure(s(o).serialize(r))}}function zT(n){let r=n.split("0x").join("");for(let o=0;o<r.length;o++)if(r[o]!=="0")return`0x${r.substring(o)}`;return"0x0"}function ne(n){let{typeName:r,typeArgs:o}=kt(n);switch(r){case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":case"address":case"signer":return r;case"vector":return`vector<${ne(o[0])}>`;default:{let s=r.split("::");s[0]=zT(s[0]);let i=s.join("::");return o.length>0?`${i}<${o.map(a=>ne(a)).join(",")}>`:i}}}function ve(n,...r){return r.length>0?`${n}<${r.join(", ")}>`:n}var wt=se(()=>{"use strict";Pt()});var Gn=Et((DI,bm)=>{"use strict";wt();var ed=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},VT=new ed;bm.exports=VT});var od=Et((jI,Sm)=>{"use strict";wt();var nd=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},GT=new nd;Sm.exports=GT});var ad=Et((LI,Im)=>{"use strict";wt();var id=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},LT=new id;Im.exports=LT});var dP={};Lt(dP,{AddressStatus:()=>Ii,AllbridgeCoreSdk:()=>hd,AmountFormat:()=>qs,AmountNotEnoughError:()=>$n,ArgumentInvalidDecimalsError:()=>bs,CCTPDoesNotSupportedError:()=>Ct,ChainSymbol:()=>Yt,ChainType:()=>Ge,ErrorCode:()=>bd,ExtraGasMaxLimitExceededError:()=>ys,FeePaymentMethod:()=>Nn,InsufficientPoolLiquidityError:()=>Lr,InvalidAmountError:()=>Gr,InvalidGasFeePaymentOptionError:()=>Mo,InvalidMessengerOptionError:()=>Cc,InvalidTxError:()=>Zn,JupiterError:()=>mt,Messenger:()=>wr,MethodNotSupportedError:()=>st,NodeRpcUrlNotInitializedError:()=>Ts,SdkError:()=>_,SdkRootError:()=>et,SolanaAutoTxFee:()=>Ba,TimeoutError:()=>Fo,TxTooLargeError:()=>Ps,VerifyTxError:()=>Ro,mainnet:()=>hs,nodeRpcUrlsDefault:()=>ig,nodeUrlsDefault:()=>sg});module.exports=og(dP);var hs={coreApiUrl:"https://core.api.allbridgecoreapi.net",coreApiQueryParams:{},coreApiHeaders:{},jupiterUrl:"https://lite-api.jup.ag/swap/v1",wormholeMessengerProgramId:"worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth",solanaLookUpTable:"2JcBAEVnAwVo4u8d61iqgHPrzZuugur7cVTjWubsVLHj",sorobanNetworkPassphrase:"Public Global Stellar Network ; September 2015",tronJsonRpc:"https://api.trongrid.io/jsonrpc",cctpParams:{cctpTransmitterProgramId:"CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd",cctpTokenMessengerMinter:"CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3",cctpDomains:{ETH:0,AVA:1,OPT:2,ARB:3,SOL:5,BAS:6,POL:7,SUI:8}},cachePoolInfoChainSec:20},sg={solanaRpcUrl:"https://api.mainnet-beta.solana.com",tronRpcUrl:"https://api.trongrid.io"},ig={SOL:"https://api.mainnet-beta.solana.com",TRX:"https://api.trongrid.io",SRB:"https://rpc.stellar.org:443",STLR:"https://horizon.stellar.org",SUI:"https://fullnode.mainnet.sui.io"};var zt=require("big.js");var et=class extends Error{errorCode;constructor(r,o){super(o),this.errorCode=r}},_=class extends et{constructor(r){super("SdkError",r)}},Gr=class extends et{constructor(r){super("InvalidAmountError",r)}},$n=class extends et{constructor(r){super("AmountNotEnoughError",r)}},Lr=class extends et{constructor(r){super("InsufficientPoolLiquidityError",r)}},mt=class extends et{constructor(r){super("JupiterError",r)}},Mo=class extends et{constructor(r){super("InvalidGasFeePaymentOptionError",r)}},Cc=class extends et{constructor(r){super("InvalidMessengerOptionError",r)}},st=class extends et{constructor(r){super("MethodNotSupportedError",r)}},Ro=class extends et{constructor(r){super("VerifyTxError",r)}},Zn=class extends et{constructor(r){super("InvalidTxError",r)}},ys=class extends et{constructor(r){super("ExtraGasMaxLimitExceededError",r)}},bs=class extends et{constructor(r,o,s){super("ArgumentInvalidDecimalsError",`Argument '${r}' decimals '${o}' cannot be greater than '${s}'`)}},Fo=class extends et{constructor(r){super("TimeoutError",r)}},Ts=class extends et{constructor(r){super("NodeRpcUrlNotInitializedError",`For chain '${r}' Node RPC URL not initialized`)}},Ct=class extends et{constructor(r){super("CCTPDoesNotSupportedError",r)}},Ps=class extends et{constructor(){super("TxTooLargeError","Transaction too large: try again later or switch to another messenger or pay relayer fee in native gas currency")}},bd=(F=>(F.SDK_ERROR="SdkError",F.INVALID_AMOUNT_ERROR="InvalidAmountError",F.AMOUNT_NOT_ENOUGH_ERROR="AmountNotEnoughError",F.INSUFFICIENT_POOL_LIQUIDITY_ERROR="InsufficientPoolLiquidityError",F.JUPITER_ERROR="JupiterError",F.INVALID_GAS_FEE_PAYMENT_OPTION_ERROR="InvalidGasFeePaymentOptionError",F.INVALID_MESSENGER_OPTION_ERROR="InvalidMessengerOptionError",F.METHOD_NOT_SUPPORTED_ERROR="MethodNotSupportedError",F.VERIFY_TX_ERROR="VerifyTxError",F.INVALID_TX_ERROR="InvalidTxError",F.EXTRA_GAS_MAX_LIMIT_EXCEEDED_ERROR="ExtraGasMaxLimitExceededError",F.ARGUMENT_INVALID_DECIMALS_ERROR="ArgumentInvalidDecimalsError",F.TIMEOUT_ERROR="TimeoutError",F.NODE_RPC_URL_NOT_INITIALIZED_ERROR="NodeRpcUrlNotInitializedError",F.CCTP_DOES_NOT_SUPPORTED_ERROR="CCTPDoesNotSupportedError",F.TX_TOO_LARGE="TxTooLargeError",F))(bd||{});var Yt=(b=>(b.BSC="BSC",b.ETH="ETH",b.BAS="BAS",b.SOL="SOL",b.TRX="TRX",b.POL="POL",b.ARB="ARB",b.CEL="CEL",b.AVA="AVA",b.SRB="SRB",b.STLR="STLR",b.OPT="OPT",b.SUI="SUI",b))(Yt||{}),Ge=(a=>(a.EVM="EVM",a.SOLANA="SOLANA",a.TRX="TRX",a.SRB="SRB",a.SUI="SUI",a))(Ge||{});var ag={EVM:18,SOLANA:9,TRX:6,SRB:7,SUI:9},cg={BSC:{chainSymbol:"BSC",chainId:"0x38",name:"BNB Chain",chainType:"EVM"},ETH:{chainSymbol:"ETH",chainId:"0x1",name:"Ethereum",chainType:"EVM"},BAS:{chainSymbol:"BAS",chainId:"0x2105",name:"Base",chainType:"EVM"},ARB:{chainSymbol:"ARB",chainId:"0xa4b1",name:"Arbitrum",chainType:"EVM"},AVA:{chainSymbol:"AVA",chainId:"0xa86a",name:"Avalanche",chainType:"EVM"},CEL:{chainSymbol:"CEL",chainId:"0xa4ec",name:"Celo",chainType:"EVM"},POL:{chainSymbol:"POL",chainId:"0x89",name:"Polygon",chainType:"EVM"},OPT:{chainSymbol:"OPT",chainId:"0xa",name:"OP Mainnet",chainType:"EVM"},SOL:{chainSymbol:"SOL",name:"Solana",chainType:"SOLANA"},TRX:{chainSymbol:"TRX",name:"Tron",chainType:"TRX"},SRB:{chainSymbol:"SRB",name:"Stellar",chainType:"SRB"},STLR:{chainSymbol:"STLR",name:"Stellar",chainType:"SRB"},SUI:{chainSymbol:"SUI",name:"Sui",chainType:"SUI"}},Me=(()=>{let n={...cg};return{addChainsProperties(r){n={...n,...r}},getChainProperty(r){let o=n[r];if(!o)throw new _(`Cannot find chain properties for ${r}`);return o},getChainsProperties(){return n},getChainDecimalsByType(r){return ag[r]}}})();var Fd=ye(require("axios"));var Td="3.22.1-alpha.1";var Z=require("big.js"),vi=ye(require("bn.js"));function Bc(n,r){return(0,Z.Big)(100).minus((0,Z.Big)(100).times(r).div(n)).toNumber()}function Jn(n,r){return $r(n,r,3).round(0,Z.Big.roundDown)}function qt(n,r){return $r(n,3,r)}function $r(n,r,o){let s=(0,Z.Big)(o).minus(r).toNumber();return(0,Z.Big)(n).times(ws(s))}function ws(n){return(0,Z.Big)(10).pow(n)}function Ee(n,r){return(0,Z.Big)(n).times(ws(r))}function we(n,r){let o=(0,Z.Big)(n);return o.eq(0)?(0,Z.Big)(0):(0,Z.Big)(o).div(ws(r))}function xt(n){return we((0,Z.Big)(n.tokenBalance).minus(n.vUsdBalance).toFixed(),3).div(2).toFixed()}function Zr(n,{feeShare:r,decimals:o},s){let i=(0,Z.Big)(n);if(i.lte(0))return"0";let a=i.times(r),c=i.minus(a),u=Jn(c,o),l=(0,Z.Big)(s.tokenBalance).plus(u),p=Jr(l,s.aValue,s.dValue);return(0,Z.Big)(s.vUsdBalance).minus(p).round(0,Z.Big.roundDown).toFixed()}function Cs(n,{feeShare:r,decimals:o},s){let i=(0,Z.Big)(n);if(i.lte(0))return(0,Z.Big)(0).toFixed();let a=i.plus(s.vUsdBalance),c=Jr(a,s.aValue,s.dValue),u=qt((0,Z.Big)(s.tokenBalance).minus(c),o),l=(0,Z.Big)(u).times(r);return(0,Z.Big)(u).minus(l).round(0,Z.Big.roundDown).toFixed()}function Pd(n,r){let o=(0,Z.Big)(n);if(o.lte(0))return r;let s=o.plus(r.vUsdBalance),i=Jr(s,r.aValue,r.dValue);return{aValue:r.aValue,dValue:r.dValue,tokenBalance:i.toFixed(0),vUsdBalance:s.toFixed(0)}}function wd(n,{feeShare:r,decimals:o},s){if((0,Z.Big)(n).lte(0))return(0,Z.Big)(0);let i=(0,Z.Big)(s.vUsdBalance).minus(n);if(i.lte(0))throw new Lr;let a=Jr(i,s.aValue,s.dValue),c=(0,Z.Big)(a).minus(s.tokenBalance),u=qt(c,o),l=(0,Z.Big)(r).div((0,Z.Big)(1).minus(r)),p=(0,Z.Big)(u).times(l).round(0,Z.Big.roundUp);return(0,Z.Big)(u).plus(p).round(0,Z.Big.roundDown)}function Cd(n,{feeShare:r,decimals:o},s){if((0,Z.Big)(n).lte(0))return(0,Z.Big)(0);let i=(0,Z.Big)(r).div((0,Z.Big)(1).minus(r)),a=(0,Z.Big)(n).times(i).round(0,Z.Big.roundUp),c=(0,Z.Big)(n).plus(a),u=Jn(c,o),l=(0,Z.Big)(s.tokenBalance).minus(u);if(l.lte(0))throw new Lr;let p=Jr(l,s.aValue,s.dValue);return(0,Z.Big)(p).minus(s.vUsdBalance).round(0,Z.Big.roundDown)}function Jr(n,r,o){let s=(0,Z.Big)(4).times(r).times((0,Z.Big)(o).minus(n)).minus(o),i=(0,Z.Big)(o).pow(3),a=s.pow(2),c=(0,Z.Big)(n).times((0,Z.Big)(n).times(a).plus((0,Z.Big)(4).times(r).times(i))).sqrt().round(0,Z.Big.roundDown),u=(0,Z.Big)(8).times(r).times(n),l=s.times(n).plus(c).div(u).round(0,Z.Big.roundDown);return l.eq(0)?(0,Z.Big)(0):l.plus(1)}function Bd(n,r,o,s){let i=new vi.default(n),a=new vi.default(o),c=new vi.default(r);return i.mul(a).shrn(s).sub(c).toString()}function Wd(n){return(0,Z.Big)(n).gt(0)?`${Number((0,Z.Big)(n).times(100).toFixed(2)).toLocaleString()}%`:"N/A"}function Sd(n,r,o){let s=(0,Z.Big)(r).times(o),i=(0,Z.Big)(r).plus(o),a=(0,Z.Big)(8).times(n).times(s).times(i),c=s.times((0,Z.Big)(16).times(n).minus(4)).div(3),u=a.times(a),l=c.times(c).times(c),p=u.plus(l),A=(0,Z.Big)(p).sqrt(),g=(0,Z.Big)(Math.cbrt(+a.plus(A).toFixed())),P=(0,Z.Big)(Math.cbrt(+a.minus(A).toFixed()));return g.plus(P).toFixed()}var Ii=(c=>(c.OK="OK",c.INVALID="INVALID",c.FORBIDDEN="FORBIDDEN",c.UNINITIALIZED="UNINITIALIZED",c.CONTRACT_ADDRESS="CONTRACT_ADDRESS",c.WRONG_ASSOCIATED_ACCOUNT_OWNER="WRONG_ASSOCIATED_ACCOUNT_OWNER",c))(Ii||{});var wr=(i=>(i[i.ALLBRIDGE=1]="ALLBRIDGE",i[i.WORMHOLE=2]="WORMHOLE",i[i.CCTP=3]="CCTP",i[i.CCTP_V2=4]="CCTP_V2",i))(wr||{});function vd(n){return Object.entries(n).reduce((r,o)=>{let s=o[0],i=o[1],a=Ag(s,i);return a&&(r[s]=a),r},{})}function Id(n){let r={};for(let[o,s]of Object.entries(n)){let i=o;for(let a of s.tokens){let c=ko({chainSymbol:i,poolAddress:a.poolAddress}),u=xt(a.poolInfo);r[c]={...a.poolInfo,imbalance:u}}}return r}function ug(n,r){let{name:o,...s}=n,{poolInfo:i,...a}=r;return{...a,...s,chainName:o}}function lg(n){switch(n){case"allbridge":return 1;case"wormhole":return 2;case"cctp":return 3;case"cctpV2":return 4}}function dg(n){return Object.entries(n).reduce((r,[o,s])=>(r[o]=pg(s),r),{})}function pg(n){return Object.entries(n).reduce((r,[o,s])=>{let i=lg(o);return i&&(r[i]=s),r},{})}function Ag(n,r){let o=Me.getChainsProperties()[n];if(!o)return null;let s={...o,allbridgeChainId:r.chainId,bridgeAddress:r.bridgeAddress,transferTime:dg(r.transferTime),txCostAmount:r.txCostAmount,confirmations:r.confirmations,suiAddresses:r.suiAddresses};return{...s,tokens:r.tokens.map(i=>ug(s,i))}}function ko(n){return n.chainSymbol+"_"+n.poolAddress}function Md(n){let r=[];for(let[o,s]of Object.entries(n)){let i=o;for(let a of s.tokens)r.push({chainSymbol:i,poolAddress:a.poolAddress})}return r}function Rd(n){let r={};for(let[o,s]of Object.entries(n)){let i=o;for(let[a,c]of Object.entries(s))c.imbalance=xt(c),r[ko({chainSymbol:i,poolAddress:a})]=c}return r}var Mi=class{api;constructor(r){this.api=Fd.default.create({baseURL:r.coreApiUrl,headers:{Accept:"application/json",...r.coreApiHeaders,"x-Sdk-Agent":"AllbridgeCoreSDK/"+Td},params:r.coreApiQueryParams})}async getTokenInfo(){let{data:r}=await this.api.get("/token-info",{params:{filter:"all"}});return{chainDetailsMap:vd(r),poolInfoMap:Id(r)}}async getPendingInfo(){let{data:r}=await this.api.get("/pending-info");return r}async getGasBalance(r,o){let{data:s}=await this.api.get(`/check/${r}/${o}`);return s}async getTransferStatus(r,o){let{data:s}=await this.api.get(`/chain/${r}/${o}`);return s}async getReceiveTransactionCost(r){let{data:o}=await this.api.post("/receive-fee",r,{headers:{"Content-Type":"application/json"}});return{exchangeRate:o.exchangeRate,fee:o.fee,sourceNativeTokenPrice:o.sourceNativeTokenPrice}}async getPoolInfoMap(r){let o=r instanceof Array?r:[r],{data:s}=await this.api.post("/pool-info",{pools:o},{headers:{"Content-Type":"application/json"}});return Rd(s)}};var fg=(n,r)=>n!==null&&Object.prototype.hasOwnProperty.call(n,r),kd="__cache__",Wc=function(n){return typeof n!="string"?kd+JSON.stringify(n):kd+n},Sc=class{constructor(r={defaultTtl:60*1e3}){this.cache={},this.defaultTtl=r.defaultTtl||60*1e3}put(r,o,s){let i=(s?s.ttl:void 0)||this.defaultTtl,a=(s?s.callback:void 0)||function(){},c=Wc(r),u=this.cache[c];u&&clearTimeout(u.handle);let l=setTimeout(()=>this.remove(r),i);this.cache[c]={handle:l,data:o,callback:a}}get(r){let o=this.cache[Wc(r)];return o&&o.data}remove(r){let o=Wc(r),s=this.cache[o];s&&(clearTimeout(s.handle),delete this.cache[o],s.callback(r,s.data))}clear(){for(let r in this.cache)fg(this.cache,r)&&clearTimeout(this.cache[r].handle);this.cache={}}size(){return Object.keys(this.cache).length}},sn=Sc;var vc=20*1e3,mg=55*1e3,Ri=class{constructor(r){this.apiClient=r;this.tokenInfoCache=new sn({defaultTtl:mg}),this.receivedTransactionCache=new sn({defaultTtl:vc}),this.pendingInfoCache=new sn({defaultTtl:vc}),this.gasBalanceCache=new sn({defaultTtl:vc})}tokenInfoCache;pendingInfoCache;gasBalanceCache;receivedTransactionCache;getTokenInfo(){let r="TOKEN_INFO_CACHE_KEY",o=this.tokenInfoCache.get(r);if(o)return o;let s=this.apiClient.getTokenInfo();return this.tokenInfoCache.put(r,s),s}async getGasBalance(r,o){let s=`GAS_BALANCE_${r}_${o}`,i=this.gasBalanceCache.get(s);if(i)return i;let a=this.apiClient.getGasBalance(r,o);return this.gasBalanceCache.put(s,a),a}async getPendingInfo(){let r="PENDING_INFO_CACHE_KEY",o=this.pendingInfoCache.get(r);if(o)return o;let s=this.apiClient.getPendingInfo();return this.pendingInfoCache.put(r,s),s}async getReceiveTransactionCost(r){let o=`RECEIVE_TX_COST_${r.sourceChainId}_${r.destinationChainId}_${r.messenger}`,s=this.receivedTransactionCache.get(o);if(s)return s;let i=await this.apiClient.getReceiveTransactionCost(r);return this.receivedTransactionCache.put(o,i),i}async getTransferStatus(r,o){return this.apiClient.getTransferStatus(r,o)}async getPoolInfoMap(r){return this.apiClient.getPoolInfoMap(r)}};var Fi=class{constructor(r){this.apiClient=r}async getChainDetailsMap(){return(await this.apiClient.getTokenInfo()).chainDetailsMap}async tokens(){let r=await this.getChainDetailsMap();return Object.values(r).flatMap(o=>o.tokens)}async getPendingInfo(){return this.apiClient.getPendingInfo()}async getGasBalance(r,o){return this.apiClient.getGasBalance(r,o)}async getChainDetailsMapAndPoolInfoMap(){return await this.apiClient.getTokenInfo()}async getTransferStatus(r,o){return await this.apiClient.getTransferStatus(r,o)}async getReceiveTransactionCost(r){return await this.apiClient.getReceiveTransactionCost(r)}async getPoolInfoMap(r){return await this.apiClient.getPoolInfoMap(r)}};var ki=class{constructor(r,o){this.client=r;this.isStaging=o.coreApiQueryParams?.staging==="true"}isStaging;async getChainDetailsMap(r){let o=await this.client.getChainDetailsMap(),s={};for(let i in o){let a=o[i];a&&(s[i]={...a,tokens:Od(a.tokens,r,this.isStaging)})}return s}async tokens(r){return Od(await this.client.tokens(),r,this.isStaging)}async getPendingInfo(){return this.client.getPendingInfo()}async getGasBalance(r,o){return this.client.getGasBalance(r,o)}async getTransferStatus(r,o){return await this.client.getTransferStatus(r,o)}async getReceiveTransactionCost(r){return await this.client.getReceiveTransactionCost(r)}cachePut(r,o){return this.client.cachePut(r,o)}getPoolInfoByKey(r){return this.client.getPoolInfoByKey(r)}refreshPoolInfo(r){return this.client.refreshPoolInfo(r)}};function Od(n,r,o){return n.filter(s=>o?!0:s.flags[r]).map(gg)}function gg(n){let{flags:r,...o}=n;return o}var hg=55*1e3,Oi=class{constructor(r){this.client=r;this.poolInfoCache=new Ic}poolInfoCache;async getChainDetailsMap(){return(await this.client.getChainDetailsMapAndPoolInfoMap()).chainDetailsMap}async tokens(){return await this.client.tokens()}getTransferStatus(r,o){return this.client.getTransferStatus(r,o)}getReceiveTransactionCost(r){return this.client.getReceiveTransactionCost(r)}getPendingInfo(){return this.client.getPendingInfo()}getGasBalance(r,o){return this.client.getGasBalance(r,o)}async getPoolInfoByKey(r){this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);let o=this.poolInfoCache.get(r);if(o)return o;{let s=await this.client.getPoolInfoMap(r);this.poolInfoCache.putAll(s);let i=s[ko(r)];if(i)return i;throw new _("Cannot find pool info for "+r.poolAddress+" on chain "+r.chainSymbol)}}async refreshPoolInfo(r){let o;if(r)this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap),o=await this.client.getPoolInfoMap(r);else{let s=await this.client.getChainDetailsMapAndPoolInfoMap();o=await this.client.getPoolInfoMap(Md(s.chainDetailsMap))}this.poolInfoCache.putAll(o)}cachePut(r,o){this.poolInfoCache.put(ko(r),o)}},Ic=class{cache;constructor(){this.cache=new sn({defaultTtl:hg})}putAll(r){for(let[o,s]of Object.entries(r))this.cache.put(o,s)}putAllIfNotExists(r){for(let[o,s]of Object.entries(r))this.cache.get(o)||this.cache.put(o,s)}put(r,o){this.cache.put(r,o)}get(r){let o=ko(r);return this.cache.get(o)}};var Dm=require("web3");var Ju;async function vr(){return Ju||(Ju=(await Promise.resolve().then(()=>(QA(),qA))).default),Ju}var Hu=require("big.js");async function lt(n,r){return await n.getPoolInfoByKey({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress})}function je(n){if((0,Hu.Big)(n).lte(0))throw new Gr("Amount must be greater than zero")}function Le(n,r,o){let s=(0,Hu.Big)(r).toFixed(),[i,a]=s.split(".");if(a&&a.length>o)throw new bs(n,a.length,o)}async function ga(n,r,o){return await Promise.race([n,new Promise((s,i)=>{setTimeout(()=>i(new Fo(r)),o)})])}async function Ku(n,r,o,s){if(o<1)throw new Error(`Bad argument: 'maxRetries' must be greater than 0, but ${o} was received.`);let i=0;for(;;)try{return await ga(n(),r,s)}catch{if(++i>=o)throw new Fo(r)}}async function ef(n,r,o,s=1.5,i=!1){let a=[],c=0,u=await n();if(a.push(u),!r(u))return a;let l=new Date(Date.now()+o*1e3).valueOf(),p=1e3,A=p;for(;Date.now()<l;){let g=a[a.length-1];if(g===void 0||!r(g))break;c++,i&&console.info(`Waiting ${p}ms before trying again (bringing the total wait time to ${A}ms so far, of total ${o*1e3}ms)`),await new Promise(b=>setTimeout(b,p)),p=p*s,new Date(Date.now()+p).valueOf()>l&&(p=l-Date.now(),i&&console.info(`was gonna wait too long; new waitTime: ${p}ms`)),A=p+A;let P=await n(g);a.push(P),i&&r(P)&&console.info(`${c}. Called ${n.name}; ${a.length} prev attempts. Most recent: ${JSON.stringify(a[a.length-1],null,2)}`)}return a}var yf=require("big.js");var Qy={abi:[{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"uint256",name:"_chainPrecision",type:"uint256"},{internalType:"contract Messenger",name:"_allbridgeMessenger",type:"address"},{internalType:"contract WormholeMessenger",name:"_wormholeMessenger",type:"address"},{internalType:"contract IGasOracle",name:"_gasOracle",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"gas",type:"uint256"}],name:"BridgingFeeFromTokens",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"bridgeTransactionCost",type:"uint256"},{indexed:!1,internalType:"uint256",name:"messageTransactionCost",type:"uint256"}],name:"ReceiveFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Received",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes32",name:"sendToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"receiveToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"sendAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receiveAmount",type:"uint256"}],name:"Swapped",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{indexed:!1,internalType:"bytes32",name:"message",type:"bytes32"}],name:"TokensReceived",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"receiveToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"}],name:"TokensSent",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"addBridgeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract Pool",name:"pool",type:"address"},{internalType:"bytes32",name:"token",type:"bytes32"}],name:"addPool",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"canSwap",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"gasUsage",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"address",name:"tokenAddress",type:"address"}],name:"getBridgingCostInTokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"getMessageCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"getMessageGasUsage",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"getTransactionCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"message",type:"bytes32"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"hasReceivedMessage",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"message",type:"bytes32"}],name:"hasSentMessage",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"}],name:"hashMessage",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"otherBridgeTokens",outputs:[{internalType:"bool",name:"isSupported",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"otherBridges",outputs:[{internalType:"bytes32",name:"bridgeAddress",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"tokenId",type:"bytes32"}],name:"pools",outputs:[{internalType:"contract Pool",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"processedMessages",outputs:[{internalType:"uint256",name:"isProcessed",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"}],name:"receiveTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"bridgeAddress",type:"bytes32"}],name:"registerBridge",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"removeBridgeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"sentMessages",outputs:[{internalType:"uint256",name:"isSent",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Messenger",name:"_allbridgeMessenger",type:"address"}],name:"setAllbridgeMessenger",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IGasOracle",name:"_gasOracle",type:"address"}],name:"setGasOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"setGasUsage",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_rebalancer",type:"address"}],name:"setRebalancer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_stopAuthority",type:"address"}],name:"setStopAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract WormholeMessenger",name:"_wormholeMessenger",type:"address"}],name:"setWormholeMessenger",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startSwap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopSwap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"token",type:"bytes32"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"}],name:"swap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"token",type:"bytes32"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"uint256",name:"feeTokenAmount",type:"uint256"}],name:"swapAndBridge",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token",type:"address"}],name:"withdrawBridgingFeeInTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawGasTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},tf=Qy;var eb={abi:[{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"},{internalType:"uint256",name:"chainPrecision_",type:"uint256"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"address",name:"cctpMessenger_",type:"address"},{internalType:"address",name:"cctpTransmitter_",type:"address"},{internalType:"contract IGasOracle",name:"gasOracle_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ReceivedExtraGas",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ReceivedGas",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"newRecipient",type:"bytes32"}],name:"RecipientReplaced",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"recipientWalletAddress",type:"bytes32"}],name:"TokensSentExtras",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeFromGas",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeFromTokens",type:"uint256"},{indexed:!1,internalType:"uint256",name:"relayerFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeTokenAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"adminFeeTokenAmount",type:"uint256"}],name:"TokensSent",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"adminFeeShareBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"uint256",name:"relayerFeeTokenAmount",type:"uint256"}],name:"bridge",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"recipientWalletAddress",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"uint256",name:"relayerFeeTokenAmount",type:"uint256"}],name:"bridgeWithWalletAddress",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"originalMessage",type:"bytes"},{internalType:"bytes",name:"originalAttestation",type:"bytes"},{internalType:"bytes32",name:"newRecipient",type:"bytes32"}],name:"changeRecipient",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"gasUsage",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"destinationChainId",type:"uint256"}],name:"getBridgingCostInTokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"}],name:"getDomainByChainId",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"getTransactionCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"uint64",name:"nonce",type:"uint64"}],name:"isMessageProcessed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"receiveTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"},{internalType:"uint32",name:"domain",type:"uint32"}],name:"registerBridgeDestination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"adminFeeShareBP_",type:"uint256"}],name:"setAdminFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IGasOracle",name:"gasOracle_",type:"address"}],name:"setGasOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"setGasUsage",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"}],name:"unregisterBridgeDestination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawFeeInTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawGas",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},rf=eb;var Ta=ye(require("@project-serum/anchor")),rl=require("@solana/web3.js");var Mt=ye(require("@project-serum/anchor")),Rt=require("@solana/web3.js");async function Ir(n,r){return Mt.utils.token.associatedAddress({mint:r,owner:n})}async function xn(n){let[r]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("config")],n);return r}async function nf(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("lock"),Uint8Array.from(n)],r);return o}async function Ys(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("price_v2"),Uint8Array.from([n])],r);return o}async function Yo(n){let r=await xn(n),[o]=await Rt.PublicKey.findProgramAddress([r.toBuffer()],n);return o}async function of(n,r){let[o]=await Rt.PublicKey.findProgramAddress([n.toBuffer()],r);return o}async function qo(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("token"),n.toBytes()],r);return o}async function sf(n,r,o){let[s]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("other_bridge_token"),Buffer.from([n]),r],o);return s}async function Xu(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("chain_bridge"),Uint8Array.from([n])],r);return o}async function Yu(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("gas_usage"),Uint8Array.from([n])],r);return o}async function af(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("sent_message"),n],r);return o}async function qu(n,r,o){let[s]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("user_deposit"),r.toBytes(),n.toBytes()],o);return s}async function cf(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("cctp_bridge"),n.toBytes()],r);return o}async function uf(n,r){let[o]=await Rt.PublicKey.findProgramAddress([Mt.utils.bytes.utf8.encode("token"),n.toBytes()],r);return o}function lf(n,r){let[o]=Rt.PublicKey.findProgramAddressSync([Mt.utils.bytes.utf8.encode("lock"),r.toBuffer()],n);return o}function df(n,r,o,s){let i=fo("message_transmitter",o),a=fo("token_messenger",s),c=fo("__event_authority",s),u=fo("token_minter",s),l=fo("local_token",s,[r]),p=fo("remote_token_messenger",s,[n.toString()]),A=fo("sender_authority",s);return{messageTransmitterAccount:i,tokenMessenger:a,tokenMessengerEventAuthority:c,tokenMinter:u,localToken:l,remoteTokenMessengerKey:p,authorityPda:A}}function fo(n,r,o=[]){let s=[Buffer.from(Mt.utils.bytes.utf8.encode(n))];for(let a of o)typeof a=="string"?s.push(Buffer.from(Mt.utils.bytes.utf8.encode(a))):Array.isArray(a)||Buffer.isBuffer(a)?s.push(Buffer.from(Uint8Array.from(a))):s.push(Buffer.from(Uint8Array.from(a.toBuffer())));return Rt.PublicKey.findProgramAddressSync(s,r)[0]}var pf=require("@project-serum/anchor"),ha=require("@solana/web3.js");function Dn(n,r){let o=new ha.Connection(n,"confirmed"),s=new ha.PublicKey(r);return new pf.AnchorProvider(o,{publicKey:s},{preflightCommitment:"confirmed",commitment:"confirmed"})}var ff=require("@solana/web3.js"),mf=require("@stellar/stellar-sdk"),Yr=require("big.js"),Qu=ye(require("randombytes"));async function mn(n,r,o){let s;switch(r){case"EVM":{s=Af(n);break}case"SOLANA":{s=new ff.PublicKey(n).toBuffer();break}case"TRX":{s=await tb(n);break}case"SRB":{s=new mf.Address(n).toBuffer();break}case"SUI":{s=Af(n);break}}switch(o){case"EVM":return"0x"+s.toString("hex");case"SOLANA":return Array.from(s);case"TRX":return s;case"SRB":return s.toJSON().data;case"SUI":return"0x"+s.toString("hex")}}function Mr(n){return n.replace(/^0x/i,"")}function gf(n){return Buffer.from(n.replace(/^0x/i,""),"hex")}function Af(n){let o=gf(n);return Buffer.concat([Buffer.alloc(32-o.length,0),o],32)}async function tb(n){let r=await ya(n),o=gf(r);return rb(o,32)}async function ya(n){let r=await vr(),o=r.utils.crypto.decodeBase58Address(n);return o?r.utils.bytes.byteArray2hexStr(o).replace(/^41/,"0x"):""}function rb(n,r){if(n.length>=r)return n;let o=Buffer.alloc(r,0);return n.copy(o,r-n.length),o}function ba(){return(0,Qu.default)(32)}function qr(){let n=(0,Qu.default)(32).readBigInt64BE();return n<0?n*-1n:n}async function Qr(n,r){let o={},s=r.sourceToken;if(o.amount=Ee(r.amount,s.decimals).toFixed(),o.contractAddress=s.bridgeAddress,o.fromAccountAddress=r.fromAccountAddress,n==="SUI"){if(!s.originTokenAddress)throw new _("SUI sourceToken must contain 'originTokenAddress'");o.fromTokenAddress=s.originTokenAddress}else o.fromTokenAddress=await mn(s.tokenAddress,n,n);if(o.toAccountAddress=r.toAccountAddress,n==="SUI"){if(!r.destinationToken.originTokenAddress)throw new _("SUI destinationToken must contain 'originTokenAddress'");o.toTokenAddress=r.destinationToken.originTokenAddress}else o.toTokenAddress=await mn(r.destinationToken.tokenAddress,n,n);return o.minimumReceiveAmount=r.minimumReceiveAmount?Ee(r.minimumReceiveAmount,r.destinationToken.decimals).toFixed():"0",o}async function Rr(n,r,o){let s={};s.fromChainId=r.sourceToken.allbridgeChainId,s.fromChainSymbol=r.sourceToken.chainSymbol;let i=Me.getChainProperty(r.destinationToken.chainSymbol).chainType;if(n==="SUI"){if(!r.sourceToken.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");s.fromTokenAddress=r.sourceToken.originTokenAddress}else s.fromTokenAddress=r.sourceToken.tokenAddress;s.toChainId=r.destinationToken.allbridgeChainId,s.toTokenAddress=r.destinationToken.tokenAddress,r.gasFeePaymentMethod==="stablecoin"?s.gasFeePaymentMethod="stablecoin":s.gasFeePaymentMethod="native";let a=r.sourceToken;if(r.messenger===3){if(!a.cctpAddress||!r.destinationToken.cctpAddress)throw new Ct("Such route does not support CCTP protocol");s.contractAddress=a.cctpAddress}else if(r.messenger===4){if(!a.cctpV2Address||!r.destinationToken.cctpV2Address)throw new Ct("Such route does not support CCTP V2 protocol");s.contractAddress=a.cctpV2Address}else s.contractAddress=a.bridgeAddress;s.messenger=r.messenger,s.fromAccountAddress=r.fromAccountAddress,s.amount=Ee(r.amount,a.decimals).toFixed();let{fee:c,feeFormat:u}=r;if(!c){let g=(await el(s.fromChainId,r.sourceToken.chainType,s.toChainId,a.decimals,s.messenger,o))[s.gasFeePaymentMethod];if(!g)throw new Mo;c=g.int,u="int"}if(u=="float")switch(s.gasFeePaymentMethod){case"native":s.fee=Ee(c,Me.getChainDecimalsByType(a.chainType)).toFixed(0);break;case"stablecoin":s.fee=Ee(c,a.decimals).toFixed(0);break}else s.fee=c;let{extraGas:l,extraGasFormat:p}=r;if(l&&+l>0){if(p=="float")switch(s.gasFeePaymentMethod){case"native":s.extraGas=Ee(l,Me.getChainDecimalsByType(a.chainType)).toFixed(0);break;case"stablecoin":s.extraGas=Ee(l,a.decimals).toFixed(0);break}else s.extraGas=l;await ob(s.extraGas,s.gasFeePaymentMethod,a,r.destinationToken,o)}return n!=="SUI"&&(s.fromTokenAddress=await mn(s.fromTokenAddress,n,n)),s.toAccountAddress=await mn(r.toAccountAddress,i,n),s.toTokenAddress=await mn(s.toTokenAddress,i,n),s.gasFeePaymentMethod=="stablecoin"&&nb(s.amount,a.decimals,s.fee,s.extraGas),s}function nb(n,r,o,s){let i=(0,Yr.Big)(n).minus(o).minus(s??0);if(i.lte(0))throw new $n(`Amount not enough to pay fee, ${we((0,Yr.Big)(i).minus(1).neg(),r).toFixed()} stables is missing`)}async function el(n,r,o,s,i,a){let c=await a.getReceiveTransactionCost({sourceChainId:n,destinationChainId:o,messenger:i}),u={native:{int:c.fee,float:we(c.fee,Me.getChainDecimalsByType(r)).toFixed()}};if(c.sourceNativeTokenPrice){let l=$r(new Yr.Big(c.fee).mul(c.sourceNativeTokenPrice),Me.getChainDecimalsByType(r),s).toFixed(0,Yr.Big.roundUp);u.stablecoin={int:l,float:we(l,s).toFixed()}}return u}async function ob(n,r,o,s,i){let c=(await tl(o,s,i)).extraGasMax[r];if(!c)throw new Mo(`Impossible to pay extra gas by '${r}' payment method`);let u=c.int;if((0,Yr.Big)(n).gt(u))throw new ys(`Extra gas ${n} in int format, exceeded limit ${u} for '${r}' payment method`)}async function tl(n,r,o){let s={},i=await o.getReceiveTransactionCost({sourceChainId:n.allbridgeChainId,destinationChainId:r.allbridgeChainId,messenger:1}),a=r.txCostAmount.maxAmount,c=we(a,Me.getChainDecimalsByType(r.chainType)).toFixed(),u=(0,Yr.Big)(c).div(i.exchangeRate).toFixed(Me.getChainDecimalsByType(n.chainType),Yr.Big.roundDown),l=Ee(u,Me.getChainDecimalsByType(n.chainType)).toFixed(0);if(s.native={int:l,float:u},i.sourceNativeTokenPrice){let p=(0,Yr.Big)(u).mul(i.sourceNativeTokenPrice).toFixed(n.decimals,Yr.Big.roundDown);s.stablecoin={int:Ee(p,n.decimals).toFixed(0),float:p}}return{extraGasMax:s,destinationChain:{gasAmountMax:{int:a,float:c},swap:{int:r.txCostAmount.swap,float:we(r.txCostAmount.swap,Me.getChainDecimalsByType(r.chainType)).toFixed()},transfer:{int:r.txCostAmount.transfer,float:we(r.txCostAmount.transfer,Me.getChainDecimalsByType(r.chainType)).toFixed()}},exchangeRate:i.exchangeRate,sourceNativeTokenPrice:i.sourceNativeTokenPrice}}function hf(n){return n.sourceToken.chainSymbol!==n.destinationToken.chainSymbol}async function Pa(n,r,o,s){let i,a=new rl.PublicKey(r),c=new rl.PublicKey(o),u=await Ir(a,c),l=Dn(s,r);Ta.setProvider(l);let p=await Ta.Spl.token(l).account.token.fetchNullable(u);if(p?.authority.equals(a))i=await mn(u.toBase58(),"SOLANA",n);else{let A=await l.connection.getTokenAccountsByOwner(a,{mint:c});if(A.value.length===0&&!p)i=await mn(u.toBase58(),"SOLANA",n);else if(A.value.length>0){let g=A.value[0];if(!g?.pubkey)throw new _("First token account or its public key is undefined");i=await mn(g.pubkey.toBase58(),"SOLANA",n)}else throw new _("Associated account has wrong owner")}return i}var ir=class{};var Qs=class extends ir{constructor(o,s,i){super();this.web3=o;this.api=s;this.nodeRpcUrlsConfig=i}chainType="EVM";async send(o){let s=await this.buildRawTransactionSend(o);return this.sendRawTransaction(s)}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o,g=this.getBridgeContract(i).methods.swap(s,c,l,u,p);return Promise.resolve({from:a,to:i,data:g.encodeABI()})}async buildRawTransactionSend(o){let s=await Rr(this.chainType,o,this.api),{amount:i,contractAddress:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,toTokenAddress:A,messenger:g,fee:P,gasFeePaymentMethod:b,extraGas:W}=s,S="0x"+ba().toString("hex"),F,U,V=P;if(W&&(V=(0,yf.Big)(V).plus(W).toFixed()),g===3||g===4){let L=await this.buildRawTransactionCctpSend(o,s,V);F=L.sendMethod,U=L.value}else{let L=this.getBridgeContract(a);b==="stablecoin"?(F=L.methods.swapAndBridge(u,i,p,l,A,S,g,V),U="0"):(F=L.methods.swapAndBridge(u,i,p,l,A,S,g,0),U=V)}return Promise.resolve({from:c,to:a,value:U,data:F.encodeABI()})}async buildRawTransactionCctpSend(o,s,i){let{amount:a,contractAddress:c,toChainId:u,toAccountAddress:l,gasFeePaymentMethod:p}=s,A=this.getCctpBridgeContract(c),g,P;if(o.destinationToken.chainType==="SOLANA"){let b=await Pa(this.chainType,o.toAccountAddress,o.destinationToken.tokenAddress,this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"));p==="stablecoin"?(g=A.methods.bridgeWithWalletAddress(a,b,l,u,i),P="0"):(g=A.methods.bridgeWithWalletAddress(a,b,l,u,0),P=i)}else p==="stablecoin"?(g=A.methods.bridge(a,l,u,i),P="0"):(g=A.methods.bridge(a,l,u,0),P=i);return{sendMethod:g,value:P}}async sendRawTransaction(o){let s=await this.web3.eth.estimateGas(o),i={maxPriorityFeePerGas:null,maxFeePerGas:null},{transactionHash:a}=await this.web3.eth.sendTransaction({...o,gas:s,...i});return{txId:a.toString()}}getBridgeContract(o){return new this.web3.eth.Contract(tf.abi,o)}getCctpBridgeContract(o){return new this.web3.eth.Contract(rf.abi,o)}};var wa=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i}async approve(r,o){let s,i;o?(s=r,i=o):i=r;let a=ei(i.token,i.messenger);return this.tokenService.buildRawTransactionApprove({...i,spender:a},s)}async send(r,o){return je(r.amount),Le("amount",r.amount,r.sourceToken.decimals),hf(r)?(await Ca(r.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionSend(r):(await Ca(r.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionSwap(r)}};var Xe=require("@project-serum/anchor"),Oe=require("@solana/web3.js"),hr=require("big.js");var ti={version:"0.1.0",name:"bridge",instructions:[{name:"initialize",accounts:[{name:"admin",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializeArgs"}}]},{name:"initializePool",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"token",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializePoolArgs"}}]},{name:"initDepositAccount",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"deposit",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"withdraw",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"amountLp",type:"u64"}]},{name:"swapAndBridge",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"messenger",isMut:!1,isSigner:!1},{name:"messengerConfig",isMut:!0,isSigner:!1},{name:"sentMessageAccount",isMut:!0,isSigner:!1},{name:"messengerGasUsage",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"swapAndBridgeWormhole",accounts:[{name:"user",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"wormholeMessenger",isMut:!1,isSigner:!1},{name:"wormholeMessengerConfig",isMut:!0,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"bridge",isMut:!0,isSigner:!1},{name:"message",isMut:!0,isSigner:!0},{name:"sequence",isMut:!0,isSigner:!1},{name:"feeCollector",isMut:!0,isSigner:!1},{name:"messengerGasUsage",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"swap",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"sendMint",isMut:!1,isSigner:!1},{name:"receiveMint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"sendPool",isMut:!0,isSigner:!1},{name:"receivePool",isMut:!0,isSigner:!1},{name:"sendBridgeToken",isMut:!0,isSigner:!1},{name:"receiveBridgeToken",isMut:!0,isSigner:!1},{name:"sendUserToken",isMut:!0,isSigner:!1},{name:"receiveUserToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"},{name:"receiveAmountMin",type:"u64"}]},{name:"registerChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"RegisterChainBridgeArgs"}}]},{name:"updateChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateChainBridgeArgs"}}]},{name:"receiveAndSwap",accounts:[{name:"user",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"receivedMessageAccount",isMut:!1,isSigner:!1},{name:"unlock",isMut:!0,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"messengerProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UnlockArgs"}}]},{name:"receiveAndSwapWormhole",accounts:[{name:"user",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"receivedMessageAccount",isMut:!1,isSigner:!1},{name:"unlock",isMut:!0,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"messengerProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UnlockArgs"}}]},{name:"withdrawGasToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"recipient",isMut:!0,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"claimRewards",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"setAdmin",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"newAdmin",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[]},{name:"startBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"actionType",type:{defined:"ActionType"}}]},{name:"stopBridge",accounts:[{name:"stopAuthority",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"actionType",type:{defined:"ActionType"}}]},{name:"setRebalancer",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"rebalancer",isMut:!1,isSigner:!1}],args:[]},{name:"setStopAuthority",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"newAuthority",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[]},{name:"setAllbridgeMessengerProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setWormholeMessengerProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setGasOracleProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setPoolFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"setBalanceRatioMin",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"balanceRatioMinBp",type:"u16"}]},{name:"setPoolAdminFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"addOtherBridgeToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"chainId",type:"u8"},{name:"tokenAddress",type:{array:["u8",32]}}]},{name:"removeOtherBridgeToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"chainId",type:"u8"},{name:"tokenAddress",type:{array:["u8",32]}}]},{name:"withdrawAdminFee",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"adminToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"adjustTotalLpAmount",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]}],accounts:[{name:"chainBridge",type:{kind:"struct",fields:[{name:"address",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"config",type:{kind:"struct",fields:[{name:"admin",type:"publicKey"},{name:"allbridgeMessengerProgramId",type:"publicKey"},{name:"wormholeMessengerProgramId",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"},{name:"rebalancer",type:"publicKey"},{name:"stopAuthority",type:"publicKey"},{name:"authorityBumpSeed",type:"u8"},{name:"canSwap",type:"bool"},{name:"canDeposit",type:"bool"},{name:"canWithdraw",type:"bool"}]}},{name:"lock",type:{kind:"struct",fields:[{name:"sender",type:"publicKey"},{name:"sentTokenAddress",type:"publicKey"},{name:"amount",type:"u64"},{name:"vusdAmount",type:"u64"},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"nonce",type:{array:["u8",32]}},{name:"messenger",type:{defined:"Messenger"}},{name:"slot",type:"u64"},{name:"fee",type:"u64"}]}},{name:"otherBridgeToken",type:{kind:"struct",fields:[]}},{name:"pool",type:{kind:"struct",fields:[{name:"mint",type:"publicKey"},{name:"a",type:"u64"},{name:"d",type:"u64"},{name:"tokenBalance",type:"u64"},{name:"vUsdBalance",type:"u64"},{name:"reserves",type:"u64"},{name:"decimals",type:"u8"},{name:"totalLpAmount",type:"u64"},{name:"feeShareBp",type:"u64"},{name:"adminFeeShareBp",type:"u64"},{name:"accRewardPerShareP",type:"u128"},{name:"adminFeeAmount",type:"u64"},{name:"balanceRatioMinBp",type:"u16"}]}},{name:"unlock",type:{kind:"struct",fields:[{name:"hash",type:{array:["u8",32]}},{name:"amount",type:"u64"},{name:"fee",type:"u64"},{name:"vUsdAmount",type:"u64"},{name:"slot",type:"u64"}]}},{name:"userDeposit",type:{kind:"struct",fields:[{name:"userAddress",type:"publicKey"},{name:"mint",type:"publicKey"},{name:"lpAmount",type:"u64"},{name:"rewardDebt",type:"u64"}]}}],types:[{name:"RegisterChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainBridgeAddress",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"UpdateChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainBridgeAddress",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"InitializeArgs",type:{kind:"struct",fields:[{name:"allbridgeMessengerProgramId",type:"publicKey"},{name:"wormholeMessengerProgramId",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"}]}},{name:"InitializePoolArgs",type:{kind:"struct",fields:[{name:"a",type:"u64"},{name:"feeShareBp",type:"u64"},{name:"adminFeeShareBp",type:"u64"},{name:"balanceRatioMinBp",type:"u16"}]}},{name:"BridgeArgs",type:{kind:"struct",fields:[{name:"nonce",type:{array:["u8",32]}},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"vusdAmount",type:"u64"}]}},{name:"UnlockArgs",type:{kind:"struct",fields:[{name:"nonce",type:{array:["u8",32]}},{name:"amount",type:"u64"},{name:"recipient",type:"publicKey"},{name:"sourceChainId",type:"u8"},{name:"receiveToken",type:"publicKey"},{name:"messenger",type:{defined:"Messenger"}},{name:"hash",type:{array:["u8",32]}},{name:"receiveAmountMin",type:"u64"}]}},{name:"RewardError",type:{kind:"enum",variants:[{name:"FeeTooHigh"}]}},{name:"Messenger",type:{kind:"enum",variants:[{name:"None"},{name:"Allbridge"},{name:"Wormhole"}]}},{name:"ActionType",type:{kind:"enum",variants:[{name:"Deposit"},{name:"Withdraw"},{name:"Swap"}]}}],errors:[{code:6e3,name:"AccountAlreadyInitialized",msg:"This account has already been initialized"},{code:6001,name:"AdminAuthorityInvalid",msg:"This instruction requires admin authority"},{code:6002,name:"InvalidSignature",msg:"Provided signature has wrong signer or message"},{code:6003,name:"InvalidHash",msg:"Wrong unlock message hash"},{code:6004,name:"PoolOverflow",msg:"PoolInfo overflow"},{code:6005,name:"ReservesExhausted",msg:"Reserves exhausted"},{code:6006,name:"ZeroAmount",msg:"Zero amount"},{code:6007,name:"ZeroChanges",msg:"Zero changes"},{code:6008,name:"HighVusdAmount",msg:"vUSD amount is too high"},{code:6009,name:"BalanceRatioExceeded",msg:"Balance ratio exceeded"},{code:6010,name:"InsufficientReceivedAmount",msg:"Received insufficient amount"},{code:6011,name:"ForbiddenAction",msg:"ForbiddenAction"},{code:6012,name:"ValueTooHigh",msg:"Value is too high"}]};var bf={version:"0.1.0",name:"cctp_bridge",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"admin",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializeArgs"}}]},{name:"bridge",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1},{name:"cctpMessenger",isMut:!1,isSigner:!1},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"messageTransmitterAccount",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"remoteTokenMessengerKey",isMut:!1,isSigner:!1},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"registerChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"RegisterChainBridgeArgs"}}]},{name:"updateChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateChainBridgeArgs"}}]},{name:"setAdminFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"setGasOracleProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"withdrawGasToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"recipient",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"withdrawAdminFee",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"adminToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"setCctpTokenMessengerMinter",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]}],accounts:[{name:"cctpBridge",type:{kind:"struct",fields:[{name:"mint",type:"publicKey"},{name:"admin",type:"publicKey"},{name:"cctpTokenMessengerMinter",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"},{name:"authorityBumpSeed",type:"u8"},{name:"adminFeeShareBp",type:"u64"},{name:"adminFeeAmount",type:"u64"}]}},{name:"chainBridge",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"}]}},{name:"lock",type:{kind:"struct",fields:[{name:"sender",type:"publicKey"},{name:"amount",type:"u64"},{name:"adminFee",type:"u64"},{name:"relayerFee",type:"u64"},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"slot",type:"u64"}]}}],types:[{name:"RegisterChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"},{name:"mint",type:"publicKey"}]}},{name:"UpdateChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"},{name:"mint",type:"publicKey"}]}},{name:"BridgeArgs",type:{kind:"struct",fields:[{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"amount",type:"u64"}]}},{name:"InitializeArgs",type:{kind:"struct",fields:[{name:"gasOracleProgramId",type:"publicKey"},{name:"cctpTokenMessengerMinter",type:"publicKey"}]}}],errors:[{code:6e3,name:"ValueTooHigh",msg:"Value is too high"}]};var Tf=require("@project-serum/anchor"),Pf=ye(require("big.js")),ri=require("web3");async function Qo(n,r){return await Tf.Spl.token(r).account.token.fetch(n)}async function wf(n,r,o){let s=await r.account.pool.fetch(o),i=s.decimals,a=(0,Pf.default)(s.feeShareBp.toString()).div(1e4).toFixed(),c={aValue:s.a.toString(),dValue:s.d.toString(),totalLpAmount:s.totalLpAmount.toString(),tokenBalance:s.tokenBalance.toString(),vUsdBalance:s.vUsdBalance.toString(),accRewardPerShareP:s.accRewardPerShareP.toString()};return Zr(n,{decimals:i,feeShare:a},c)}function Cf(n){let r=n.amount,o="0x"+n.recipient.toString("hex"),s=n.sourceChainId,i=n.destinationChainId,a="0x"+n.receiveToken.toString("hex"),c="0x"+n.nonce.toString("hex"),u=1,l="0x"+n.chainBridge.toString("hex"),p=ri.Web3.utils.encodePacked({t:"uint256",v:r},{t:"bytes32",v:o},{t:"uint256",v:s},{t:"bytes32",v:a},{t:"uint256",v:c},{t:"uint8",v:u});if(!p)throw new _("message cannot be undefined");let A=ri.Web3.utils.keccak256(Buffer.from(p.replace("0x",""),"hex")),g=Buffer.from(A.replace("0x",""),"hex");g[0]=s,g[1]=i;let P=ri.Web3.utils.encodePacked({t:"bytes32",v:"0x"+g.toString("hex")},{t:"bytes32",v:l});if(!P)throw new Zn("messageWithSigner cannot be undefined");let b=ri.Web3.utils.keccak256(Buffer.from(P.replace("0x",""),"hex")),W=Buffer.from(b.replace("0x",""),"hex");return W[0]=g[0],W[1]=g[1],W}var ar=require("@solana/web3.js"),Bf=require("big.js");var nl=require("@solana/web3.js");async function mo(n,r){return await Promise.all(n.message.addressTableLookups.map(async o=>new nl.AddressLookupTableAccount({key:o.accountKey,state:nl.AddressLookupTableAccount.deserialize(await r.getAccountInfo(o.accountKey).then(s=>{if(!s)throw new _("Cannot get AccountInfo");return s.data}))})))}var Ba="AUTO";async function es(n,r,o){let s=new ar.Connection(o,"confirmed"),i=(await s.simulateTransaction(n)).value.unitsConsumed;await Sf(n.instructions,i,r,s)}async function Wf(n,r,o){let s=new ar.Connection(o,"confirmed"),i=await mo(n,s),a=ar.TransactionMessage.decompile(n.message,{addressLookupTableAccounts:i});if(n.serialize().length>1232)throw new Ps;await Sf(a.instructions,769230,r,s),n.message=a.compileToV0Message(i)}async function Sf(n,r,o,s){if(r>0){let i=sb(r,n);if(o?.solana){let a=o.solana;if(a===Ba)await ol(n,s);else if("pricePerUnitInMicroLamports"in a)await ol(n,s,a.pricePerUnitInMicroLamports);else{let c=(0,Bf.Big)(a.extraFeeInLamports).div(i).mul(ws(6)).toFixed(0);await ol(n,s,c)}}}}function sb(n,r){let o=r.findIndex(a=>a.programId.equals(ar.ComputeBudgetProgram.programId)&&ar.ComputeBudgetInstruction.decodeInstructionType(a)==="SetComputeUnitLimit"),s=Number((n*1.3).toFixed(0)),i=ar.ComputeBudgetProgram.setComputeUnitLimit({units:s});return o>=0?r[o]=i:r.push(i),s.toString()}async function ol(n,r,o){let s=n.findIndex(c=>c.programId.equals(ar.ComputeBudgetProgram.programId)&&ar.ComputeBudgetInstruction.decodeInstructionType(c)==="SetComputeUnitPrice"),i=BigInt(o||await ib(r)),a=ar.ComputeBudgetProgram.setComputeUnitPrice({microLamports:i});return s>=0?n[s]=a:n.push(a),i.toString()}async function ib(n){let r=await n.getRecentPrioritizationFees(),o=0;for(let s of r)o+=s.prioritizationFee;return(o/r.length).toFixed(0)}var vf=require("@solana/spl-token"),go=require("@solana/web3.js"),ts=ye(require("axios"));var Wa=class{connection;jupiterUrl;apiKeyHeader;maxAccounts;constructor(r,o){this.connection=new go.Connection(r),this.jupiterUrl=o.jupiterUrl.replace(/\/$/,""),this.apiKeyHeader=o.jupiterApiKeyHeader,this.maxAccounts=o.jupiterMaxAccounts}async getJupiterSwapTx(r,o,s,i){let a;try{let g=i?"ExactOut":"ExactIn",P=`${this.jupiterUrl}/quote?inputMint=${o}&outputMint=${vf.NATIVE_MINT.toString()}&amount=${s}&swapMode=${g}&slippageBps=100&onlyDirectRoutes=true`;this.maxAccounts&&(P+=`&maxAccounts=${this.maxAccounts}`),a=await ts.default.get(P,{headers:this.apiKeyHeader?{"x-api-key":this.apiKeyHeader}:void 0})}catch(g){throw g instanceof ts.AxiosError&&g.response&&g.response.data&&g.response.data.error?new mt(g.response.data.error):new mt("Cannot get route")}let c;if(i&&a?.data?.inAmount)c=a.data.inAmount;else if(i)throw new mt("Cannot get inAmount");let u;try{u=await ts.default.post(`${this.jupiterUrl}/swap`,{quoteResponse:a.data,userPublicKey:r,wrapAndUnwrapSol:!0},{headers:this.apiKeyHeader?{"x-api-key":this.apiKeyHeader}:void 0})}catch(g){throw g instanceof ts.AxiosError&&g.response&&g.response.data&&g.response.data.error?new mt(g.response.data.error):new mt("Cannot get swap transaction")}let l;if(u?.data?.swapTransaction)l=u.data.swapTransaction;else throw new mt("Cannot get swap transaction");let p=Buffer.from(l,"base64"),A=go.VersionedTransaction.deserialize(p);return i?{tx:A,amountIn:c}:{tx:A}}async amendJupiterWithSdkTx(r,o){try{let s=await mo(r,this.connection),i=await mo(o,this.connection),a=go.TransactionMessage.decompile(r.message,{addressLookupTableAccounts:s}),c=go.TransactionMessage.decompile(o.message,{addressLookupTableAccounts:i});if(c.instructions.shift(),a.instructions.push(...c.instructions),s.push(...i),r.message=a.compileToV0Message(s),o.message.header.numRequiredSignatures===2&&r.signatures.length===1){let u=o.signatures[0];if(!u)throw new _("Signature is undefined");r.signatures.push(u)}return r}catch(s){throw s instanceof Error&&s.message?new mt(`Some error occurred during creation final swap and bridge transaction. ${s.message}`):new mt("Some error occurred during creation final swap and bridge transaction")}}};var sl=1e6,If=1.1,Sa=class extends ir{constructor(o,s,i){super();this.solanaRpcUrl=o;this.params=s;this.api=i;this.jupiterService=new Wa(o,s.jupiterParams)}chainType="SOLANA";jupiterService;async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildSwapTransaction(s,o.sourceToken.poolAddress,o.destinationToken.poolAddress,o.txFeeParams)}async buildSwapTransaction(o,s,i,a){let{fromAccountAddress:c,amount:u,contractAddress:l,fromTokenAddress:p,toTokenAddress:A,toAccountAddress:g,minimumReceiveAmount:P}=o,b=c,W=l,S=p,F=A,U=i,V=g,L=new Oe.PublicKey(b),X=Dn(this.solanaRpcUrl,L.toString()),de=new Xe.Program(ti,W,X),oe=await Yo(de.programId),ot=await xn(de.programId),xe=new Oe.PublicKey(S),Ve=await qo(xe,de.programId),dt=new Oe.PublicKey(s),Vt=await Ir(L,xe),pt=new Oe.PublicKey(V),Ie=new Oe.PublicKey(F),De=await qo(Ie,de.programId),At=new Oe.PublicKey(U),ft=await Ir(pt,Ie),Gt=[Xe.web3.ComputeBudgetProgram.setComputeUnitLimit({units:sl})];try{await Qo(ft,X)}catch{let qm=await Xe.Spl.associatedToken(X).methods.create().accounts({mint:Ie,owner:pt,associatedAccount:ft}).instruction();Gt.push(qm)}let Ar=await de.methods.swap(new Xe.BN(u),new Xe.BN(P||0)).accounts({payer:L,config:ot,bridgeAuthority:oe,user:L,sendBridgeToken:Ve,sendMint:xe,sendPool:dt,sendUserToken:Vt,receiveBridgeToken:De,receiveMint:Ie,receivePool:At,receiveUserToken:ft}).preInstructions(Gt).transaction(),Pr=X.connection;return Ar.recentBlockhash=(await Pr.getLatestBlockhash()).blockhash,Ar.feePayer=L,await es(Ar,a,this.solanaRpcUrl),await this.convertToVersionedTransaction(Ar,Pr)}async buildRawTransactionSend(o){let s=await Rr(this.chainType,o,this.api),i=this.addPoolAddress(o,s),a=i.gasFeePaymentMethod=="stablecoin",c;if(a)try{let{tx:p,solTxSendUpdatedParams:A}=await this.processJup(i,o,!0);c=p,i={...i,...A}}catch{try{let{tx:A,solTxSendUpdatedParams:g}=await this.processJup(i,o,!1);c=A,i={...i,...g}}catch(A){throw A instanceof et?A:A instanceof Error&&A.message?new mt(`Some error occurred during creation Jupiter swap transaction. ${A.message}`):new mt("Some error occurred during creation Jupiter swap transaction")}}let u,l;switch(s.messenger){case 1:{let p=await this.prepareSwapAndBridgeData(i);u=await this.buildSwapAndBridgeAllbridgeTransaction(p);break}case 2:{let p=await this.prepareSwapAndBridgeData(i),{transaction:A,messageAccount:g}=await this.buildSwapAndBridgeWormholeTransaction(p);u=A,l=g;break}case 3:case 4:{let p=await this.prepareSwapAndBridgeCctpData(i),{transaction:A,messageSentEventDataKeypair:g}=await this.buildSwapAndBridgeCctpTransaction(o.destinationToken.chainSymbol,p);u=A,l=g;break}}if(a){if(!c)throw new mt("Swap tx is absent");u=await this.jupiterService.amendJupiterWithSdkTx(c,u)}return await Wf(u,o.txFeeParams,this.solanaRpcUrl),l&&u.sign([l]),u}async processJup(o,s,i){let{fee:a,extraGas:c,gasFeePaymentMethod:u}=await this.convertStableCoinFeeAndExtraGasToNativeCurrency(s.sourceToken.decimals,o),l=i?(0,hr.Big)(a):(0,hr.Big)(o.fee);c&&(l=l.plus(c)),i||(l=l.mul(If));let{tx:p,amountIn:A}=await this.jupiterService.getJupiterSwapTx(s.fromAccountAddress,s.sourceToken.tokenAddress,l.toFixed(0),i),g;if(i){if(!A)throw new mt("Cannot get inAmount");g=(0,hr.Big)(o.amount).minus((0,hr.Big)(A).mul(If)).toFixed(0)}else g=(0,hr.Big)(o.amount).minus(l).toFixed(0);if((0,hr.Big)(g).lte(0))throw new $n(`Amount not enough to pay fee, ${we((0,hr.Big)(g).minus(1).neg(),s.sourceToken.decimals).toFixed()} stables is missing`);return{tx:p,solTxSendUpdatedParams:{amount:g,fee:a,extraGas:c,gasFeePaymentMethod:u}}}addPoolAddress(o,s){return{...s,poolAddress:o.sourceToken.poolAddress}}async convertStableCoinFeeAndExtraGasToNativeCurrency(o,s){if(s.gasFeePaymentMethod=="stablecoin"){let i=(await this.api.getReceiveTransactionCost({sourceChainId:s.fromChainId,destinationChainId:s.toChainId,messenger:s.messenger})).sourceNativeTokenPrice,a=(0,hr.Big)(s.fee).div(i).mul((0,hr.Big)(10).pow(Me.getChainDecimalsByType("SOLANA")-o)).toFixed(0),c;return s.extraGas&&(c=(0,hr.Big)(s.extraGas).div(i).mul((0,hr.Big)(10).pow(Me.getChainDecimalsByType("SOLANA")-o)).toFixed(0)),{fee:a,extraGas:c,gasFeePaymentMethod:"native"}}return{fee:s.fee,extraGas:s.extraGas,gasFeePaymentMethod:"native"}}getExtraGasInstruction(o,s,i){return Xe.web3.SystemProgram.transfer({fromPubkey:s,toPubkey:i,lamports:+o})}async prepareSwapAndBridgeData(o){let{amount:s,contractAddress:i,fromChainId:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,toTokenAddress:A,poolAddress:g,extraGas:P}=o,b=u,W=c,S=l,F=A,U=p,V=i,L=a,X=Dn(this.solanaRpcUrl,W),de=new Xe.Program(ti,V,X),oe=Array.from(ba()),ot=new Oe.PublicKey(g),xe=await wf(s,de,ot),Ve=await nf(oe,de.programId),dt=await Yo(de.programId),Vt=await Ir(new Oe.PublicKey(W),new Oe.PublicKey(b)),pt=await qo(new Oe.PublicKey(b),de.programId),Ie=await Xu(S,de.programId),De=await sf(S,Buffer.from(F),de.programId),At=await xn(de.programId),ft=await de.account.config.fetch(At),Gt=await Ys(S,ft.gasOracleProgramId),Ar=await Ys(L,ft.gasOracleProgramId),Pr=Cf({amount:xe,recipient:Buffer.from(U),nonce:Buffer.from(oe),receiveToken:Buffer.from(F),destinationChainId:S,sourceChainId:L,chainBridge:(await Yo(de.programId)).toBuffer()}),Fe={};return Fe.bridge=de,Fe.amount=new Xe.BN(s),Fe.vusdAmount=new Xe.BN(xe),Fe.nonce=oe,Fe.recipient=Array.from(U),Fe.receiveToken=Array.from(F),Fe.poolAccount=ot,Fe.lockAccount=Ve,Fe.bridgeAuthority=dt,Fe.userToken=Vt,Fe.bridgeTokenAccount=pt,Fe.chainBridgeAccount=Ie,Fe.otherBridgeTokenAccount=De,Fe.userAccount=new Oe.PublicKey(W),Fe.destinationChainId=S,Fe.mint=new Oe.PublicKey(b),Fe.config=At,Fe.configAccountInfo=ft,Fe.gasPrice=Gt,Fe.thisGasPrice=Ar,Fe.message=Pr,P&&(Fe.extraGasInstruction=this.getExtraGasInstruction(P,Fe.userAccount,At)),Fe}async buildSwapAndBridgeAllbridgeTransaction(o){let{bridge:s,vusdAmount:i,nonce:a,recipient:c,receiveToken:u,poolAccount:l,lockAccount:p,bridgeAuthority:A,userToken:g,bridgeTokenAccount:P,chainBridgeAccount:b,otherBridgeTokenAccount:W,userAccount:S,destinationChainId:F,mint:U,config:V,configAccountInfo:L,gasPrice:X,thisGasPrice:de,message:oe,extraGasInstruction:ot}=o,xe=L.allbridgeMessengerProgramId,Ve=await Yu(F,xe),dt=await xn(xe),Vt=await af(oe,xe),pt=[];ot&&pt.push(ot);let Ie=await s.methods.swapAndBridge({vusdAmount:i,nonce:a,destinationChainId:F,recipient:c,receiveToken:u}).accounts({mint:U,user:S,config:V,lock:p,pool:l,gasPrice:X,thisGasPrice:de,bridgeAuthority:A,userToken:g,bridgeToken:P,chainBridge:b,messenger:xe,messengerGasUsage:Ve,messengerConfig:dt,sentMessageAccount:Vt,otherBridgeToken:W}).preInstructions([Xe.web3.ComputeBudgetProgram.setComputeUnitLimit({units:sl})]).postInstructions(pt).transaction(),De=Dn(this.solanaRpcUrl,S.toString()).connection;return Ie.recentBlockhash=(await De.getLatestBlockhash()).blockhash,Ie.feePayer=S,await this.convertToVersionedTransaction(Ie,De)}async convertToVersionedTransaction(o,s){let i=await s.getAddressLookupTable(new Oe.PublicKey(this.params.solanaLookUpTable)).then(c=>c.value);if(!i)throw new _("Cannot find allbridgeLookupTableAccount");let a=new Xe.web3.TransactionMessage({payerKey:o.feePayer,recentBlockhash:o.recentBlockhash,instructions:o.instructions}).compileToV0Message([i]);return new Xe.web3.VersionedTransaction(a)}async buildSwapAndBridgeWormholeTransaction(o){let{bridge:s,vusdAmount:i,nonce:a,recipient:c,receiveToken:u,poolAccount:l,lockAccount:p,bridgeAuthority:A,userToken:g,bridgeTokenAccount:P,chainBridgeAccount:b,otherBridgeTokenAccount:W,userAccount:S,destinationChainId:F,mint:U,config:V,configAccountInfo:L,gasPrice:X,thisGasPrice:de,message:oe,extraGasInstruction:ot}=o,xe=this.params.wormholeMessengerProgramId,[Ve]=Oe.PublicKey.findProgramAddressSync([Buffer.from("Bridge")],new Oe.PublicKey(xe)),[dt]=Oe.PublicKey.findProgramAddressSync([Buffer.from("fee_collector")],new Oe.PublicKey(xe)),[Vt]=Oe.PublicKey.findProgramAddressSync([Buffer.from("Sequence"),A.toBuffer()],new Oe.PublicKey(xe)),pt=await Yu(F,L.wormholeMessengerProgramId),Ie=await xn(L.wormholeMessengerProgramId),De=Oe.Keypair.generate(),At=Dn(this.solanaRpcUrl,S.toString()),ft=await At.connection.getAccountInfo(Ve);if(ft==null)throw new _("Cannot fetch wormhole bridge account info");let Gt=new Xe.BN(ft.data.slice(16,24),"le").toString(),Ar=Oe.SystemProgram.transfer({fromPubkey:S,toPubkey:dt,lamports:+Gt}),Pr=[];ot&&Pr.push(ot);let Fe={mint:U,user:S,config:V,lock:p,pool:l,gasPrice:X,thisGasPrice:de,bridgeAuthority:A,userToken:g,bridgeToken:P,chainBridge:b,otherBridgeToken:W,messengerGasUsage:pt,wormholeProgram:xe,bridge:Ve,message:De.publicKey,wormholeMessenger:L.wormholeMessengerProgramId,sequence:Vt,feeCollector:dt,wormholeMessengerConfig:Ie,clock:Xe.web3.SYSVAR_CLOCK_PUBKEY},Wi=await s.methods.swapAndBridgeWormhole({vusdAmount:i,nonce:a,destinationChainId:F,recipient:c,receiveToken:u}).accounts(Fe).preInstructions([Xe.web3.ComputeBudgetProgram.setComputeUnitLimit({units:sl}),Ar]).postInstructions(Pr).signers([De]).transaction();return Wi.recentBlockhash=(await At.connection.getLatestBlockhash()).blockhash,Wi.feePayer=S,{transaction:await this.convertToVersionedTransaction(Wi,At.connection),messageAccount:De}}async prepareSwapAndBridgeCctpData(o){let{contractAddress:s,amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,extraGas:A}=o,g=s;if(!g)throw new Ct("Such route does not support CCTP protocol");let P=4,b=a,W=p,S=l,F=Dn(this.solanaRpcUrl,b),U=new Xe.Program(bf,g,F),V=new Oe.PublicKey(c),L=await cf(V,U.programId),X=new Oe.PublicKey(b),de=await U.account.cctpBridge.fetch(L),oe={};return oe.cctpBridge=U,oe.cctpBridgeAccount=L,oe.cctpAddressAccount=new Oe.PublicKey(g),oe.amount=new Xe.BN(i),oe.recipient=Array.from(S),oe.receiveToken=Array.from(W),oe.userToken=await Ir(X,V),oe.bridgeAuthority=await of(L,U.programId),oe.bridgeTokenAccount=await uf(V,U.programId),oe.chainBridgeAccount=await Xu(u,U.programId),oe.userAccount=X,oe.destinationChainId=u,oe.mint=V,oe.gasPrice=await Ys(u,de.gasOracleProgramId),oe.thisGasPrice=await Ys(P,de.gasOracleProgramId),oe.provider=F,A&&(oe.extraGasInstruction=this.getExtraGasInstruction(A,oe.userAccount,L)),oe}async buildSwapAndBridgeCctpTransaction(o,s){let{cctpBridge:i,cctpBridgeAccount:a,amount:c,recipient:u,receiveToken:l,bridgeAuthority:p,userToken:A,bridgeTokenAccount:g,chainBridgeAccount:P,userAccount:b,destinationChainId:W,mint:S,gasPrice:F,thisGasPrice:U,extraGasInstruction:V,provider:L}=s,X=this.params.cctpParams.cctpDomains[o],de=this.params.cctpParams.cctpTransmitterProgramId,oe=this.params.cctpParams.cctpTokenMessengerMinter;if(X==null||!de||!oe)throw new _("CCTP is not configured");let ot=new Oe.PublicKey(de),xe=new Oe.PublicKey(oe),{messageTransmitterAccount:Ve,tokenMessenger:dt,tokenMessengerEventAuthority:Vt,tokenMinter:pt,localToken:Ie,remoteTokenMessengerKey:De,authorityPda:At}=df(X,S,ot,xe),ft=[];V&&ft.push(V);let Gt=Oe.Keypair.generate(),Ar=lf(i.programId,Gt.publicKey),Pr=await i.methods.bridge({amount:c,destinationChainId:W,recipient:u,receiveToken:l}).accounts({mint:S,user:b,cctpBridge:a,messageSentEventData:Gt.publicKey,lock:Ar,cctpMessenger:xe,messageTransmitterProgram:ot,messageTransmitterAccount:Ve,tokenMessenger:dt,tokenMinter:pt,localToken:Ie,remoteTokenMessengerKey:De,authorityPda:At,eventAuthority:Vt,bridgeToken:g,gasPrice:F,thisGasPrice:U,chainBridge:P,userToken:A,bridgeAuthority:p}).preInstructions([Xe.web3.ComputeBudgetProgram.setComputeUnitLimit({units:2e6})]).postInstructions(ft).transaction(),Fe=L.connection;return Pr.recentBlockhash=(await Fe.getLatestBlockhash()).blockhash,Pr.feePayer=b,{transaction:await this.convertToVersionedTransaction(Pr,Fe),messageSentEventDataKeypair:Gt}}send(o){throw new st}};var va=require("@stellar/stellar-sdk"),Mf=require("big.js");var t=require("@stellar/stellar-sdk"),ab=t.contract.Spec,cb=t.contract.Client;var ni=class extends cb{constructor(o){super(new ab(["AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABAAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAltZXNzZW5nZXIAAAAAAAATAAAAAAAAAApnYXNfb3JhY2xlAAAAAAATAAAAAAAAAAxuYXRpdmVfdG9rZW4AAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAPc3dhcF9hbmRfYnJpZGdlAAAAAAkAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACXJlY2lwaWVudAAAAAAAA+4AAAAgAAAAAAAAABRkZXN0aW5hdGlvbl9jaGFpbl9pZAAAAAQAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAFbm9uY2UAAAAAAAAMAAAAAAAAAApnYXNfYW1vdW50AAAAAAAKAAAAAAAAABBmZWVfdG9rZW5fYW1vdW50AAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOcmVjZWl2ZV90b2tlbnMAAAAAAAgAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAlyZWNpcGllbnQAAAAAAAATAAAAAAAAAA9zb3VyY2VfY2hhaW5faWQAAAAABAAAAAAAAAANcmVjZWl2ZV90b2tlbgAAAAAAA+4AAAAgAAAAAAAAAAVub25jZQAAAAAAAAwAAAAAAAAAEnJlY2VpdmVfYW1vdW50X21pbgAAAAAACgAAAAAAAAAJZXh0cmFfZ2FzAAAAAAAD6AAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAEc3dhcAAAAAYAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAA+4AAAAgAAAAAAAAAA1yZWNlaXZlX3Rva2VuAAAAAAAD7gAAACAAAAAAAAAACXJlY2lwaWVudAAAAAAAABMAAAAAAAAAEnJlY2VpdmVfYW1vdW50X21pbgAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAJc3RvcF9zd2FwAAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAKc3RhcnRfc3dhcAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOc2V0X2dhc19vcmFjbGUAAAAAAAEAAAAAAAAAC25ld19hZGRyZXNzAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAASc2V0X3N0b3BfYXV0aG9yaXR5AAAAAAABAAAAAAAAAA5zdG9wX2F1dGhvcml0eQAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOc2V0X3JlYmFsYW5jZXIAAAAAAAEAAAAAAAAACnJlYmFsYW5jZXIAAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc2V0X21lc3NlbmdlcgAAAAAAAAEAAAAAAAAACW1lc3NlbmdlcgAAAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc2V0X2dhc191c2FnZQAAAAAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAAJZ2FzX3VzYWdlAAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAPcmVnaXN0ZXJfYnJpZGdlAAAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAAOYnJpZGdlX2FkZHJlc3MAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAQYWRkX2JyaWRnZV90b2tlbgAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAANdG9rZW5fYWRkcmVzcwAAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAATcmVtb3ZlX2JyaWRnZV90b2tlbgAAAAACAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAPuAAAAIAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAIYWRkX3Bvb2wAAAACAAAAAAAAAARwb29sAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAATd2l0aGRyYXdfZ2FzX3Rva2VucwAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABmFtb3VudAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAfd2l0aGRyYXdfYnJpZGdpbmdfZmVlX2luX3Rva2VucwAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAVaGFzX3Byb2Nlc3NlZF9tZXNzYWdlAAAAAAAAAQAAAAAAAAAHbWVzc2FnZQAAAAPuAAAAIAAAAAEAAAPpAAAAAQAAAAM=","AAAAAAAAAAAAAAAUaGFzX3JlY2VpdmVkX21lc3NhZ2UAAAABAAAAAAAAAAdtZXNzYWdlAAAAA+4AAAAgAAAAAQAAA+kAAAABAAAAAw==","AAAAAAAAAAAAAAAQZ2V0X3Bvb2xfYWRkcmVzcwAAAAEAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAPuAAAAIAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAKZ2V0X2NvbmZpZwAAAAAAAAAAAAEAAAPpAAAH0AAAAAZCcmlkZ2UAAAAAAAM=","AAAAAAAAAAAAAAASZ2V0X3N0b3BfYXV0aG9yaXR5AAAAAAAAAAAAAQAAA+kAAAATAAAAAw==","AAAAAAAAAAAAAAAUZ2V0X3RyYW5zYWN0aW9uX2Nvc3QAAAABAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAABAAAD6QAAAAoAAAAD","AAAAAAAAAAAAAAANZ2V0X2dhc191c2FnZQAAAAAAAAEAAAAAAAAACGNoYWluX2lkAAAABAAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAAJZ2V0X2FkbWluAAAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAOZ2V0X2dhc19vcmFjbGUAAAAAAAAAAAABAAAD6QAAABMAAAAD","AAAAAAAAAAAAAAASZ2V0X2Fub3RoZXJfYnJpZGdlAAAAAAABAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAABAAAD6QAAB9AAAAANQW5vdGhlckJyaWRnZQAAAAAAAAM=","AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAJbmV3X2FkbWluAAAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAHdXBncmFkZQAAAAABAAAAAAAAAA1uZXdfd2FzbV9oYXNoAAAAAAAD7gAAACAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAQAAAAAAAAAAAAAAB1N3YXBwZWQAAAAABgAAAAAAAAAOcmVjZWl2ZV9hbW91bnQAAAAAAAoAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAJcmVjaXBpZW50AAAAAAAAEwAAAAAAAAALc2VuZF9hbW91bnQAAAAACgAAAAAAAAAKc2VuZF90b2tlbgAAAAAD7gAAACAAAAAAAAAABnNlbmRlcgAAAAAAEw==","AAAAAQAAAAAAAAAAAAAAClRva2Vuc1NlbnQAAAAAAAUAAAAAAAAABmFtb3VudAAAAAAACgAAAAAAAAAUZGVzdGluYXRpb25fY2hhaW5faWQAAAAEAAAAAAAAAAVub25jZQAAAAAAAAwAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAJcmVjaXBpZW50AAAAAAAD7gAAACA=","AAAAAQAAAAAAAAAAAAAADlRva2Vuc1JlY2VpdmVkAAAAAAAEAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAB21lc3NhZ2UAAAAD7gAAACAAAAAAAAAABW5vbmNlAAAAAAAADAAAAAAAAAAJcmVjaXBpZW50AAAAAAAD7gAAACA=","AAAAAQAAAAAAAAAAAAAAClJlY2VpdmVGZWUAAAAAAAMAAAAAAAAAF2JyaWRnZV90cmFuc2FjdGlvbl9jb3N0AAAAAAoAAAAAAAAACWV4dHJhX2dhcwAAAAAAAAoAAAAAAAAAGG1lc3NhZ2VfdHJhbnNhY3Rpb25fY29zdAAAAAo=","AAAAAQAAAAAAAAAAAAAAFUJyaWRnaW5nRmVlRnJvbVRva2VucwAAAAAAAAIAAAAAAAAAEGZlZV90b2tlbl9hbW91bnQAAAAKAAAAAAAAAANnYXMAAAAACg==","AAAAAQAAAAAAAAAAAAAADUFub3RoZXJCcmlkZ2UAAAAAAAACAAAAAAAAAAdhZGRyZXNzAAAAA+4AAAAgAAAAAAAAAAZ0b2tlbnMAAAAAA+wAAAPuAAAAIAAAAAE=","AAAAAQAAAAAAAAAAAAAABkJyaWRnZQAAAAAABgAAAGBwcmVjb21wdXRlZCB2YWx1ZXMgb2YgdGhlIHNjYWxpbmcgZmFjdG9yIHJlcXVpcmVkIGZvciBwYXlpbmcgdGhlIGJyaWRnaW5nIGZlZSB3aXRoIHN0YWJsZSB0b2tlbnMAAAAeYnJpZGdpbmdfZmVlX2NvbnZlcnNpb25fZmFjdG9yAAAAAAPsAAAAEwAAAAoAAAAAAAAACGNhbl9zd2FwAAAAAQAAAGxwcmVjb21wdXRlZCB2YWx1ZXMgdG8gZGl2aWRlIGJ5IHRvIGNoYW5nZSB0aGUgcHJlY2lzaW9uIGZyb20gdGhlIEdhcyBPcmFjbGUgcHJlY2lzaW9uIHRvIHRoZSB0b2tlbiBwcmVjaXNpb24AAAAWZnJvbV9nYXNfb3JhY2xlX2ZhY3RvcgAAAAAD7AAAABMAAAAKAAAAAAAAAAltZXNzZW5nZXIAAAAAAAATAAAAAAAAAAVwb29scwAAAAAAA+wAAAPuAAAAIAAAABMAAAAAAAAACnJlYmFsYW5jZXIAAAAAABM=","AAAAAgAAAAAAAAAAAAAAB0RhdGFLZXkAAAAAAwAAAAEAAAAAAAAAC090aGVyQnJpZGdlAAAAAAEAAAAEAAAAAQAAAAAAAAALU2VudE1lc3NhZ2UAAAAAAQAAA+4AAAAgAAAAAQAAAAAAAAAPUmVjZWl2ZWRNZXNzYWdlAAAAAAEAAAPuAAAAIA==","AAAAAQAAAAAAAAAAAAAABUFkbWluAAAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAQAAAAAAAAAAAAAAEEdhc09yYWNsZUFkZHJlc3MAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAAAQAAAAAAAAAAAAAACEdhc1VzYWdlAAAAAQAAAAAAAAABMAAAAAAAA+wAAAAEAAAACg==","AAAAAQAAAAAAAAAAAAAAC05hdGl2ZVRva2VuAAAAAAEAAAAAAAAAATAAAAAAAAAT","AAAAAQAAAAAAAAAAAAAADVN0b3BBdXRob3JpdHkAAAAAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAKAAAAAAAAAANVW5pbXBsZW1lbnRlZAAAAAAAAAAAAAAAAAAAC0luaXRpYWxpemVkAAAAAAEAAAAAAAAADVVuaW5pdGlhbGl6ZWQAAAAAAAACAAAAAAAAAAxVbmF1dGhvcml6ZWQAAAADAAAAAAAAAApJbnZhbGlkQXJnAAAAAAAEAAAAAAAAAA5JbnZhbGlkQ2hhaW5JZAAAAAAABQAAAAAAAAATSW52YWxpZE90aGVyQ2hhaW5JZAAAAAAGAAAAAAAAAA5HYXNVc2FnZU5vdFNldAAAAAAABwAAAAAAAAANQnJva2VuQWRkcmVzcwAAAAAAAAgAAAAAAAAACE5vdEZvdW5kAAAACQAAAAAAAAAYVG9rZW5JbnN1ZmZpY2llbnRCYWxhbmNlAAAACgAAAAAAAAAKQ2FzdEZhaWxlZAAAAAAACwAAAAAAAAAMVTI1Nk92ZXJmbG93AAAADAAAAAAAAAAKWmVyb0Ftb3VudAAAAAAAZwAAAAAAAAAMUG9vbE92ZXJmbG93AAAAaAAAAAAAAAALWmVyb0NoYW5nZXMAAAAAaQAAAAAAAAARUmVzZXJ2ZXNFeGhhdXN0ZWQAAAAAAABqAAAAAAAAABpJbnN1ZmZpY2llbnRSZWNlaXZlZEFtb3VudAAAAAAAawAAAAAAAAAUQmFsYW5jZVJhdGlvRXhjZWVkZWQAAABsAAAAAAAAAAlGb3JiaWRkZW4AAAAAAABtAAAAAAAAABlVbmF1dGhvcml6ZWRTdG9wQXV0aG9yaXR5AAAAAAAAywAAAAAAAAAOU3dhcFByb2hpYml0ZWQAAAAAAMwAAAAAAAAAEkFtb3VudFRvb0xvd0ZvckZlZQAAAAAAzQAAAAAAAAAWQnJpZGdlVG9UaGVaZXJvQWRkcmVzcwAAAAAAzgAAAAAAAAAORW1wdHlSZWNpcGllbnQAAAAAAM8AAAAAAAAAE1NvdXJjZU5vdFJlZ2lzdGVyZWQAAAAA0AAAAAAAAAAVV3JvbmdEZXN0aW5hdGlvbkNoYWluAAAAAAAA0QAAAAAAAAATVW5rbm93bkFub3RoZXJDaGFpbgAAAADSAAAAAAAAABFUb2tlbnNBbHJlYWR5U2VudAAAAAAAANMAAAAAAAAAEE1lc3NhZ2VQcm9jZXNzZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ"]),o);this.options=o}fromJSON={initialize:this.txFromJSON,swap_and_bridge:this.txFromJSON,receive_tokens:this.txFromJSON,swap:this.txFromJSON,stop_swap:this.txFromJSON,start_swap:this.txFromJSON,set_gas_oracle:this.txFromJSON,set_stop_authority:this.txFromJSON,set_rebalancer:this.txFromJSON,set_messenger:this.txFromJSON,set_gas_usage:this.txFromJSON,register_bridge:this.txFromJSON,add_bridge_token:this.txFromJSON,remove_bridge_token:this.txFromJSON,add_pool:this.txFromJSON,withdraw_gas_tokens:this.txFromJSON,withdraw_bridging_fee_in_tokens:this.txFromJSON,has_processed_message:this.txFromJSON,has_received_message:this.txFromJSON,get_pool_address:this.txFromJSON,get_config:this.txFromJSON,get_stop_authority:this.txFromJSON,get_transaction_cost:this.txFromJSON,get_gas_usage:this.txFromJSON,get_admin:this.txFromJSON,get_gas_oracle:this.txFromJSON,get_another_bridge:this.txFromJSON,set_admin:this.txFromJSON,upgrade:this.txFromJSON}};var Ia=class extends ir{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";async buildRawTransactionSend(o){let s=await Rr(this.chainType,o,this.api);return await this.buildRawTransactionSendFromParams(s)}async buildRawTransactionSendFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,Mf.Big)(b).plus(P).toFixed());let W=this.getContract(ni,i,a),S;return g==="stablecoin"?S=await W.swap_and_bridge({sender:a,token:va.Address.contract(Buffer.from(c)).toString(),amount:BigInt(s),recipient:Buffer.from(l),destination_chain_id:+u,receive_token:Buffer.from(p),nonce:qr(),gas_amount:BigInt(0),fee_token_amount:BigInt(b)}):S=await W.swap_and_bridge({sender:a,token:va.Address.contract(Buffer.from(c)).toString(),amount:BigInt(s),recipient:Buffer.from(l),destination_chain_id:+u,receive_token:Buffer.from(p),nonce:qr(),gas_amount:BigInt(b),fee_token_amount:BigInt(0)}),S.toXDR()}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o;return(await this.getContract(ni,i,a).swap({sender:a,amount:BigInt(s),token:va.Address.contract(Buffer.from(c)).toBuffer(),receive_token:Buffer.from(l),recipient:u,receive_amount_min:BigInt(p)})).toXDR()}send(o){throw new st}getContract(o,s,i){let a={publicKey:i,contractId:s,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new o(a)}};var Rf="1.18.0",Ff="1.40.0";var ub={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"},Ma=class extends Error{},rs=class extends Ma{constructor(r,o){super(r),this.code=o,this.type=ub[o]??"ServerError"}},Ra=class extends Ma{constructor(r,o,s){super(r),this.status=o,this.statusText=s}};var kf=n=>{throw TypeError(n)},al=(n,r,o)=>r.has(n)||kf("Cannot "+o),Ye=(n,r,o)=>(al(n,r,"read from private field"),o?o.call(n):r.get(n)),ho=(n,r,o)=>r.has(n)?kf("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),ns=(n,r,o,s)=>(al(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),Of=(n,r,o)=>(al(n,r,"access private method"),o),lb=(n,r,o,s)=>({set _(i){ns(n,r,i,o)},get _(){return Ye(n,r,s)}}),yo,oi,gn,bo,si,os,Fa,Ef,xf;function db(n){let r=new URL(n);return r.protocol=r.protocol.replace("http","ws"),r.toString()}var pb={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5},ka=class{constructor(r,o={}){if(ho(this,Fa),ho(this,yo,0),ho(this,oi,0),ho(this,gn,null),ho(this,bo,null),ho(this,si,new Set),ho(this,os,new Map),this.endpoint=r,this.options={...pb,...o},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=db(this.endpoint))}async makeRequest(r,o){let s=await Of(this,Fa,Ef).call(this);return new Promise((i,a)=>{ns(this,yo,Ye(this,yo)+1),Ye(this,os).set(Ye(this,yo),{resolve:i,reject:a,timeout:setTimeout(()=>{Ye(this,os).delete(Ye(this,yo)),a(new Error(`Request timeout: ${r}`))},this.options.callTimeout)}),s.send(JSON.stringify({jsonrpc:"2.0",id:Ye(this,yo),method:r,params:o}))}).then(({error:i,result:a})=>{if(i)throw new rs(i.message,i.code);return a})}async subscribe(r){let o=new il(r);return Ye(this,si).add(o),await o.subscribe(this),()=>o.unsubscribe(this)}};yo=new WeakMap;oi=new WeakMap;gn=new WeakMap;bo=new WeakMap;si=new WeakMap;os=new WeakMap;Fa=new WeakSet;Ef=function(){return Ye(this,bo)?Ye(this,bo):(ns(this,bo,new Promise(n=>{Ye(this,gn)?.close(),ns(this,gn,new this.options.WebSocketConstructor(this.endpoint)),Ye(this,gn).addEventListener("open",()=>{ns(this,oi,0),n(Ye(this,gn))}),Ye(this,gn).addEventListener("close",()=>{lb(this,oi)._++,Ye(this,oi)<=this.options.maxReconnects&&setTimeout(()=>{Of(this,Fa,xf).call(this)},this.options.reconnectTimeout)}),Ye(this,gn).addEventListener("message",({data:r})=>{let o;try{o=JSON.parse(r)}catch(s){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:s}));return}if("id"in o&&o.id!=null&&Ye(this,os).has(o.id)){let{resolve:s,timeout:i}=Ye(this,os).get(o.id);clearTimeout(i),s(o)}else if("params"in o){let{params:s}=o;Ye(this,si).forEach(i=>{i.subscriptionId===s.subscription&&s.subscription===i.subscriptionId&&i.onMessage(s.result)})}})})),Ye(this,bo))};xf=async function(){return Ye(this,gn)?.close(),ns(this,bo,null),Promise.allSettled([...Ye(this,si)].map(n=>n.subscribe(this)))};var il=class{constructor(r){this.subscriptionId=null,this.subscribed=!1,this.input=r}onMessage(r){this.subscribed&&this.input.onMessage(r)}async unsubscribe(r){let{subscriptionId:o}=this;return this.subscribed=!1,o==null?!1:(this.subscriptionId=null,r.makeRequest(this.input.unsubscribe,[o]))}async subscribe(r){this.subscriptionId=null,this.subscribed=!0;let o=await r.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=o)}};var Df=n=>{throw TypeError(n)},ll=(n,r,o)=>r.has(n)||Df("Cannot "+o),yr=(n,r,o)=>(ll(n,r,"read from private field"),o?o.call(n):r.get(n)),Oa=(n,r,o)=>r.has(n)?Df("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),cl=(n,r,o,s)=>(ll(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),Ab=(n,r,o)=>(ll(n,r,"access private method"),o),ii,Fr,ai,ul,Nf,Ea=class{constructor(r){Oa(this,ul),Oa(this,ii,0),Oa(this,Fr),Oa(this,ai),cl(this,Fr,r)}fetch(r,o){let s=yr(this,Fr).fetch??fetch;if(!s)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return s(r,o)}async request(r){cl(this,ii,yr(this,ii)+1);let o=await this.fetch(yr(this,Fr).rpc?.url??yr(this,Fr).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":Rf,"Client-Target-Api-Version":Ff,"Client-Request-Method":r.method,...yr(this,Fr).rpc?.headers},body:JSON.stringify({jsonrpc:"2.0",id:yr(this,ii),method:r.method,params:r.params})});if(!o.ok)throw new Ra(`Unexpected status code: ${o.status}`,o.status,o.statusText);let s=await o.json();if("error"in s&&s.error!=null)throw new rs(s.error.message,s.error.code);return s.result}async subscribe(r){let o=await Ab(this,ul,Nf).call(this).subscribe(r);return async()=>!!await o()}};ii=new WeakMap;Fr=new WeakMap;ai=new WeakMap;ul=new WeakSet;Nf=function(){if(!yr(this,ai)){let n=yr(this,Fr).WebSocketConstructor??WebSocket;if(!n)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");cl(this,ai,new ka(yr(this,Fr).websocket?.url??yr(this,Fr).url,{WebSocketConstructor:n,...yr(this,Fr).websocket}))}return yr(this,ai)};var wn=require("@mysten/bcs");Pt();Ht();var Be=require("@mysten/bcs");var Db=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Nb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function Jf(n,r="at"){let o=n.toLowerCase(),s;if(o.includes("@")){if(!Db.test(o))throw new Error(`Invalid SuiNS name ${n}`);let[i,a]=o.split("@");s=[...i?i.split("."):[],a]}else{if(!Nb.test(o))throw new Error(`Invalid SuiNS name ${n}`);s=o.split(".").slice(0,-1)}return r==="dot"?`${s.join(".")}.sui`:`${s.slice(0,-1).join(".")}@${s[s.length-1]}`}Ht();var Ub=BigInt(1e9),Ul="0x1",Ua="0x2";var _a=Jt("0x6");var _l=`${Ua}::sui::SUI`,_b=Jt("0x5");Ht();var jb="object",zb="ID",Vb="ascii",Gb="String",Lb="string",$b="String",Zb="option",Jb="Option";function Hf(n){let r=typeof n.body=="object"&&"datatype"in n.body?n.body.datatype:null;return!!r&&le(r.package)===le("0x2")&&r.module==="tx_context"&&r.type==="TxContext"}function ja(n){if(typeof n=="string")switch(n){case"address":return R.Address;case"bool":return R.Bool;case"u8":return R.U8;case"u16":return R.U16;case"u32":return R.U32;case"u64":return R.U64;case"u128":return R.U128;case"u256":return R.U256;default:throw new Error(`Unknown type signature ${n}`)}if("vector"in n){if(n.vector==="u8")return R.vector(R.U8).transform({input:o=>typeof o=="string"?new TextEncoder().encode(o):o,output:o=>o});let r=ja(n.vector);return r?R.vector(r):null}if("datatype"in n){let r=le(n.datatype.package);if(r===le(Ul)){if(n.datatype.module===Vb&&n.datatype.type===Gb)return R.String;if(n.datatype.module===Lb&&n.datatype.type===$b)return R.String;if(n.datatype.module===Zb&&n.datatype.type===Jb){let o=ja(n.datatype.typeParameters[0]);return o?R.vector(o):null}}if(r===le(Ua)&&n.datatype.module===jb&&n.datatype.type===zb)return R.Address}return null}function Kf(n){return typeof n=="object"&&"Reference"in n?{ref:"&",body:li(n.Reference)}:typeof n=="object"&&"MutableReference"in n?{ref:"&mut",body:li(n.MutableReference)}:{ref:null,body:li(n)}}function li(n){if(typeof n=="string")switch(n){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${n}`)}if("Vector"in n)return{vector:li(n.Vector)};if("Struct"in n)return{datatype:{package:n.Struct.address,module:n.Struct.module,type:n.Struct.name,typeParameters:n.Struct.typeArguments.map(li)}};if("TypeParameter"in n)return{typeParameter:n.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(n)}`)}var Xf=require("@mysten/bcs");Ht();function Hb(n){return{$kind:"Pure",Pure:{bytes:n instanceof Uint8Array?(0,Xf.toBase64)(n):n.toBase64()}}}var Xt={Pure:Hb,ObjectRef({objectId:n,digest:r,version:o}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:r,version:o,objectId:le(n)}}}},SharedObjectRef({objectId:n,mutable:r,initialSharedVersion:o}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:r,initialSharedVersion:o,objectId:le(n)}}}},ReceivingRef({objectId:n,digest:r,version:o}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:r,version:o,objectId:le(n)}}}}};var Gl=require("@mysten/bcs"),xr=require("valibot");Ht();var w=require("valibot");Ht();function _n(n){let r=Object.entries(n).map(([o,s])=>(0,w.object)({[o]:s}));return(0,w.pipe)((0,w.union)(r),(0,w.transform)(o=>({...o,$kind:Object.keys(o)[0]})))}var To=(0,w.pipe)((0,w.string)(),(0,w.transform)(n=>le(n)),(0,w.check)(cr)),_t=To,Un=(0,w.string)(),Ft=(0,w.pipe)((0,w.union)([(0,w.string)(),(0,w.pipe)((0,w.number)(),(0,w.integer)())]),(0,w.check)(n=>{try{return BigInt(n),BigInt(n)>=0&&BigInt(n)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Er=(0,w.object)({objectId:To,version:Ft,digest:(0,w.string)()}),Ue=(0,w.pipe)((0,w.union)([(0,w.object)({GasCoin:(0,w.literal)(!0)}),(0,w.object)({Input:(0,w.pipe)((0,w.number)(),(0,w.integer)()),type:(0,w.optional)((0,w.literal)("pure"))}),(0,w.object)({Input:(0,w.pipe)((0,w.number)(),(0,w.integer)()),type:(0,w.optional)((0,w.literal)("object"))}),(0,w.object)({Result:(0,w.pipe)((0,w.number)(),(0,w.integer)())}),(0,w.object)({NestedResult:(0,w.tuple)([(0,w.pipe)((0,w.number)(),(0,w.integer)()),(0,w.pipe)((0,w.number)(),(0,w.integer)())])})]),(0,w.transform)(n=>({...n,$kind:Object.keys(n)[0]}))),Kb=(0,w.object)({budget:(0,w.nullable)(Ft),price:(0,w.nullable)(Ft),owner:(0,w.nullable)(To),payment:(0,w.nullable)((0,w.array)(Er))}),vv=(0,w.object)({address:(0,w.string)(),module:(0,w.string)(),name:(0,w.string)(),typeParams:(0,w.array)((0,w.string)())}),jl=(0,w.union)([(0,w.literal)("address"),(0,w.literal)("bool"),(0,w.literal)("u8"),(0,w.literal)("u16"),(0,w.literal)("u32"),(0,w.literal)("u64"),(0,w.literal)("u128"),(0,w.literal)("u256"),(0,w.object)({vector:(0,w.lazy)(()=>jl)}),(0,w.object)({datatype:(0,w.object)({package:(0,w.string)(),module:(0,w.string)(),type:(0,w.string)(),typeParameters:(0,w.array)((0,w.lazy)(()=>jl))})}),(0,w.object)({typeParameter:(0,w.pipe)((0,w.number)(),(0,w.integer)())})]),Xb=(0,w.object)({ref:(0,w.nullable)((0,w.union)([(0,w.literal)("&"),(0,w.literal)("&mut")])),body:jl}),Yb=(0,w.object)({package:_t,module:(0,w.string)(),function:(0,w.string)(),typeArguments:(0,w.array)((0,w.string)()),arguments:(0,w.array)(Ue),_argumentTypes:(0,w.optional)((0,w.nullable)((0,w.array)(Xb)))}),qb=(0,w.object)({name:(0,w.string)(),inputs:(0,w.record)((0,w.string)(),(0,w.union)([Ue,(0,w.array)(Ue)])),data:(0,w.record)((0,w.string)(),(0,w.unknown)())}),Qb=_n({MoveCall:Yb,TransferObjects:(0,w.object)({objects:(0,w.array)(Ue),address:Ue}),SplitCoins:(0,w.object)({coin:Ue,amounts:(0,w.array)(Ue)}),MergeCoins:(0,w.object)({destination:Ue,sources:(0,w.array)(Ue)}),Publish:(0,w.object)({modules:(0,w.array)(Un),dependencies:(0,w.array)(_t)}),MakeMoveVec:(0,w.object)({type:(0,w.nullable)((0,w.string)()),elements:(0,w.array)(Ue)}),Upgrade:(0,w.object)({modules:(0,w.array)(Un),dependencies:(0,w.array)(_t),package:_t,ticket:Ue}),$Intent:qb}),Yf=_n({ImmOrOwnedObject:Er,SharedObject:(0,w.object)({objectId:_t,initialSharedVersion:Ft,mutable:(0,w.boolean)()}),Receiving:Er}),eT=_n({Object:Yf,Pure:(0,w.object)({bytes:Un}),UnresolvedPure:(0,w.object)({value:(0,w.unknown)()}),UnresolvedObject:(0,w.object)({objectId:_t,version:(0,w.optional)((0,w.nullable)(Ft)),digest:(0,w.optional)((0,w.nullable)((0,w.string)())),initialSharedVersion:(0,w.optional)((0,w.nullable)(Ft))})}),zl=_n({Object:Yf,Pure:(0,w.object)({bytes:Un})}),Vl=_n({None:(0,w.literal)(!0),Epoch:Ft}),as=(0,w.object)({version:(0,w.literal)(2),sender:(0,w.nullish)(To),expiration:(0,w.nullish)(Vl),gasData:Kb,inputs:(0,w.array)(eT),commands:(0,w.array)(Qb)});var lr={MoveCall(n){let[r,o="",s=""]="target"in n?n.target.split("::"):[n.package,n.module,n.function];return{$kind:"MoveCall",MoveCall:{package:r,module:o,function:s,typeArguments:n.typeArguments??[],arguments:n.arguments??[]}}},TransferObjects(n,r){return{$kind:"TransferObjects",TransferObjects:{objects:n.map(o=>(0,xr.parse)(Ue,o)),address:(0,xr.parse)(Ue,r)}}},SplitCoins(n,r){return{$kind:"SplitCoins",SplitCoins:{coin:(0,xr.parse)(Ue,n),amounts:r.map(o=>(0,xr.parse)(Ue,o))}}},MergeCoins(n,r){return{$kind:"MergeCoins",MergeCoins:{destination:(0,xr.parse)(Ue,n),sources:r.map(o=>(0,xr.parse)(Ue,o))}}},Publish({modules:n,dependencies:r}){return{$kind:"Publish",Publish:{modules:n.map(o=>typeof o=="string"?o:(0,Gl.toBase64)(new Uint8Array(o))),dependencies:r.map(o=>Jt(o))}}},Upgrade({modules:n,dependencies:r,package:o,ticket:s}){return{$kind:"Upgrade",Upgrade:{modules:n.map(i=>typeof i=="string"?i:(0,Gl.toBase64)(new Uint8Array(i))),dependencies:r.map(i=>Jt(i)),package:o,ticket:(0,xr.parse)(Ue,s)}}},MakeMoveVec({type:n,elements:r}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:n??null,elements:r.map(o=>(0,xr.parse)(Ue,o))}}},Intent({name:n,inputs:r={},data:o={}}){return{$kind:"$Intent",$Intent:{name:n,inputs:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,Array.isArray(i)?i.map(a=>(0,xr.parse)(Ue,a)):(0,xr.parse)(Ue,i)])),data:o}}}};var cs=require("@mysten/bcs"),en=require("valibot");Ht();var jn=require("@mysten/bcs"),T=require("valibot");Pt();var Ll=(0,T.object)({digest:(0,T.string)(),objectId:(0,T.string)(),version:(0,T.union)([(0,T.pipe)((0,T.number)(),(0,T.integer)()),(0,T.string)(),(0,T.bigint)()])}),tT=_n({ImmOrOwned:Ll,Shared:(0,T.object)({objectId:_t,initialSharedVersion:Ft,mutable:(0,T.boolean)()}),Receiving:Ll}),qf=_n({Object:tT,Pure:(0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))}),em=(0,T.union)([(0,T.object)({kind:(0,T.literal)("Input"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),value:(0,T.unknown)(),type:(0,T.optional)((0,T.literal)("object"))}),(0,T.object)({kind:(0,T.literal)("Input"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),value:(0,T.unknown)(),type:(0,T.literal)("pure")})]),rT=(0,T.union)([(0,T.object)({Epoch:(0,T.pipe)((0,T.number)(),(0,T.integer)())}),(0,T.object)({None:(0,T.nullable)((0,T.literal)(!0))})]),Qf=(0,T.pipe)((0,T.union)([(0,T.number)(),(0,T.string)(),(0,T.bigint)()]),(0,T.check)(n=>{if(!["string","number","bigint"].includes(typeof n))return!1;try{return BigInt(n),!0}catch{return!1}})),$l=(0,T.union)([(0,T.object)({bool:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u8:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u64:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u128:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({address:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({signer:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({vector:(0,T.lazy)(()=>$l)}),(0,T.object)({struct:(0,T.lazy)(()=>nT)}),(0,T.object)({u16:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u32:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u256:(0,T.nullable)((0,T.literal)(!0))})]),nT=(0,T.object)({address:(0,T.string)(),module:(0,T.string)(),name:(0,T.string)(),typeParams:(0,T.array)($l)}),oT=(0,T.object)({budget:(0,T.optional)(Qf),price:(0,T.optional)(Qf),payment:(0,T.optional)((0,T.array)(Ll)),owner:(0,T.optional)((0,T.string)())}),sT=[em,(0,T.object)({kind:(0,T.literal)("GasCoin")}),(0,T.object)({kind:(0,T.literal)("Result"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)())}),(0,T.object)({kind:(0,T.literal)("NestedResult"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),resultIndex:(0,T.pipe)((0,T.number)(),(0,T.integer)())})],Tn=(0,T.union)([...sT]),iT=(0,T.object)({kind:(0,T.literal)("MoveCall"),target:(0,T.pipe)((0,T.string)(),(0,T.check)(n=>n.split("::").length===3)),typeArguments:(0,T.array)((0,T.string)()),arguments:(0,T.array)(Tn)}),aT=(0,T.object)({kind:(0,T.literal)("TransferObjects"),objects:(0,T.array)(Tn),address:Tn}),cT=(0,T.object)({kind:(0,T.literal)("SplitCoins"),coin:Tn,amounts:(0,T.array)(Tn)}),uT=(0,T.object)({kind:(0,T.literal)("MergeCoins"),destination:Tn,sources:(0,T.array)(Tn)}),lT=(0,T.object)({kind:(0,T.literal)("MakeMoveVec"),type:(0,T.union)([(0,T.object)({Some:$l}),(0,T.object)({None:(0,T.nullable)((0,T.literal)(!0))})]),objects:(0,T.array)(Tn)}),dT=(0,T.object)({kind:(0,T.literal)("Publish"),modules:(0,T.array)((0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))),dependencies:(0,T.array)((0,T.string)())}),pT=(0,T.object)({kind:(0,T.literal)("Upgrade"),modules:(0,T.array)((0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))),dependencies:(0,T.array)((0,T.string)()),packageId:(0,T.string)(),ticket:Tn}),AT=[iT,aT,cT,uT,dT,pT,lT],fT=(0,T.union)([...AT]),Ev=(0,T.object)({version:(0,T.literal)(1),sender:(0,T.optional)((0,T.string)()),expiration:(0,T.nullish)(rT),gasConfig:oT,inputs:(0,T.array)(em),transactions:(0,T.array)(fT)});function Zl(n){let r=n.inputs.map((o,s)=>{if(o.Object)return{kind:"Input",index:s,value:{Object:o.Object.ImmOrOwnedObject?{ImmOrOwned:o.Object.ImmOrOwnedObject}:o.Object.Receiving?{Receiving:{digest:o.Object.Receiving.digest,version:o.Object.Receiving.version,objectId:o.Object.Receiving.objectId}}:{Shared:{mutable:o.Object.SharedObject.mutable,initialSharedVersion:o.Object.SharedObject.initialSharedVersion,objectId:o.Object.SharedObject.objectId}}},type:"object"};if(o.Pure)return{kind:"Input",index:s,value:{Pure:Array.from((0,jn.fromBase64)(o.Pure.bytes))},type:"pure"};if(o.UnresolvedPure)return{kind:"Input",type:"pure",index:s,value:o.UnresolvedPure.value};if(o.UnresolvedObject)return{kind:"Input",type:"object",index:s,value:o.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:n.sender??void 0,expiration:n.expiration?.$kind==="Epoch"?{Epoch:Number(n.expiration.Epoch)}:n.expiration?{None:!0}:null,gasConfig:{owner:n.gasData.owner??void 0,budget:n.gasData.budget??void 0,price:n.gasData.price??void 0,payment:n.gasData.payment??void 0},inputs:r,transactions:n.commands.map(o=>{if(o.MakeMoveVec)return{kind:"MakeMoveVec",type:o.MakeMoveVec.type===null?{None:!0}:{Some:hn.parseFromStr(o.MakeMoveVec.type)},objects:o.MakeMoveVec.elements.map(s=>yn(s,r))};if(o.MergeCoins)return{kind:"MergeCoins",destination:yn(o.MergeCoins.destination,r),sources:o.MergeCoins.sources.map(s=>yn(s,r))};if(o.MoveCall)return{kind:"MoveCall",target:`${o.MoveCall.package}::${o.MoveCall.module}::${o.MoveCall.function}`,typeArguments:o.MoveCall.typeArguments,arguments:o.MoveCall.arguments.map(s=>yn(s,r))};if(o.Publish)return{kind:"Publish",modules:o.Publish.modules.map(s=>Array.from((0,jn.fromBase64)(s))),dependencies:o.Publish.dependencies};if(o.SplitCoins)return{kind:"SplitCoins",coin:yn(o.SplitCoins.coin,r),amounts:o.SplitCoins.amounts.map(s=>yn(s,r))};if(o.TransferObjects)return{kind:"TransferObjects",objects:o.TransferObjects.objects.map(s=>yn(s,r)),address:yn(o.TransferObjects.address,r)};if(o.Upgrade)return{kind:"Upgrade",modules:o.Upgrade.modules.map(s=>Array.from((0,jn.fromBase64)(s))),dependencies:o.Upgrade.dependencies,packageId:o.Upgrade.package,ticket:yn(o.Upgrade.ticket,r)};throw new Error(`Unknown transaction ${Object.keys(o)}`)})}}function yn(n,r){if(n.$kind==="GasCoin")return{kind:"GasCoin"};if(n.$kind==="Result")return{kind:"Result",index:n.Result};if(n.$kind==="NestedResult")return{kind:"NestedResult",index:n.NestedResult[0],resultIndex:n.NestedResult[1]};if(n.$kind==="Input")return r[n.Input];throw new Error(`Invalid argument ${Object.keys(n)}`)}function tm(n){return(0,T.parse)(as,{version:2,sender:n.sender??null,expiration:n.expiration?"Epoch"in n.expiration?{Epoch:n.expiration.Epoch}:{None:!0}:null,gasData:{owner:n.gasConfig.owner??null,budget:n.gasConfig.budget?.toString()??null,price:n.gasConfig.price?.toString()??null,payment:n.gasConfig.payment?.map(r=>({digest:r.digest,objectId:r.objectId,version:r.version.toString()}))??null},inputs:n.inputs.map(r=>{if(r.kind==="Input"){if((0,T.is)(qf,r.value)){let o=(0,T.parse)(qf,r.value);if(o.Object){if(o.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:o.Object.ImmOrOwned.objectId,version:String(o.Object.ImmOrOwned.version),digest:o.Object.ImmOrOwned.digest}}};if(o.Object.Shared)return{Object:{SharedObject:{mutable:o.Object.Shared.mutable??null,initialSharedVersion:o.Object.Shared.initialSharedVersion,objectId:o.Object.Shared.objectId}}};if(o.Object.Receiving)return{Object:{Receiving:{digest:o.Object.Receiving.digest,version:String(o.Object.Receiving.version),objectId:o.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:(0,jn.toBase64)(new Uint8Array(o.Pure))}}}return r.type==="object"?{UnresolvedObject:{objectId:r.value}}:{UnresolvedPure:{value:r.value}}}throw new Error("Invalid input")}),commands:n.transactions.map(r=>{switch(r.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in r.type?hn.tagToString(r.type.Some):null,elements:r.objects.map(o=>bn(o))}};case"MergeCoins":return{MergeCoins:{destination:bn(r.destination),sources:r.sources.map(o=>bn(o))}};case"MoveCall":{let[o,s,i]=r.target.split("::");return{MoveCall:{package:o,module:s,function:i,typeArguments:r.typeArguments,arguments:r.arguments.map(a=>bn(a))}}}case"Publish":return{Publish:{modules:r.modules.map(o=>(0,jn.toBase64)(Uint8Array.from(o))),dependencies:r.dependencies}};case"SplitCoins":return{SplitCoins:{coin:bn(r.coin),amounts:r.amounts.map(o=>bn(o))}};case"TransferObjects":return{TransferObjects:{objects:r.objects.map(o=>bn(o)),address:bn(r.address)}};case"Upgrade":return{Upgrade:{modules:r.modules.map(o=>(0,jn.toBase64)(Uint8Array.from(o))),dependencies:r.dependencies,package:r.packageId,ticket:bn(r.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(r)}`)})})}function bn(n){switch(n.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:n.index};case"NestedResult":return{NestedResult:[n.index,n.resultIndex]};case"Input":return{Input:n.index}}}var E=require("valibot");function di(n){return(0,E.union)(Object.entries(n).map(([r,o])=>(0,E.object)({[r]:o})))}var Dr=di({GasCoin:(0,E.literal)(!0),Input:(0,E.pipe)((0,E.number)(),(0,E.integer)()),Result:(0,E.pipe)((0,E.number)(),(0,E.integer)()),NestedResult:(0,E.tuple)([(0,E.pipe)((0,E.number)(),(0,E.integer)()),(0,E.pipe)((0,E.number)(),(0,E.integer)())])}),mT=(0,E.object)({budget:(0,E.nullable)(Ft),price:(0,E.nullable)(Ft),owner:(0,E.nullable)(To),payment:(0,E.nullable)((0,E.array)(Er))}),gT=(0,E.object)({package:_t,module:(0,E.string)(),function:(0,E.string)(),typeArguments:(0,E.array)((0,E.string)()),arguments:(0,E.array)(Dr)}),hT=(0,E.object)({name:(0,E.string)(),inputs:(0,E.record)((0,E.string)(),(0,E.union)([Dr,(0,E.array)(Dr)])),data:(0,E.record)((0,E.string)(),(0,E.unknown)())}),yT=di({MoveCall:gT,TransferObjects:(0,E.object)({objects:(0,E.array)(Dr),address:Dr}),SplitCoins:(0,E.object)({coin:Dr,amounts:(0,E.array)(Dr)}),MergeCoins:(0,E.object)({destination:Dr,sources:(0,E.array)(Dr)}),Publish:(0,E.object)({modules:(0,E.array)(Un),dependencies:(0,E.array)(_t)}),MakeMoveVec:(0,E.object)({type:(0,E.nullable)((0,E.string)()),elements:(0,E.array)(Dr)}),Upgrade:(0,E.object)({modules:(0,E.array)(Un),dependencies:(0,E.array)(_t),package:_t,ticket:Dr}),$Intent:hT}),bT=di({ImmOrOwnedObject:Er,SharedObject:(0,E.object)({objectId:_t,initialSharedVersion:Ft,mutable:(0,E.boolean)()}),Receiving:Er}),TT=di({Object:bT,Pure:(0,E.object)({bytes:Un}),UnresolvedPure:(0,E.object)({value:(0,E.unknown)()}),UnresolvedObject:(0,E.object)({objectId:_t,version:(0,E.optional)((0,E.nullable)(Ft)),digest:(0,E.optional)((0,E.nullable)((0,E.string)())),initialSharedVersion:(0,E.optional)((0,E.nullable)(Ft))})}),PT=di({None:(0,E.literal)(!0),Epoch:Ft}),rm=(0,E.object)({version:(0,E.literal)(2),sender:(0,E.nullish)(To),expiration:(0,E.nullish)(PT),gasData:mT,inputs:(0,E.array)(TT),commands:(0,E.array)(yT)});var om=require("valibot");Pt();var wT=50,CT=1000n,BT=5e10;async function sm(n,r,o){return await MT(n,r),await IT(n,r),r.onlyTransactionKind||(await WT(n,r),await ST(n,r),await vT(n,r)),await RT(n),await o()}async function WT(n,r){n.gasConfig.price||(n.gasConfig.price=String(await Po(r).getReferenceGasPrice()))}async function ST(n,r){if(n.gasConfig.budget)return;let o=await Po(r).dryRunTransactionBlock({transactionBlock:n.build({overrides:{gasData:{budget:String(BT),payment:[]}}})});if(o.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${o.effects.status.error}`,{cause:o});let s=CT*BigInt(n.gasConfig.price||1n),i=BigInt(o.effects.gasUsed.computationCost)+s,a=i+BigInt(o.effects.gasUsed.storageCost)-BigInt(o.effects.gasUsed.storageRebate);n.gasConfig.budget=String(a>i?a:i)}async function vT(n,r){if(!n.gasConfig.payment){let s=(await Po(r).getCoins({owner:n.gasConfig.owner||n.sender,coinType:_l})).data.filter(i=>!n.inputs.find(c=>c.Object?.ImmOrOwnedObject?i.coinObjectId===c.Object.ImmOrOwnedObject.objectId:!1)).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!s.length)throw new Error("No valid gas coins found for the transaction.");n.gasConfig.payment=s.map(i=>(0,om.parse)(Er,i))}}async function IT(n,r){let o=n.inputs.filter(A=>A.UnresolvedObject&&!(A.UnresolvedObject.version||A.UnresolvedObject?.initialSharedVersion)),s=[...new Set(o.map(A=>Jt(A.UnresolvedObject.objectId)))],i=s.length?ET(s,wT):[],a=(await Promise.all(i.map(A=>Po(r).multiGetObjects({ids:A,options:{showOwner:!0}})))).flat(),c=new Map(s.map((A,g)=>[A,a[g]])),u=Array.from(c).filter(([A,g])=>g.error).map(([A,g])=>JSON.stringify(g.error));if(u.length)throw new Error(`The following input objects are invalid: ${u.join(", ")}`);let l=a.map(A=>{if(A.error||!A.data)throw new Error(`Failed to fetch object: ${A.error}`);let g=A.data.owner,P=g&&typeof g=="object"&&"Shared"in g?g.Shared.initial_shared_version:null;return{objectId:A.data.objectId,digest:A.data.digest,version:A.data.version,initialSharedVersion:P}}),p=new Map(s.map((A,g)=>[A,l[g]]));for(let[A,g]of n.inputs.entries()){if(!g.UnresolvedObject)continue;let P,b=le(g.UnresolvedObject.objectId),W=p.get(b);g.UnresolvedObject.initialSharedVersion??W?.initialSharedVersion?P=Xt.SharedObjectRef({objectId:b,initialSharedVersion:g.UnresolvedObject.initialSharedVersion||W?.initialSharedVersion,mutable:FT(n,A)}):kT(n,A)&&(P=Xt.ReceivingRef({objectId:b,digest:g.UnresolvedObject.digest??W?.digest,version:g.UnresolvedObject.version??W?.version})),n.inputs[n.inputs.indexOf(g)]=P??Xt.ObjectRef({objectId:b,digest:g.UnresolvedObject.digest??W?.digest,version:g.UnresolvedObject.version??W?.version})}}async function MT(n,r){let{inputs:o,commands:s}=n,i=[],a=new Set;s.forEach(u=>{if(u.MoveCall){if(u.MoveCall._argumentTypes)return;if(u.MoveCall.arguments.map(A=>A.$kind==="Input"?n.inputs[A.Input]:null).some(A=>A?.UnresolvedPure||A?.UnresolvedObject)){let A=`${u.MoveCall.package}::${u.MoveCall.module}::${u.MoveCall.function}`;a.add(A),i.push(u.MoveCall)}}switch(u.$kind){case"SplitCoins":u.SplitCoins.amounts.forEach(l=>{nm(l,R.U64,n)});break;case"TransferObjects":nm(u.TransferObjects.address,R.Address,n);break}});let c=new Map;if(a.size>0){let u=Po(r);await Promise.all([...a].map(async l=>{let[p,A,g]=l.split("::"),P=await u.getNormalizedMoveFunction({package:p,module:A,function:g});c.set(l,P.parameters.map(b=>Kf(b)))}))}i.length&&await Promise.all(i.map(async u=>{let l=c.get(`${u.package}::${u.module}::${u.function}`);if(!l)return;let A=l.length>0&&Hf(l.at(-1))?l.slice(0,l.length-1):l;u._argumentTypes=A})),s.forEach(u=>{if(!u.MoveCall)return;let l=u.MoveCall,p=`${l.package}::${l.module}::${l.function}`,A=l._argumentTypes;if(A){if(A.length!==u.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${p}`);A.forEach((g,P)=>{let b=l.arguments[P];if(b.$kind!=="Input")return;let W=o[b.Input];if(!W.UnresolvedPure&&!W.UnresolvedObject)return;let S=W.UnresolvedPure?.value??W.UnresolvedObject?.objectId,F=ja(g.body);if(F){b.type="pure",o[o.indexOf(W)]=Xt.Pure(F.serialize(S));return}if(typeof S!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(S,null,2)}`);b.type="object";let U=W.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:S}}:W;o[b.Input]=U})}})}function RT(n){n.inputs.forEach((r,o)=>{if(r.$kind!=="Object"&&r.$kind!=="Pure")throw new Error(`Input at index ${o} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(r)}`)})}function nm(n,r,o){if(n.$kind!=="Input")return;let s=o.inputs[n.Input];s.$kind==="UnresolvedPure"&&(o.inputs[n.Input]=Xt.Pure(r.serialize(s.UnresolvedPure.value)))}function FT(n,r){let o=!1;return n.getInputUses(r,(s,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){let a=i.MoveCall.arguments.indexOf(s);o=i.MoveCall._argumentTypes[a].ref!=="&"||o}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(o=!0)}),o}function kT(n,r){let o=!1;return n.getInputUses(r,(s,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){let a=i.MoveCall.arguments.indexOf(s);o=OT(i.MoveCall._argumentTypes[a])||o}}),o}function OT(n){return typeof n.body!="object"||!("datatype"in n.body)?!1:n.body.datatype.package==="0x2"&&n.body.datatype.module==="transfer"&&n.body.datatype.type==="Receiving"}function Po(n){if(!n.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return n.client}function ET(n,r){return Array.from({length:Math.ceil(n.length/r)},(o,s)=>n.slice(s*r,s*r+r))}function im(n){function r(o){return n(o)}return r.system=()=>r("0x5"),r.clock=()=>r("0x6"),r.random=()=>r("0x8"),r.denyList=()=>r("0x403"),r.option=({type:o,value:s})=>i=>i.moveCall({typeArguments:[o],target:`0x1::option::${s===null?"none":"some"}`,arguments:s===null?[]:[i.object(s)]}),r}var am=require("@mysten/bcs");Pt();function cm(n){function r(o,s){if(typeof o=="string")return n(pi(o).serialize(s));if(o instanceof Uint8Array||(0,am.isSerializedBcs)(o))return n(o);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return r.u8=o=>n(R.U8.serialize(o)),r.u16=o=>n(R.U16.serialize(o)),r.u32=o=>n(R.U32.serialize(o)),r.u64=o=>n(R.U64.serialize(o)),r.u128=o=>n(R.U128.serialize(o)),r.u256=o=>n(R.U256.serialize(o)),r.bool=o=>n(R.Bool.serialize(o)),r.string=o=>n(R.String.serialize(o)),r.address=o=>n(R.Address.serialize(o)),r.id=r.address,r.vector=(o,s)=>n(R.vector(pi(o)).serialize(s)),r.option=(o,s)=>n(R.option(pi(o)).serialize(s)),r}function pi(n){switch(n){case"u8":return R.u8();case"u16":return R.u16();case"u32":return R.u32();case"u64":return R.u64();case"u128":return R.u128();case"u256":return R.u256();case"bool":return R.bool();case"string":return R.string();case"id":case"address":return R.Address}let r=n.match(/^(vector|option)<(.+)>$/);if(r){let[o,s]=r.slice(1);return o==="vector"?R.vector(pi(s)):R.option(pi(s))}throw new Error(`Invalid Pure type name: ${n}`)}var pm=require("@mysten/bcs"),za=require("valibot");Pt();Ht();var um=require("@noble/hashes/blake2b");function lm(n,r){let o=Array.from(`${n}::`).map(i=>i.charCodeAt(0)),s=new Uint8Array(o.length+r.length);return s.set(o),s.set(r,o.length),(0,um.blake2b)(s,{dkLen:32})}function dm(n){return le(n).replace("0x","")}var zn=class n{constructor(r){this.version=2,this.sender=r?.sender??null,this.expiration=r?.expiration??null,this.inputs=r?.inputs??[],this.commands=r?.commands??[],this.gasData=r?.gasData??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(r){let s=R.TransactionKind.parse(r).ProgrammableTransaction;if(!s)throw new Error("Unable to deserialize from bytes.");return n.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:s.inputs,commands:s.commands})}static fromBytes(r){let s=R.TransactionData.parse(r)?.V1,i=s.kind.ProgrammableTransaction;if(!s||!i)throw new Error("Unable to deserialize from bytes.");return n.restore({version:2,sender:s.sender,expiration:s.expiration,gasData:s.gasData,inputs:i.inputs,commands:i.commands})}static restore(r){return r.version===2?new n((0,za.parse)(as,r)):new n((0,za.parse)(as,tm(r)))}static getDigestFromBytes(r){let o=lm("TransactionData",r);return(0,pm.toBase58)(o)}get gasConfig(){return this.gasData}set gasConfig(r){this.gasData=r}build({maxSizeBytes:r=1/0,overrides:o,onlyTransactionKind:s}={}){let i=this.inputs,a=this.commands,c={ProgrammableTransaction:{inputs:i,commands:a}};if(s)return R.TransactionKind.serialize(c,{maxSize:r}).toBytes();let u=o?.expiration??this.expiration,l=o?.sender??this.sender,p={...this.gasData,...o?.gasConfig,...o?.gasData};if(!l)throw new Error("Missing transaction sender");if(!p.budget)throw new Error("Missing gas budget");if(!p.payment)throw new Error("Missing gas payment");if(!p.price)throw new Error("Missing gas price");let A={sender:dm(l),expiration:u||{None:!0},gasData:{payment:p.payment,owner:dm(this.gasData.owner??l),price:BigInt(p.price),budget:BigInt(p.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:a}}};return R.TransactionData.serialize({V1:A},{maxSize:r}).toBytes()}addInput(r,o){let s=this.inputs.length;return this.inputs.push(o),{Input:s,type:r,$kind:"Input"}}getInputUses(r,o){this.mapArguments((s,i)=>(s.$kind==="Input"&&s.Input===r&&o(s,i),s))}mapArguments(r){for(let o of this.commands)switch(o.$kind){case"MoveCall":o.MoveCall.arguments=o.MoveCall.arguments.map(i=>r(i,o));break;case"TransferObjects":o.TransferObjects.objects=o.TransferObjects.objects.map(i=>r(i,o)),o.TransferObjects.address=r(o.TransferObjects.address,o);break;case"SplitCoins":o.SplitCoins.coin=r(o.SplitCoins.coin,o),o.SplitCoins.amounts=o.SplitCoins.amounts.map(i=>r(i,o));break;case"MergeCoins":o.MergeCoins.destination=r(o.MergeCoins.destination,o),o.MergeCoins.sources=o.MergeCoins.sources.map(i=>r(i,o));break;case"MakeMoveVec":o.MakeMoveVec.elements=o.MakeMoveVec.elements.map(i=>r(i,o));break;case"Upgrade":o.Upgrade.ticket=r(o.Upgrade.ticket,o);break;case"$Intent":let s=o.$Intent.inputs;o.$Intent.inputs={};for(let[i,a]of Object.entries(s))o.$Intent.inputs[i]=Array.isArray(a)?a.map(c=>r(c,o)):r(a,o);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${o.$kind}`)}}replaceCommand(r,o){if(!Array.isArray(o)){this.commands[r]=o;return}let s=o.length-1;this.commands.splice(r,1,...o),s!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>r&&(i.Result+=s);break;case"NestedResult":i.NestedResult[0]>r&&(i.NestedResult[0]+=s);break}return i})}getDigest(){let r=this.build({onlyTransactionKind:!1});return n.getDigestFromBytes(r)}snapshot(){return(0,za.parse)(as,this)}};Ht();function Jl(n){if(typeof n=="string")return le(n);if(n.Object)return n.Object.ImmOrOwnedObject?le(n.Object.ImmOrOwnedObject.objectId):n.Object.Receiving?le(n.Object.Receiving.objectId):le(n.Object.SharedObject.objectId);if(n.UnresolvedObject)return le(n.UnresolvedObject.objectId)}var mm=n=>{throw TypeError(n)},Yl=(n,r,o)=>r.has(n)||mm("Cannot "+o),Te=(n,r,o)=>(Yl(n,r,"read from private field"),o?o.call(n):r.get(n)),Ai=(n,r,o)=>r.has(n)?mm("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),wo=(n,r,o,s)=>(Yl(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),Pn=(n,r,o)=>(Yl(n,r,"access private method"),o),mi,gi,Co,We,Nr,Va,ql,Kl,Ql;function Am(n,r=1/0){let o={$kind:"Result",Result:n},s=[],i=a=>s[a]??(s[a]={$kind:"NestedResult",NestedResult:[n,a]});return new Proxy(o,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(a,c){if(c in a)return Reflect.get(a,c);if(c===Symbol.iterator)return function*(){let l=0;for(;l<r;)yield i(l),l++};if(typeof c=="symbol")return;let u=parseInt(c,10);if(!(Number.isNaN(u)||u<0))return i(u)}})}var gm=Symbol.for("@mysten/transaction");function Ga(n){return!!n&&typeof n=="object"&&n[gm]===!0}var fm={buildPlugins:new Map,serializationPlugins:new Map},Hl=Symbol.for("@mysten/transaction/registry");function fi(){try{let n=globalThis;return n[Hl]||(n[Hl]=fm),n[Hl]}catch{return fm}}var xT=class Xl{constructor(){Ai(this,Nr),Ai(this,mi),Ai(this,gi),Ai(this,Co,new Map),Ai(this,We),this.object=im(o=>{if(typeof o=="function")return this.object(o(this));if(typeof o=="object"&&(0,en.is)(Ue,o))return o;let s=Jl(o),i=Te(this,We).inputs.find(a=>s===Jl(a));return i?.Object?.SharedObject&&typeof o=="object"&&o.Object?.SharedObject&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||o.Object.SharedObject.mutable),i?{$kind:"Input",Input:Te(this,We).inputs.indexOf(i),type:"object"}:Te(this,We).addInput("object",typeof o=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:le(o)}}:o)});let r=fi();wo(this,We,new zn),wo(this,gi,[...r.buildPlugins.values()]),wo(this,mi,[...r.serializationPlugins.values()])}static fromKind(r){let o=new Xl;return wo(o,We,zn.fromKindBytes(typeof r=="string"?(0,cs.fromBase64)(r):r)),o}static from(r){let o=new Xl;return Ga(r)?wo(o,We,new zn(r.getData())):typeof r!="string"||!r.startsWith("{")?wo(o,We,zn.fromBytes(typeof r=="string"?(0,cs.fromBase64)(r):r)):wo(o,We,zn.restore(JSON.parse(r))),o}static registerGlobalSerializationPlugin(r,o){fi().serializationPlugins.set(r,o??r)}static unregisterGlobalSerializationPlugin(r){fi().serializationPlugins.delete(r)}static registerGlobalBuildPlugin(r,o){fi().buildPlugins.set(r,o??r)}static unregisterGlobalBuildPlugin(r){fi().buildPlugins.delete(r)}addSerializationPlugin(r){Te(this,mi).push(r)}addBuildPlugin(r){Te(this,gi).push(r)}addIntentResolver(r,o){if(Te(this,Co).has(r)&&Te(this,Co).get(r)!==o)throw new Error(`Intent resolver for ${r} already exists`);Te(this,Co).set(r,o)}setSender(r){Te(this,We).sender=r}setSenderIfNotSet(r){Te(this,We).sender||(Te(this,We).sender=r)}setExpiration(r){Te(this,We).expiration=r?(0,en.parse)(Vl,r):null}setGasPrice(r){Te(this,We).gasConfig.price=String(r)}setGasBudget(r){Te(this,We).gasConfig.budget=String(r)}setGasBudgetIfNotSet(r){Te(this,We).gasData.budget==null&&(Te(this,We).gasConfig.budget=String(r))}setGasOwner(r){Te(this,We).gasConfig.owner=r}setGasPayment(r){Te(this,We).gasConfig.payment=r.map(o=>(0,en.parse)(Er,o))}get blockData(){return Zl(Te(this,We).snapshot())}getData(){return Te(this,We).snapshot()}get[gm](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:cm(r=>(0,cs.isSerializedBcs)(r)?Te(this,We).addInput("pure",{$kind:"Pure",Pure:{bytes:r.toBase64()}}):Te(this,We).addInput("pure",(0,en.is)(zl,r)?(0,en.parse)(zl,r):r instanceof Uint8Array?Xt.Pure(r):{$kind:"UnresolvedPure",UnresolvedPure:{value:r}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...r){return this.object(Xt.ObjectRef(...r))}receivingRef(...r){return this.object(Xt.ReceivingRef(...r))}sharedObjectRef(...r){return this.object(Xt.SharedObjectRef(...r))}add(r){if(typeof r=="function")return r(this);let o=Te(this,We).commands.push(r);return Am(o-1)}splitCoins(r,o){let s=lr.SplitCoins(typeof r=="string"?this.object(r):Pn(this,Nr,ql).call(this,r),o.map(a=>typeof a=="number"||typeof a=="bigint"||typeof a=="string"?this.pure.u64(a):Pn(this,Nr,Va).call(this,a))),i=Te(this,We).commands.push(s);return Am(i-1,o.length)}mergeCoins(r,o){return this.add(lr.MergeCoins(this.object(r),o.map(s=>this.object(s))))}publish({modules:r,dependencies:o}){return this.add(lr.Publish({modules:r,dependencies:o}))}upgrade({modules:r,dependencies:o,package:s,ticket:i}){return this.add(lr.Upgrade({modules:r,dependencies:o,package:s,ticket:this.object(i)}))}moveCall({arguments:r,...o}){return this.add(lr.MoveCall({...o,arguments:r?.map(s=>Pn(this,Nr,Va).call(this,s))}))}transferObjects(r,o){return this.add(lr.TransferObjects(r.map(s=>this.object(s)),typeof o=="string"?this.pure.address(o):Pn(this,Nr,Va).call(this,o)))}makeMoveVec({type:r,elements:o}){return this.add(lr.MakeMoveVec({type:r,elements:o.map(s=>this.object(s))}))}serialize(){return JSON.stringify(Zl(Te(this,We).snapshot()))}async toJSON(r={}){return await this.prepareForSerialization(r),JSON.stringify((0,en.parse)(rm,Te(this,We).snapshot()),(o,s)=>typeof s=="bigint"?s.toString():s,2)}async sign(r){let{signer:o,...s}=r,i=await this.build(s);return o.signTransaction(i)}async build(r={}){return await this.prepareForSerialization(r),await Pn(this,Nr,Kl).call(this,r),Te(this,We).build({onlyTransactionKind:r.onlyTransactionKind})}async getDigest(r={}){return await Pn(this,Nr,Kl).call(this,r),Te(this,We).getDigest()}async prepareForSerialization(r){let o=new Set;for(let i of Te(this,We).commands)i.$Intent&&o.add(i.$Intent.name);let s=[...Te(this,mi)];for(let i of o)if(!r.supportedIntents?.includes(i)){if(!Te(this,Co).has(i))throw new Error(`Missing intent resolver for ${i}`);s.push(Te(this,Co).get(i))}await Pn(this,Nr,Ql).call(this,s,r)}};mi=new WeakMap;gi=new WeakMap;Co=new WeakMap;We=new WeakMap;Nr=new WeakSet;Va=function(n){return(0,cs.isSerializedBcs)(n)?this.pure(n):Pn(this,Nr,ql).call(this,n)};ql=function(n){return typeof n=="function"?(0,en.parse)(Ue,n(this)):(0,en.parse)(Ue,n)};Kl=async function(n){if(!n.onlyTransactionKind&&!Te(this,We).sender)throw new Error("Missing transaction sender");await Pn(this,Nr,Ql).call(this,[...Te(this,gi),sm],n)};Ql=async function(n,r){let o=s=>{if(s>=n.length)return()=>{};let i=n[s];return async()=>{let a=o(s+1),c=!1,u=!1;if(await i(Te(this,We),r,async()=>{if(c)throw new Error(`next() was call multiple times in TransactionPlugin ${s}`);c=!0,await a(),u=!0}),!c)throw new Error(`next() was not called in TransactionPlugin ${s}`);if(!u)throw new Error(`next() was not awaited in TransactionPlugin ${s}`)}};await o(0)()};var Ur=xT;var Vn=require("valibot");Pt();Ht();var La="CoinWithBalance",hm=ui("0x2::sui::SUI");function $e({type:n=hm,balance:r,useGasCoin:o=!0}){return s=>{s.addIntentResolver(La,NT);let i=n==="gas"?n:ui(n);return s.add(lr.Intent({name:La,inputs:{},data:{type:i===hm&&o?"gas":i,balance:BigInt(r)}}))}}var DT=(0,Vn.object)({type:(0,Vn.string)(),balance:(0,Vn.bigint)()});async function NT(n,r,o){let s=new Set,i=new Map;if(!n.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(let p of n.commands)if(p.$kind==="$Intent"&&p.$Intent.name===La){let{type:A,balance:g}=(0,Vn.parse)(DT,p.$Intent.data);A!=="gas"&&g>0n&&s.add(A),i.set(A,(i.get(A)??0n)+g)}let a=new Set;for(let p of n.inputs)p.Object?.ImmOrOwnedObject&&a.add(p.Object.ImmOrOwnedObject.objectId),p.UnresolvedObject?.objectId&&a.add(p.UnresolvedObject.objectId);let c=new Map,u=Po(r);await Promise.all([...s].map(async p=>{c.set(p,await UT({coinType:p,balance:i.get(p),client:u,owner:n.sender,usedIds:a}))}));let l=new Map;l.set("gas",{$kind:"GasCoin",GasCoin:!0});for(let[p,A]of n.commands.entries()){if(A.$kind!=="$Intent"||A.$Intent.name!==La)continue;let{type:g,balance:P}=A.$Intent.data;if(P===0n){n.replaceCommand(p,lr.MoveCall({target:"0x2::coin::zero",typeArguments:[g]}));continue}let b=[];if(!l.has(g)){let[W,...S]=c.get(g).map(F=>n.addInput("object",Xt.ObjectRef({objectId:F.coinObjectId,digest:F.digest,version:F.version})));S.length>0&&b.push(lr.MergeCoins(W,S)),l.set(g,W)}b.push(lr.SplitCoins(l.get(g),[n.addInput("pure",Xt.Pure(R.u64().serialize(P)))])),n.replaceCommand(p,b),n.mapArguments(W=>W.$kind==="Result"&&W.Result===p?{$kind:"NestedResult",NestedResult:[p+b.length-1,0]}:W)}return o()}async function UT({coinType:n,balance:r,client:o,owner:s,usedIds:i}){let a=r,c=[];return u();async function u(l=null){let{data:p,hasNextPage:A,nextCursor:g}=await o.getCoins({owner:s,coinType:n,cursor:l}),P=p.sort((b,W)=>Number(BigInt(W.balance)-BigInt(b.balance)));for(let b of P){if(i.has(b.coinObjectId))continue;let W=BigInt(b.balance);if(c.push(b),a-=W,a<=0)return c}if(A)return u(g);throw new Error(`Not enough coins of type ${n} to satisfy requested balance`)}}Ht();var _T=Symbol.for("@mysten/SuiClient");var Cn=class{get[_T](){return!0}constructor(r){this.transport=r.transport??new Ea({url:r.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[r.owner,r.coinType,r.cursor,r.limit]})}async getAllCoins(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[r.owner,r.cursor,r.limit]})}async getBalance(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[r.owner,r.coinType]})}async getAllBalances(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[r.owner]})}async getCoinMetadata(r){return await this.transport.request({method:"suix_getCoinMetadata",params:[r.coinType]})}async getTotalSupply(r){return await this.transport.request({method:"suix_getTotalSupply",params:[r.coinType]})}async call(r,o){return await this.transport.request({method:r,params:o})}async getMoveFunctionArgTypes(r){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[r.package,r.module,r.function]})}async getNormalizedMoveModulesByPackage(r){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[r.package]})}async getNormalizedMoveModule(r){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[r.package,r.module]})}async getNormalizedMoveFunction(r){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[r.package,r.module,r.function]})}async getNormalizedMoveStruct(r){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[r.package,r.module,r.struct]})}async getOwnedObjects(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[r.owner,{filter:r.filter,options:r.options},r.cursor,r.limit]})}async getObject(r){if(!r.id||!ss(Jt(r.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[r.id,r.options]})}async tryGetPastObject(r){return await this.transport.request({method:"sui_tryGetPastObject",params:[r.id,r.version,r.options]})}async multiGetObjects(r){if(r.ids.forEach(s=>{if(!s||!ss(Jt(s)))throw new Error(`Invalid Sui Object id ${s}`)}),r.ids.length!==new Set(r.ids).size)throw new Error(`Duplicate object ids in batch call ${r.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[r.ids,r.options]})}async queryTransactionBlocks(r){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:r.filter,options:r.options},r.cursor,r.limit,(r.order||"descending")==="descending"]})}async getTransactionBlock(r){if(!Da(r.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[r.digest,r.options]})}async multiGetTransactionBlocks(r){if(r.digests.forEach(s=>{if(!Da(s))throw new Error(`Invalid Transaction digest ${s}`)}),r.digests.length!==new Set(r.digests).size)throw new Error(`Duplicate digests in batch call ${r.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[r.digests,r.options]})}async executeTransactionBlock({transactionBlock:r,signature:o,options:s,requestType:i}){let a=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof r=="string"?r:(0,wn.toBase64)(r),Array.isArray(o)?o:[o],s]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:a.digest})}catch{}return a}async signAndExecuteTransaction({transaction:r,signer:o,...s}){let i;r instanceof Uint8Array?i=r:(r.setSenderIfNotSet(o.toSuiAddress()),i=await r.build({client:this}));let{signature:a,bytes:c}=await o.signTransaction(i);return this.executeTransactionBlock({transactionBlock:c,signature:a,...s})}async getTotalTransactionBlocks(){let r=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(r)}async getReferenceGasPrice(){let r=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(r)}async getStakes(r){if(!r.owner||!cr(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[r.owner]})}async getStakesByIds(r){return r.stakedSuiIds.forEach(o=>{if(!o||!ss(Jt(o)))throw new Error(`Invalid Sui Stake id ${o}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[r.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(r){return await this.transport.request({method:"suix_queryEvents",params:[r.query,r.cursor,r.limit,(r.order||"descending")==="descending"]})}async subscribeEvent(r){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[r.filter],onMessage:r.onMessage})}async subscribeTransaction(r){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[r.filter],onMessage:r.onMessage})}async devInspectTransactionBlock(r){let o;if(Ga(r.transactionBlock))r.transactionBlock.setSenderIfNotSet(r.sender),o=(0,wn.toBase64)(await r.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof r.transactionBlock=="string")o=r.transactionBlock;else if(r.transactionBlock instanceof Uint8Array)o=(0,wn.toBase64)(r.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[r.sender,o,r.gasPrice?.toString(),r.epoch]})}async dryRunTransactionBlock(r){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof r.transactionBlock=="string"?r.transactionBlock:(0,wn.toBase64)(r.transactionBlock)]})}async getDynamicFields(r){if(!r.parentId||!ss(Jt(r.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[r.parentId,r.cursor,r.limit]})}async getDynamicFieldObject(r){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[r.parentId,r.name]})}async getLatestCheckpointSequenceNumber(){let r=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(r)}async getCheckpoint(r){return await this.transport.request({method:"sui_getCheckpoint",params:[r.id]})}async getCheckpoints(r){return await this.transport.request({method:"sui_getCheckpoints",params:[r.cursor,r?.limit,r.descendingOrder]})}async getCommitteeInfo(r){return await this.transport.request({method:"suix_getCommitteeInfo",params:[r?.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(r){return await this.transport.request({method:"suix_getEpochMetrics",params:[r?.cursor,r?.limit,r?.descendingOrder]})}async getAllEpochAddressMetrics(r){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[r?.descendingOrder]})}async getEpochs(r){return await this.transport.request({method:"suix_getEpochs",params:[r?.cursor,r?.limit,r?.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){let r=await this.getCheckpoint({id:"0"}),o=(0,wn.fromBase58)(r.digest);return(0,wn.toHex)(o.slice(0,4))}async resolveNameServiceAddress(r){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[r.name]})}async resolveNameServiceNames({format:r="dot",...o}){let{nextCursor:s,hasNextPage:i,data:a}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[o.address,o.cursor,o.limit]});return{hasNextPage:i,nextCursor:s,data:a.map(c=>Jf(c,r))}}async getProtocolConfig(r){return await this.transport.request({method:"sui_getProtocolConfig",params:[r?.version]})}async waitForTransaction({signal:r,timeout:o=60*1e3,pollInterval:s=2*1e3,...i}){let a=AbortSignal.timeout(o),c=new Promise((u,l)=>{a.addEventListener("abort",()=>l(a.reason))});for(c.catch(()=>{});!a.aborted;){r?.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(l=>setTimeout(l,s)),c])}}throw a.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}};var Xa=require("big.js");var ud=ye(Gn());var Bn=ye(Gn());wt();function Tm(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::swap`,typeArguments:r,arguments:[ce(n,o.bridge),ce(n,o.coin),br(n,o.receiveAmountMin,"u64")]})}function Pm(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::deposit`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit),ce(n,o.coin)]})}function wm(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::withdraw`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit),br(n,o.amountLp,"u64")]})}function Cm(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::claim_reward`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit)]})}function Bm(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::pool`,typeArguments:[r],arguments:[ce(n,o)]})}function td(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::swap_and_bridge_wormhole`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.messenger),ce(n,o.wormholeState),ce(n,o.theClock),ce(n,o.gasOracle),ce(n,o.amount),ce(n,o.recipient),br(n,o.destinationChainId,"u8"),ce(n,o.receiveToken),br(n,o.nonce,"u256"),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin)]})}function Wm(n,r){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::new_user_deposit`,typeArguments:[r],arguments:[]})}function rd(n,r,o){return n.moveCall({target:`${Bn.PUBLISHED_AT}::bridge_interface::swap_and_bridge`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.messenger),ce(n,o.gasOracle),ce(n,o.amount),ce(n,o.recipient),br(n,o.destinationChainId,"u8"),ce(n,o.receiveToken),br(n,o.nonce,"u256"),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin)]})}var Fm=ye(od());var vm=ye(od());wt();function sd(n,r,o){return n.moveCall({target:`${vm.PUBLISHED_AT}::cctp_bridge_interface::bridge`,typeArguments:[r],arguments:[ce(n,o.cctpBridge),ce(n,o.gasOracle),ce(n,o.tokenMessengerMinterState),ce(n,o.messageTransmitterState),ce(n,o.treasury),ce(n,o.denyList),ce(n,o.amount),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin),br(n,o.destinationChainId,"u8"),ce(n,o.recipient),ce(n,o.recipientWalletAddress)]})}var km=ye(ad());var Rm=ye(ad());Pt();wt();Pt();wt();var cd=class n{__VectorClass=!0;static $typeName="vector";static $numTypeParams=1;static $isPhantom=[!1];$typeName="vector";$fullTypeName;$typeArgs;$isPhantom=[!1];elements;constructor(r,o){this.$fullTypeName=ve(this.$typeName,...r),this.$typeArgs=r,this.elements=o}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs(hi(r)),fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),new:o=>new n([ue(r)],o),kind:"VectorClassReified"}}static get r(){return n.reified}static get bcs(){return R.vector}static fromFields(r,o){return n.reified(r).new(o.map(s=>Pe(r,s)))}static fromFieldsWithTypes(r,o){return n.reified(r).new(o.map(s=>ge(r,s)))}static fromBcs(r,o){return n.fromFields(r,n.bcs(hi(r)).parse(o))}toJSONField(){return this.elements.map(r=>Bo(this.$typeArgs[0],r))}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,elements:this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new(o.map(s=>he(r,s)))}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a vector json object");return n.fromJSONField(r,o.elements)}};function us(n){return cd.r(n)}function qe(n){return typeof n=="string"?{phantomType:n,kind:"PhantomReified"}:{phantomType:n.fullTypeName,kind:"PhantomReified"}}var $T=R.bytes(32).transform({input:n=>(0,Be.fromHEX)(n),output:n=>(0,Be.toHEX)(n)});function hi(n){switch(n){case"bool":return R.bool();case"u8":return R.u8();case"u16":return R.u16();case"u32":return R.u32();case"u64":return R.u64();case"u128":return R.u128();case"u256":return R.u256();case"address":return $T;default:return n.bcs}}function ue(n){switch(n){case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":case"bool":case"address":return n}switch(n.kind){case"PhantomReified":return n.phantomType;case"StructClassReified":return n.fullTypeName;case"VectorClassReified":return n.fullTypeName}throw new Error("unreachable")}function Pe(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return`0x${r}`}if(n.kind==="VectorClassReified")return n.fromFields(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":return new TextDecoder().decode(Uint8Array.from(r.bytes)).toString();case"0x2::url::Url":return new TextDecoder().decode(Uint8Array.from(r.url.bytes)).toString();case"0x2::object::ID":return`0x${r.bytes}`;case"0x2::object::UID":return`0x${r.id.bytes}`;case"0x1::option::Option":return r.vec.length===0?null:n.fromFields(r).vec[0];default:return n.fromFields(r)}}function ge(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return r}if(n.kind==="VectorClassReified")return n.fromFieldsWithTypes(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":return r;case"0x2::object::UID":return r.id;case"0x2::balance::Balance":return n.fromFields({value:BigInt(r)});case"0x1::option::Option":return r===null?null:ge(n.reifiedTypeArgs[0],r);default:return n.fromFieldsWithTypes(r)}}function _r(n,r,o){if(o.length!==r.length)throw new Error(`provided item has mismatching number of type argments ${n} (expected ${o.length}, got ${r.length}))`);for(let s=0;s<r.length;s++)if(ne(r[s])!==ne(ue(o[s])))throw new Error(`provided item has mismatching type argments ${n} (expected ${ue(o[s])}, got ${r[s]}))`)}function tn(n,r){let{typeArgs:o}=kt(n.type);_r(n.type,o,r)}function Bo(n,r){let{typeName:o,typeArgs:s}=kt(n);switch(o){case"bool":return r;case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return r.toString();case"address":case"signer":return r;case"vector":return r.map(i=>Bo(s[0],i));case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":case"0x2::object::UID":return r;case"0x1::option::Option":return r===null?null:Bo(s[0],r);default:return r.toJSONField()}}function he(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return r}if(n.kind==="VectorClassReified")return n.fromJSONField(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":case"0x2::object::UID":return r;case"0x1::option::Option":return r===null?null:he(n.reifiedTypeArgs[0],r);default:return n.fromJSONField(r)}}wt();var $a="0x1";wt();Pt();function Za(n){return n=ne(n),n===`${$a}::string::String`}var Ja=class n{__StructClass=!0;static get $typeName(){return`${$a}::string::String`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;bytes;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.bytes=o.bytes}static reified(){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("String",{bytes:R.vector(R.u8())})}static fromFields(r){return n.reified().new({bytes:Pe(us("u8"),r.bytes)})}static fromFieldsWithTypes(r){if(!Za(r.type))throw new Error("not a String type");return n.reified().new({bytes:ge(us("u8"),r.fields.bytes)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{bytes:Bo("vector<u8>",this.bytes)}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({bytes:he(us("u8"),r.bytes)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!Za(r.type))throw new Error(`object at ${r.fields.id} is not a String object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!Za(r.bcs.type))throw new Error("object at is not a String object");return n.fromBcs((0,Be.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching String object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!Za(s.data.bcs.type))throw new Error(`object at id ${o} is not a String object`);return n.fromSuiObjectData(s.data)}};wt();wt();var Ln="0x2";Pt();function Ha(n){return n=ne(n),n===`${Ln}::object::ID`}var Wo=class n{__StructClass=!0;static get $typeName(){return`${Ln}::object::ID`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;bytes;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.bytes=o.bytes}static reified(){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("ID",{bytes:R.bytes(32).transform({input:r=>(0,Be.fromHEX)(r),output:r=>(0,Be.toHEX)(r)})})}static fromFields(r){return n.reified().new({bytes:Pe("address",r.bytes)})}static fromFieldsWithTypes(r){if(!Ha(r.type))throw new Error("not a ID type");return n.reified().new({bytes:ge("address",r.fields.bytes)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{bytes:this.bytes}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({bytes:he("address",r.bytes)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!Ha(r.type))throw new Error(`object at ${r.fields.id} is not a ID object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!Ha(r.bcs.type))throw new Error("object at is not a ID object");return n.fromBcs((0,Be.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching ID object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!Ha(s.data.bcs.type))throw new Error(`object at id ${o} is not a ID object`);return n.fromSuiObjectData(s.data)}};function Ka(n){return n=ne(n),n===`${Ln}::object::UID`}var Tr=class n{__StructClass=!0;static get $typeName(){return`${Ln}::object::UID`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.id=o.id}static reified(){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("UID",{id:Wo.bcs})}static fromFields(r){return n.reified().new({id:Pe(Wo.reified(),r.id)})}static fromFieldsWithTypes(r){if(!Ka(r.type))throw new Error("not a UID type");return n.reified().new({id:ge(Wo.reified(),r.fields.id)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{id:this.id}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({id:he(Wo.reified(),r.id)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!Ka(r.type))throw new Error(`object at ${r.fields.id} is not a UID object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!Ka(r.bcs.type))throw new Error("object at is not a UID object");return n.fromBcs((0,Be.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching UID object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!Ka(s.data.bcs.type))throw new Error(`object at id ${o} is not a UID object`);return n.fromSuiObjectData(s.data)}};function jr(n,r){return n.moveCall({target:`${Rm.PUBLISHED_AT}::bytes32::from_hex`,arguments:[br(n,r,`${Ja.$typeName}`)]})}async function rn(n,r,o=[]){let s=await n(r),i=o.concat(s.data);return s.hasNextPage&&s.nextCursor?rn(n,s.nextCursor,i):i}var Ya=class extends ir{constructor(o,s){super();this.nodeRpcUrlsConfig=o;this.api=s;this.client=new Cn({url:o.getNodeRpcUrl(this.chainSymbol)})}chainType="SUI";chainSymbol="SUI";client;send(){throw new _("Method send not implemented.")}async buildRawTransactionSwap(o){let s=o.sourceToken.suiAddresses;if(!s)throw new _("SUI token must contain 'suiAddresses'");(0,ud.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin);let i=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(i,s)}async buildRawTransactionSwapFromParams(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toTokenAddress:u,minimumReceiveAmount:l}=o,p=new Ur;p.setSender(a);let A={bridge:s.bridgeObjectAddress,coin:$e({balance:BigInt(i),type:c}),receiveAmountMin:BigInt(l)},g=Tm(p,[c,u],A),P=await rn(b=>this.client.getCoins({owner:o.toAccountAddress,coinType:u,cursor:b}));return P.length===0||!P[0]?p.transferObjects([g],o.toAccountAddress):p.mergeCoins(P[0].coinObjectId,[g]),await p.toJSON({client:this.client})}async buildRawTransactionSend(o){let s=await Rr(this.chainType,o,this.api),{messenger:i}=s,a=o.sourceToken.suiAddresses;if(!a)throw new _("SUI token must contain 'suiAddresses'");switch((0,ud.setAddress)(a.bridgeAddress,a.bridgeAddressOrigin),(0,km.setAddress)(a.utilsAddress),i){case 1:return this.buildRawTransactionAllbridgeSend(s,a);case 2:return this.buildRawTransactionWormholeSend(s,a);case 3:case 4:return this.buildRawTransactionCctpSend(o,s,a)}}async buildRawTransactionAllbridgeSend(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,Xa.Big)(b).plus(P).toFixed());let W=new Ur;if(W.setSender(a),g==="stablecoin"){let S=BigInt(i)-BigInt(b),F={bridge:s.bridgeObjectAddress,messenger:s.allbridgeMessengerObjectAddress,amount:$e({balance:S,type:c}),destinationChainId:u,nonce:qr(),recipient:jr(W,Mr(l)),receiveToken:jr(W,Mr(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(b),type:c}),feeSuiCoin:$e({balance:BigInt(0),useGasCoin:!1})};rd(W,c,F)}else{let S=b==="0"?$e({balance:BigInt(b),useGasCoin:!1}):$e({balance:BigInt(b)}),F={bridge:s.bridgeObjectAddress,messenger:s.allbridgeMessengerObjectAddress,amount:$e({balance:BigInt(i),type:c}),destinationChainId:u,nonce:qr(),recipient:jr(W,Mr(l)),receiveToken:jr(W,Mr(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(0),type:c}),feeSuiCoin:S};rd(W,c,F)}return await W.toJSON({client:this.client})}async buildRawTransactionWormholeSend(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,Xa.Big)(b).plus(P).toFixed());let W=new Ur;if(W.setSender(a),g==="stablecoin"){let S=BigInt(i)-BigInt(b),F={bridge:s.bridgeObjectAddress,messenger:s.wormholeMessengerObjectAddress,wormholeState:s.wormholeStateObjectAddress,theClock:_a,amount:$e({balance:S,type:c}),destinationChainId:u,nonce:qr(),recipient:jr(W,Mr(l)),receiveToken:jr(W,Mr(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(b),type:c}),feeSuiCoin:$e({balance:BigInt(0),useGasCoin:!1})};td(W,c,F)}else{let S=b==="0"?$e({balance:BigInt(b),useGasCoin:!1}):$e({balance:BigInt(b)}),F={bridge:s.bridgeObjectAddress,messenger:s.wormholeMessengerObjectAddress,wormholeState:s.wormholeStateObjectAddress,theClock:_a,amount:$e({balance:BigInt(i),type:c}),destinationChainId:u,nonce:qr(),recipient:jr(W,Mr(l)),receiveToken:jr(W,Mr(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(0),type:c}),feeSuiCoin:S};td(W,c,F)}return await W.toJSON({client:this.client})}async buildRawTransactionCctpSend(o,s,i){let{amount:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=s;(0,Fm.setAddress)(i.cctpAddress,i.cctpAddressOrigin);let b=A;P&&(b=(0,Xa.Big)(b).plus(P).toFixed());let W=new Ur;W.setSender(c);let S=jr(W,Mr(p)),F;if(o.destinationToken.chainType==="SOLANA"){let U=await Pa(this.chainType,o.toAccountAddress,o.destinationToken.tokenAddress,this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"));F=jr(W,Mr(U))}else F=S;if(g==="stablecoin"){let U=BigInt(a)-BigInt(b),V={cctpBridge:i.cctpObjectAddress,tokenMessengerMinterState:i.cctpTokenMessengerMinterStateObjectAddress,messageTransmitterState:i.cctpMessageTransmitterStateObjectAddress,treasury:i.cctpTreasuryObjectAddress,denyList:i.cctpDenyListObjectAddress,amount:$e({balance:U,type:u}),destinationChainId:l,recipient:F,recipientWalletAddress:S,gasOracle:i.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(b),type:u}),feeSuiCoin:$e({balance:BigInt(0),useGasCoin:!1})};sd(W,u,V)}else{let U=b==="0"?$e({balance:BigInt(b),useGasCoin:!1}):$e({balance:BigInt(b)}),V={cctpBridge:i.cctpObjectAddress,tokenMessengerMinterState:i.cctpTokenMessengerMinterStateObjectAddress,messageTransmitterState:i.cctpMessageTransmitterStateObjectAddress,treasury:i.cctpTreasuryObjectAddress,denyList:i.cctpDenyListObjectAddress,amount:$e({balance:BigInt(a),type:u}),destinationChainId:l,recipient:F,recipientWalletAddress:S,gasOracle:i.gasOracleObjectAddress,feeTokenCoin:$e({balance:BigInt(0),type:u}),feeSuiCoin:U};sd(W,u,V)}return await W.toJSON({client:this.client})}};var xm=require("big.js");var Om=ye(require("bn.js"));function qa(n){return"0x"+new Om.default(n).toString("hex")}function Em(n){return new Promise(r=>setTimeout(()=>r(),n))}async function Qa(n,r){let o=await n.trx.sign(r);if(!o.signature)throw new Zn("Transaction was not signed properly");let i=(await n.trx.sendRawTransaction(o)).transaction.txID;return await ZT(n,i),{txId:i}}async function ZT(n,r,o=1e4){let s=Date.now();for(;;){if(Date.now()-s>o)throw new Ro("Transaction not found");let i=await n.trx.getUnconfirmedTransactionInfo(r);if(!i?.receipt){await Em(2e3);continue}if(i.receipt.result==="SUCCESS")return i;throw new Ro(`Transaction status is ${i.receipt.result}`)}}var yi=class extends ir{constructor(o,s){super();this.tronWeb=o;this.api=s}chainType="TRX";async send(o){let s=await Rr(this.chainType,o,this.api),i=await this.buildRawTransactionSendFromParams(s);return await Qa(this.tronWeb,i)}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o,A=[{type:"uint256",value:s},{type:"bytes32",value:c},{type:"bytes32",value:l},{type:"address",value:u},{type:"uint256",value:p}];return this.buildRawTransaction(i,"swap(uint256,bytes32,bytes32,address,uint256)",A,"0",a)}async buildRawTransactionSend(o){let s=await Rr(this.chainType,o,this.api);return this.buildRawTransactionSendFromParams(s)}async buildRawTransactionSendFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,messenger:A,fee:g,gasFeePaymentMethod:P,extraGas:b}=o,W=g;b&&(W=(0,xm.Big)(W).plus(b).toFixed());let S=qr().toString(),F,U,V;return A==3||A==4?(P==="stablecoin"?(F=[{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"uint256",value:W}],U="0"):(F=[{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"uint256",value:0}],U=W),V="bridge(uint256,bytes32,uint256,uint256)"):(P==="stablecoin"?(F=[{type:"bytes32",value:c},{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"bytes32",value:p},{type:"uint256",value:S},{type:"uint8",value:A},{type:"uint256",value:W}],U="0"):(F=[{type:"bytes32",value:c},{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"bytes32",value:p},{type:"uint256",value:S},{type:"uint8",value:A},{type:"uint256",value:0}],U=W),V="swapAndBridge(bytes32,uint256,bytes32,uint256,bytes32,uint256,uint8,uint256)"),this.buildRawTransaction(i,V,F,U,a)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new _("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}};var ec=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i;this.rawTxBuilder=new wa(r,o,s,i)}rawTxBuilder;async getAllowance(r,o){let s,i;o?(s=r,i=o):i=r;let a=ei(i.token,i.messenger);return await this.tokenService.getAllowance({...i,spender:a},s)}async checkAllowance(r,o){let s,i;o?(s=r,i=o):i=r;let a=ei(i.token,i.messenger);return this.tokenService.checkAllowance({...i,spender:a},s)}async approve(r,o){let s=ei(o.token,o.messenger);return this.tokenService.approve(r,{...o,spender:s})}async send(r,o){return je(o.amount),Le("amount",o.amount,o.sourceToken.decimals),(await Ca(o.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,r)).send(o)}};function ei(n,r){if(r&&r==3){if(n.cctpAddress)return n.cctpAddress;throw new Ct("Such route does not support CCTP protocol")}else if(r&&r==4){if(n.cctpV2Address)return n.cctpV2Address;throw new Ct("Such route does not support CCTP V2 protocol")}else return n.bridgeAddress}async function Ca(n,r,o,s,i){switch(Me.getChainProperty(n).chainType){case"EVM":{if(i)return new Qs(i,r,o);{let a=o.getNodeRpcUrl(n);return new Qs(new Dm.Web3(a),r,o)}}case"TRX":if(i){let a=await vr();return new yi(i,r)}else{let a=o.getNodeRpcUrl(n);return new yi(new(await vr())({fullHost:a,solidityNode:a,eventServer:a}),r)}case"SOLANA":return new Sa(o.getNodeRpcUrl("SOL"),{wormholeMessengerProgramId:s.wormholeMessengerProgramId,solanaLookUpTable:s.solanaLookUpTable,cctpParams:s.cctpParams,jupiterParams:{jupiterUrl:s.jupiterUrl,jupiterApiKeyHeader:s.jupiterApiKeyHeader,jupiterMaxAccounts:s.jupiterMaxAccounts}},r);case"SRB":return new Ia(o,s,r);case"SUI":return new Ya(o,r)}}var Gm=require("big.js");var ms=require("web3");var nn=require("big.js");function Nm(n,r,o,s,i){let a=Ee(n,3),c=(0,nn.Big)(a),u=(0,nn.Big)(o),l=(0,nn.Big)(s).plus(i),p,A;if(u.eq(0)||l.eq(0)){let P=c.div(2);p=(0,nn.Big)(s).plus(P),A=(0,nn.Big)(i).plus(P)}else p=(0,nn.Big)(s).plus(c.mul(s).div(l)),A=(0,nn.Big)(i).plus(c.mul(i).div(l));return(0,nn.Big)(Sd(r,p.toFixed(),A.toFixed())).minus(u).toFixed()}function Um(n){let r=Ee(n,3);return(0,nn.Big)(r).round().toFixed()}var Wn=require("web3");var JT={abi:[{inputs:[{internalType:"address",name:"_router",type:"address"},{internalType:"uint256",name:"_a",type:"uint256"},{internalType:"contract ERC20",name:"_token",type:"address"},{internalType:"uint16",name:"_feeShareBP",type:"uint16"},{internalType:"uint256",name:"_balanceRatioMinBP",type:"uint256"},{internalType:"string",name:"lpName",type:"string"},{internalType:"string",name:"lpSymbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"vUsdAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SwappedFromVUsd",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vUsdAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SwappedToVUsd",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdraw",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"a",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"accRewardPerShareP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"adjustTotalLpAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"adminFeeAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"adminFeeShareBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"balanceRatioMinBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"canDeposit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"canWithdraw",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"claimAdminFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"d",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"feeShareBP",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"getY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"reserves",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"router",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_adminFeeShareBP",type:"uint256"}],name:"setAdminFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_balanceRatioMinBP",type:"uint256"}],name:"setBalanceRatioMinBP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"_feeShareBP",type:"uint16"}],name:"setFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_router",type:"address"}],name:"setRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_stopAuthority",type:"address"}],name:"setStopAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"},{internalType:"bool",name:"zeroFee",type:"bool"}],name:"swapFromVUsd",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"zeroFee",type:"bool"}],name:"swapToVUsd",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract ERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"userRewardDebt",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"vUsdBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLp",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},ls=JT;var jt=class{lpAmount;rewardDebt;constructor(r){this.lpAmount=r.lpAmount,this.rewardDebt=r.rewardDebt}get userLiquidity(){return we(this.lpAmount,3).toFixed()}earned(r,o){let s=Bd(this.lpAmount,this.rewardDebt,r.accRewardPerShareP,r.p);return o?we(s,o).toFixed():s}};var dr=class{};var bi=class extends dr{constructor(o,s){super();this.web3=o;this.api=s}chainType="EVM";P=52;async getUserBalanceInfo(o,s){let i;try{i=await ga(this.getUserBalanceInfoByBatch(o,s),`Cannot get UserBalanceInfo for ${s.name} on ${s.chainSymbol}`,5e3)}catch{i=await Ku(()=>this.getUserBalanceInfoPerProperty(o,s),`Cannot get UserBalanceInfo for ${s.name} on ${s.chainSymbol}`,5,2e3)}return i}async getPoolInfoFromChain(o){let s;try{s=await ga(this.getPoolInfoByBatch(o),`Cannot get PoolInfo for ${o.name} on ${o.chainSymbol}`,5e3)}catch{s=await Ku(()=>this.getPoolInfoPerProperty(o),`Cannot get PoolInfo for ${o.name} on ${o.chainSymbol}`,5,2e3)}return s}async getUserBalanceInfoByBatch(o,s){let i=new this.web3.eth.BatchRequest,a=this.getPoolContract(s.poolAddress),c=a.methods.userRewardDebt(o).encodeABI(),u=a.methods.balanceOf(o).encodeABI();i.add({method:"eth_call",params:[{to:s.poolAddress,data:c},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:u},"latest"]});let[l,p]=await i.execute();if(l&&p&&!l.error&&!p.error)return new jt({lpAmount:Wn.Web3.utils.toBigInt(p.result).toString(),rewardDebt:Wn.Web3.utils.toBigInt(l.result).toString()});throw new Error("Batched failed")}async getUserBalanceInfoPerProperty(o,s){let i=(await this.getPoolContract(s.poolAddress).methods.userRewardDebt(o).call()).toString(),a=(await this.getPoolContract(s.poolAddress).methods.balanceOf(o).call()).toString();return new jt({lpAmount:a,rewardDebt:i})}async getPoolInfoByBatch(o){let s=new this.web3.eth.BatchRequest,i=this.getPoolContract(o.poolAddress),a=i.methods.a().encodeABI(),c=i.methods.d().encodeABI(),u=i.methods.tokenBalance().encodeABI(),l=i.methods.vUsdBalance().encodeABI(),p=i.methods.totalSupply().encodeABI(),A=i.methods.accRewardPerShareP().encodeABI();s.add({method:"eth_call",params:[{to:o.poolAddress,data:a},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:c},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:u},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:l},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:p},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:A},"latest"]});let[g,P,b,W,S,F]=await s.execute();if(g&&P&&b&&W&&S&&F&&!g.error&&!P.error&&!b.error&&!W.error&&!S.error&&!F.error){let U=Wn.Web3.utils.toBigInt(b.result).toString(),V=Wn.Web3.utils.toBigInt(W.result).toString(),L=xt({tokenBalance:U,vUsdBalance:V});return{aValue:Wn.Web3.utils.toBigInt(g.result).toString(),dValue:Wn.Web3.utils.toBigInt(P.result).toString(),tokenBalance:U,vUsdBalance:V,totalLpAmount:Wn.Web3.utils.toBigInt(S.result).toString(),accRewardPerShareP:Wn.Web3.utils.toBigInt(F.result).toString(),p:this.P,imbalance:L}}throw new Error("Batched failed")}async getPoolInfoPerProperty(o){let s=this.getPoolContract(o.poolAddress),i=(await s.methods.a().call()).toString(),a=(await s.methods.d().call()).toString(),c=(await s.methods.tokenBalance().call()).toString(),u=(await s.methods.vUsdBalance().call()).toString(),l=(await s.methods.totalSupply().call()).toString(),p=(await s.methods.accRewardPerShareP().call()).toString(),A=xt({tokenBalance:c,vUsdBalance:u});return{aValue:i,dValue:a,tokenBalance:c,vUsdBalance:u,totalLpAmount:l,accRewardPerShareP:p,p:this.P,imbalance:A}}async buildRawTransactionDeposit(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.deposit(o.amount).encodeABI()})}async buildRawTransactionWithdraw(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.withdraw(o.amount).encodeABI()})}async buildRawTransactionClaimRewards(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.claimRewards().encodeABI()})}buildTxParams(o){return{from:o.accountAddress,to:o.token.poolAddress,value:"0"}}getPoolContract(o){return new this.web3.eth.Contract(ls.abi,o)}};var tc=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i}async approve(r,o){if(o){let s=r,i=o;return this.tokenService.buildRawTransactionApprove({...i,spender:i.token.poolAddress},s)}else{let s=r;return this.tokenService.buildRawTransactionApprove({...s,spender:s.token.poolAddress})}}async deposit(r,o){return je(r.amount),Le("amount",r.amount,r.token.decimals),r.amount=Ee(r.amount,r.token.decimals).toFixed(),(await ds(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionDeposit(r)}async withdraw(r,o){return je(r.amount),Le("amount",r.amount,r.token.decimals),r.amount=Ee(r.amount,3).toFixed(),(await ds(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionWithdraw(r)}async claimRewards(r,o){return(await ds(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionClaimRewards(r)}};var Vr=require("@project-serum/anchor"),zr=require("@solana/web3.js");var rc=class extends dr{constructor(o,s){super();this.solanaRpcUrl=o;this.api=s}chainType="SOLANA";P=48;async getUserBalanceInfo(o,s){let i=this.buildAnchorProvider(o),a=this.getBridge(s.bridgeAddress,i),c=new zr.PublicKey(s.poolAddress),u=await a.account.pool.fetch(c);try{let l=await qu(new zr.PublicKey(o),u.mint,a.programId),{lpAmount:p,rewardDebt:A}=await a.account.userDeposit.fetch(l);return new jt({lpAmount:p.toString(),rewardDebt:A.toString()})}catch{return new jt({lpAmount:"0",rewardDebt:"0"})}}async getPoolInfoFromChain(o){let s=this.buildAnchorProvider(o.bridgeAddress),i=await this.getBridge(o.bridgeAddress,s).account.pool.fetch(o.poolAddress),a=i.vUsdBalance.toString(),c=i.tokenBalance.toString(),u=xt({tokenBalance:c,vUsdBalance:a});return{dValue:i.d.toString(),aValue:i.a.toString(),totalLpAmount:i.totalLpAmount.toString(),vUsdBalance:a,tokenBalance:c,accRewardPerShareP:i.accRewardPerShareP.toString(),p:this.P,imbalance:u}}async buildRawTransactionDeposit(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.deposit(new Vr.BN(o.amount)).accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new zr.PublicKey(o.accountAddress),await es(c,o.txFeeParams,this.solanaRpcUrl),c}async buildRawTransactionWithdraw(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.withdraw(new Vr.BN(o.amount)).accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new zr.PublicKey(o.accountAddress),await es(c,o.txFeeParams,this.solanaRpcUrl),c}async buildRawTransactionClaimRewards(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.claimRewards().accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new zr.PublicKey(o.accountAddress),await es(c,o.txFeeParams,this.solanaRpcUrl),c}async prepareDataForTransaction(o){let s=this.buildAnchorProvider(o.accountAddress),i=this.getBridge(o.token.bridgeAddress,s),{accounts:a,preInstructions:c}=await this._getLPTransactionData(i,o.token.poolAddress,o.accountAddress,s);return{bridge:i,accounts:a,preInstructions:c}}getBridge(o,s){return new Vr.Program(ti,o,s)}buildAnchorProvider(o){let s=new zr.Connection(this.solanaRpcUrl,"confirmed"),i=new zr.PublicKey(o);return new Vr.AnchorProvider(s,{publicKey:i},{preflightCommitment:"confirmed",commitment:"confirmed"})}async _getLPTransactionData(o,s,i,a){let c=new zr.PublicKey(i),u=await xn(o.programId),l=await Yo(o.programId),p=new zr.PublicKey(s),g=(await o.account.pool.fetch(p)).mint,P=await Ir(c,g),b=await qo(g,o.programId),W=await qu(c,g,o.programId),S=[Vr.web3.ComputeBudgetProgram.setComputeUnitLimit({units:1e6})];try{await Qo(P,a)}catch{let L=await Vr.Spl.associatedToken(a).methods.create().accounts({mint:g,owner:c,associatedAccount:P}).instruction();S.push(L)}try{await o.account.userDeposit.fetch(W)}catch{let V=await o.methods.initDepositAccount().accounts({mint:g,user:c,userDeposit:W}).instruction();S.push(V)}return{accounts:{mint:g,user:c,config:u,pool:p,bridgeAuthority:l,userDeposit:W,userToken:P,bridgeToken:b},preInstructions:S}}};var xF=require("@stellar/stellar-sdk");var e=require("@stellar/stellar-sdk"),HT=e.contract.Spec,KT=e.contract.Client;var nc=class extends KT{constructor(o){super(new HT(["AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABwAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAZicmlkZ2UAAAAAABMAAAAAAAAAAWEAAAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAADGZlZV9zaGFyZV9icAAAAAoAAAAAAAAAFGJhbGFuY2VfcmF0aW9fbWluX2JwAAAACgAAAAAAAAASYWRtaW5fZmVlX3NoYXJlX2JwAAAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAHZGVwb3NpdAAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABmFtb3VudAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAId2l0aGRyYXcAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAACWFtb3VudF9scAAAAAAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc3dhcF90b192X3VzZAAAAAAAAAMAAAAAAAAABHVzZXIAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAAPc3dhcF9mcm9tX3ZfdXNkAAAAAAQAAAAAAAAABHVzZXIAAAATAAAAAAAAAAt2dXNkX2Ftb3VudAAAAAAKAAAAAAAAABJyZWNlaXZlX2Ftb3VudF9taW4AAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAANY2xhaW1fcmV3YXJkcwAAAAAAAAEAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAdgYWRtaW5gAAAAAA1zZXRfZmVlX3NoYXJlAAAAAAAAAQAAAAAAAAAMZmVlX3NoYXJlX2JwAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAWYWRqdXN0X3RvdGFsX2xwX2Ftb3VudAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAYc2V0X2JhbGFuY2VfcmF0aW9fbWluX2JwAAAAAQAAAAAAAAAUYmFsYW5jZV9yYXRpb19taW5fYnAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAMc3RvcF9kZXBvc2l0AAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAANc3RhcnRfZGVwb3NpdAAAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc3RvcF93aXRoZHJhdwAAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAOc3RhcnRfd2l0aGRyYXcAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAASc2V0X3N0b3BfYXV0aG9yaXR5AAAAAAABAAAAAAAAAA5zdG9wX2F1dGhvcml0eQAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAKc2V0X2JyaWRnZQAAAAAAAQAAAAAAAAAGYnJpZGdlAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAJbmV3X2FkbWluAAAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAATc2V0X2FkbWluX2ZlZV9zaGFyZQAAAAABAAAAAAAAABJhZG1pbl9mZWVfc2hhcmVfYnAAAAAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAPY2xhaW1fYWRtaW5fZmVlAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAZgdmlld2AAAAAAAA5wZW5kaW5nX3Jld2FyZAAAAAAAAQAAAAAAAAAEdXNlcgAAABMAAAABAAAD6QAAAAoAAAAD","AAAAAAAAAAAAAAAIZ2V0X3Bvb2wAAAAAAAAAAQAAA+kAAAfQAAAABFBvb2wAAAAD","AAAAAAAAAAAAAAAJZ2V0X2FkbWluAAAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAASZ2V0X3N0b3BfYXV0aG9yaXR5AAAAAAAAAAAAAQAAA+kAAAATAAAAAw==","AAAAAAAAAAAAAAAKZ2V0X2JyaWRnZQAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAQZ2V0X3VzZXJfZGVwb3NpdAAAAAEAAAAAAAAABHVzZXIAAAATAAAAAQAAA+kAAAfQAAAAC1VzZXJEZXBvc2l0AAAAAAM=","AAAAAAAAAAAAAAAHdXBncmFkZQAAAAABAAAAAAAAAA1uZXdfd2FzbV9oYXNoAAAAAAAD7gAAACAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAQAAAAAAAAAAAAAAD1N3YXBwZWRGcm9tVlVzZAAAAAAFAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAA2ZlZQAAAAAKAAAAAAAAAAlyZWNpcGllbnQAAAAAAAATAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAAC3Z1c2RfYW1vdW50AAAAAAo=","AAAAAQAAAAAAAAAAAAAADVN3YXBwZWRUb1ZVc2QAAAAAAAAFAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAA2ZlZQAAAAAKAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABXRva2VuAAAAAAAAEwAAAAAAAAALdnVzZF9hbW91bnQAAAAACg==","AAAAAQAAAAAAAAAAAAAAB0RlcG9zaXQAAAAAAgAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAR1c2VyAAAAEw==","AAAAAQAAAAAAAAAAAAAACFdpdGhkcmF3AAAAAgAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAR1c2VyAAAAEw==","AAAAAQAAAAAAAAAAAAAADlJld2FyZHNDbGFpbWVkAAAAAAACAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAABHVzZXIAAAAT","AAAAAQAAAAAAAAAAAAAABkJyaWRnZQAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAgAAAAAAAAAAAAAAB0RhdGFLZXkAAAAAAQAAAAEAAAAAAAAAC1VzZXJEZXBvc2l0AAAAAAEAAAAT","AAAAAQAAAAAAAAAAAAAABFBvb2wAAAAPAAAAAAAAAAFhAAAAAAAACgAAAAAAAAAWYWNjX3Jld2FyZF9wZXJfc2hhcmVfcAAAAAAACgAAAAAAAAAQYWRtaW5fZmVlX2Ftb3VudAAAAAoAAAAAAAAAEmFkbWluX2ZlZV9zaGFyZV9icAAAAAAACgAAAAAAAAAUYmFsYW5jZV9yYXRpb19taW5fYnAAAAAKAAAAAAAAAAtjYW5fZGVwb3NpdAAAAAABAAAAAAAAAAxjYW5fd2l0aGRyYXcAAAABAAAAAAAAAAFkAAAAAAAACgAAAAAAAAAIZGVjaW1hbHMAAAAEAAAAAAAAAAxmZWVfc2hhcmVfYnAAAAAKAAAAAAAAAAhyZXNlcnZlcwAAAAoAAAAAAAAABXRva2VuAAAAAAAAEwAAAAAAAAANdG9rZW5fYmFsYW5jZQAAAAAAAAoAAAAAAAAAD3RvdGFsX2xwX2Ftb3VudAAAAAAKAAAAAAAAAA12X3VzZF9iYWxhbmNlAAAAAAAACg==","AAAAAQAAAAAAAAAAAAAAC1VzZXJEZXBvc2l0AAAAAAIAAAAAAAAACWxwX2Ftb3VudAAAAAAAAAoAAAAAAAAAC3Jld2FyZF9kZWJ0AAAAAAo=","AAAAAQAAAAAAAAAAAAAABUFkbWluAAAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAQAAAAAAAAAAAAAAEEdhc09yYWNsZUFkZHJlc3MAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAAAQAAAAAAAAAAAAAACEdhc1VzYWdlAAAAAQAAAAAAAAABMAAAAAAAA+wAAAAEAAAACg==","AAAAAQAAAAAAAAAAAAAAC05hdGl2ZVRva2VuAAAAAAEAAAAAAAAAATAAAAAAAAAT","AAAAAQAAAAAAAAAAAAAADVN0b3BBdXRob3JpdHkAAAAAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAKAAAAAAAAAANVW5pbXBsZW1lbnRlZAAAAAAAAAAAAAAAAAAAC0luaXRpYWxpemVkAAAAAAEAAAAAAAAADVVuaW5pdGlhbGl6ZWQAAAAAAAACAAAAAAAAAAxVbmF1dGhvcml6ZWQAAAADAAAAAAAAAApJbnZhbGlkQXJnAAAAAAAEAAAAAAAAAA5JbnZhbGlkQ2hhaW5JZAAAAAAABQAAAAAAAAATSW52YWxpZE90aGVyQ2hhaW5JZAAAAAAGAAAAAAAAAA5HYXNVc2FnZU5vdFNldAAAAAAABwAAAAAAAAANQnJva2VuQWRkcmVzcwAAAAAAAAgAAAAAAAAACE5vdEZvdW5kAAAACQAAAAAAAAAYVG9rZW5JbnN1ZmZpY2llbnRCYWxhbmNlAAAACgAAAAAAAAAKQ2FzdEZhaWxlZAAAAAAACwAAAAAAAAAMVTI1Nk92ZXJmbG93AAAADAAAAAAAAAAKWmVyb0Ftb3VudAAAAAAAZwAAAAAAAAAMUG9vbE92ZXJmbG93AAAAaAAAAAAAAAALWmVyb0NoYW5nZXMAAAAAaQAAAAAAAAARUmVzZXJ2ZXNFeGhhdXN0ZWQAAAAAAABqAAAAAAAAABpJbnN1ZmZpY2llbnRSZWNlaXZlZEFtb3VudAAAAAAAawAAAAAAAAAUQmFsYW5jZVJhdGlvRXhjZWVkZWQAAABsAAAAAAAAAAlGb3JiaWRkZW4AAAAAAABtAAAAAAAAABlVbmF1dGhvcml6ZWRTdG9wQXV0aG9yaXR5AAAAAAAAywAAAAAAAAAOU3dhcFByb2hpYml0ZWQAAAAAAMwAAAAAAAAAEkFtb3VudFRvb0xvd0ZvckZlZQAAAAAAzQAAAAAAAAAWQnJpZGdlVG9UaGVaZXJvQWRkcmVzcwAAAAAAzgAAAAAAAAAORW1wdHlSZWNpcGllbnQAAAAAAM8AAAAAAAAAE1NvdXJjZU5vdFJlZ2lzdGVyZWQAAAAA0AAAAAAAAAAVV3JvbmdEZXN0aW5hdGlvbkNoYWluAAAAAAAA0QAAAAAAAAATVW5rbm93bkFub3RoZXJDaGFpbgAAAADSAAAAAAAAABFUb2tlbnNBbHJlYWR5U2VudAAAAAAAANMAAAAAAAAAEE1lc3NhZ2VQcm9jZXNzZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ"]),o);this.options=o}fromJSON={initialize:this.txFromJSON,deposit:this.txFromJSON,withdraw:this.txFromJSON,swap_to_v_usd:this.txFromJSON,swap_from_v_usd:this.txFromJSON,claim_rewards:this.txFromJSON,set_fee_share:this.txFromJSON,adjust_total_lp_amount:this.txFromJSON,set_balance_ratio_min_bp:this.txFromJSON,stop_deposit:this.txFromJSON,start_deposit:this.txFromJSON,stop_withdraw:this.txFromJSON,start_withdraw:this.txFromJSON,set_stop_authority:this.txFromJSON,set_bridge:this.txFromJSON,set_admin:this.txFromJSON,set_admin_fee_share:this.txFromJSON,claim_admin_fee:this.txFromJSON,pending_reward:this.txFromJSON,get_pool:this.txFromJSON,get_admin:this.txFromJSON,get_stop_authority:this.txFromJSON,get_bridge:this.txFromJSON,get_user_deposit:this.txFromJSON,upgrade:this.txFromJSON}};var ld=require("@stellar/stellar-sdk"),_m=ld.rpc.Api;function ps(n){let{simulation:r,options:o}=n;if(!r)throw new Error("Soroban assembled transaction does not have simulation");if(_m.isSimulationSuccess(r))return r.result==null?void 0:o.parseResultXdr(r.result.retval);throw new Error(r.error)}function As(n){let{simulation:r}=n;if(!r)throw new Error("Soroban assembled transaction does not have simulation");return _m.isSimulationError(r)}var oc=class extends dr{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";P=48;async getUserBalanceInfo(o,s){let a=await this.getContract(s.poolAddress).get_user_deposit({user:o});if(As(a))throw new _;let c=ps(a);if(!c)throw new _;let u=c.unwrap();return new jt({lpAmount:u.lp_amount.toString(),rewardDebt:u.reward_debt.toString()})}async getPoolInfoFromChain(o){let i=await this.getContract(o.poolAddress).get_pool();if(As(i))throw new _;let a=ps(i);if(!a)throw new _;let c=a.unwrap();return{aValue:c.a.toString(),accRewardPerShareP:c.acc_reward_per_share_p.toString(),dValue:c.d.toString(),tokenBalance:c.token_balance.toString(),p:this.P,totalLpAmount:c.total_lp_amount.toString(),vUsdBalance:c.v_usd_balance.toString(),imbalance:xt({tokenBalance:c.token_balance.toString(),vUsdBalance:c.v_usd_balance.toString()})}}async buildRawTransactionDeposit(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).deposit({sender:o.accountAddress,amount:BigInt(o.amount)})).toXDR()}async buildRawTransactionWithdraw(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).withdraw({sender:o.accountAddress,amount_lp:BigInt(o.amount)})).toXDR()}async buildRawTransactionClaimRewards(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).claim_rewards({sender:o.accountAddress})).toXDR()}getContract(o,s){let i={publicKey:s,contractId:o,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new nc(i)}};var fs=ye(Gn());wt();wt();Pt();function sc(n){return n=ne(n),n.startsWith(`${Ln}::balance::Balance<`)}var Ot=class n{__StructClass=!0;static get $typeName(){return`${Ln}::balance::Balance`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;value;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.value=o.value}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("Balance",{value:R.u64()})}static fromFields(r,o){return n.reified(r).new({value:Pe("u64",o.value)})}static fromFieldsWithTypes(r,o){if(!sc(o.type))throw new Error("not a Balance type");return tn(o,[r]),n.reified(r).new({value:ge("u64",o.fields.value)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{value:this.value.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({value:he("u64",o.value)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return _r(ve(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!sc(o.type))throw new Error(`object at ${o.fields.id} is not a Balance object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!sc(o.bcs.type))throw new Error("object at is not a Balance object");let s=kt(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,Be.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching Balance object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!sc(i.data.bcs.type))throw new Error(`object at id ${s} is not a Balance object`);return n.fromSuiObjectData(o,i.data)}};var Ad=ye(Gn());wt();var dd=ye(Gn());Pt();function ic(n){return n=ne(n),n.startsWith(`${dd.PKG_V1}::pool_rewards::PoolRewards<`)}var So=class n{__StructClass=!0;static get $typeName(){return`${dd.PKG_V1}::pool_rewards::PoolRewards`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;accRewardPerShareP;adminFeeShareBp;adminFee;rewards;lpSupply;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.accRewardPerShareP=o.accRewardPerShareP,this.adminFeeShareBp=o.adminFeeShareBp,this.adminFee=o.adminFee,this.rewards=o.rewards,this.lpSupply=o.lpSupply}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("PoolRewards",{acc_reward_per_share_p:R.u128(),admin_fee_share_bp:R.u64(),admin_fee:Ot.bcs,rewards:Ot.bcs,lp_supply:R.u64()})}static fromFields(r,o){return n.reified(r).new({accRewardPerShareP:Pe("u128",o.acc_reward_per_share_p),adminFeeShareBp:Pe("u64",o.admin_fee_share_bp),adminFee:Pe(Ot.reified(r),o.admin_fee),rewards:Pe(Ot.reified(r),o.rewards),lpSupply:Pe("u64",o.lp_supply)})}static fromFieldsWithTypes(r,o){if(!ic(o.type))throw new Error("not a PoolRewards type");return tn(o,[r]),n.reified(r).new({accRewardPerShareP:ge("u128",o.fields.acc_reward_per_share_p),adminFeeShareBp:ge("u64",o.fields.admin_fee_share_bp),adminFee:ge(Ot.reified(r),o.fields.admin_fee),rewards:ge(Ot.reified(r),o.fields.rewards),lpSupply:ge("u64",o.fields.lp_supply)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{accRewardPerShareP:this.accRewardPerShareP.toString(),adminFeeShareBp:this.adminFeeShareBp.toString(),adminFee:this.adminFee.toJSONField(),rewards:this.rewards.toJSONField(),lpSupply:this.lpSupply.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({accRewardPerShareP:he("u128",o.accRewardPerShareP),adminFeeShareBp:he("u64",o.adminFeeShareBp),adminFee:he(Ot.reified(r),o.adminFee),rewards:he(Ot.reified(r),o.rewards),lpSupply:he("u64",o.lpSupply)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return _r(ve(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!ic(o.type))throw new Error(`object at ${o.fields.id} is not a PoolRewards object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!ic(o.bcs.type))throw new Error("object at is not a PoolRewards object");let s=kt(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,Be.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching PoolRewards object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!ic(i.data.bcs.type))throw new Error(`object at id ${s} is not a PoolRewards object`);return n.fromSuiObjectData(o,i.data)}};wt();var pd=ye(Gn());Pt();function ac(n){return n=ne(n),n.startsWith(`${pd.PKG_V1}::pool_state::PoolState<`)}var vo=class n{__StructClass=!0;static get $typeName(){return`${pd.PKG_V1}::pool_state::PoolState`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;tokenBalance;vusdBalance;d;a;balanceRatioMinBp;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.tokenBalance=o.tokenBalance,this.vusdBalance=o.vusdBalance,this.d=o.d,this.a=o.a,this.balanceRatioMinBp=o.balanceRatioMinBp}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("PoolState",{token_balance:R.u64(),vusd_balance:R.u64(),d:R.u64(),a:R.u64(),balance_ratio_min_bp:R.u64()})}static fromFields(r,o){return n.reified(r).new({tokenBalance:Pe("u64",o.token_balance),vusdBalance:Pe("u64",o.vusd_balance),d:Pe("u64",o.d),a:Pe("u64",o.a),balanceRatioMinBp:Pe("u64",o.balance_ratio_min_bp)})}static fromFieldsWithTypes(r,o){if(!ac(o.type))throw new Error("not a PoolState type");return tn(o,[r]),n.reified(r).new({tokenBalance:ge("u64",o.fields.token_balance),vusdBalance:ge("u64",o.fields.vusd_balance),d:ge("u64",o.fields.d),a:ge("u64",o.fields.a),balanceRatioMinBp:ge("u64",o.fields.balance_ratio_min_bp)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{tokenBalance:this.tokenBalance.toString(),vusdBalance:this.vusdBalance.toString(),d:this.d.toString(),a:this.a.toString(),balanceRatioMinBp:this.balanceRatioMinBp.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({tokenBalance:he("u64",o.tokenBalance),vusdBalance:he("u64",o.vusdBalance),d:he("u64",o.d),a:he("u64",o.a),balanceRatioMinBp:he("u64",o.balanceRatioMinBp)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return _r(ve(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!ac(o.type))throw new Error(`object at ${o.fields.id} is not a PoolState object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!ac(o.bcs.type))throw new Error("object at is not a PoolState object");let s=kt(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,Be.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching PoolState object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!ac(i.data.bcs.type))throw new Error(`object at id ${s} is not a PoolState object`);return n.fromSuiObjectData(o,i.data)}};Pt();function cc(n){return n=ne(n),n.startsWith(`${Ad.PKG_V1}::pool::Pool<`)}var uc=class n{__StructClass=!0;static get $typeName(){return`${Ad.PKG_V1}::pool::Pool`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;state;rewards;feeShareBp;canDeposit;canWithdraw;decimals;balance;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.id=o.id,this.state=o.state,this.rewards=o.rewards,this.feeShareBp=o.feeShareBp,this.canDeposit=o.canDeposit,this.canWithdraw=o.canWithdraw,this.decimals=o.decimals,this.balance=o.balance}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("Pool",{id:Tr.bcs,state:vo.bcs,rewards:So.bcs,fee_share_bp:R.u64(),can_deposit:R.bool(),can_withdraw:R.bool(),decimals:R.u8(),balance:Ot.bcs})}static fromFields(r,o){return n.reified(r).new({id:Pe(Tr.reified(),o.id),state:Pe(vo.reified(r),o.state),rewards:Pe(So.reified(r),o.rewards),feeShareBp:Pe("u64",o.fee_share_bp),canDeposit:Pe("bool",o.can_deposit),canWithdraw:Pe("bool",o.can_withdraw),decimals:Pe("u8",o.decimals),balance:Pe(Ot.reified(r),o.balance)})}static fromFieldsWithTypes(r,o){if(!cc(o.type))throw new Error("not a Pool type");return tn(o,[r]),n.reified(r).new({id:ge(Tr.reified(),o.fields.id),state:ge(vo.reified(r),o.fields.state),rewards:ge(So.reified(r),o.fields.rewards),feeShareBp:ge("u64",o.fields.fee_share_bp),canDeposit:ge("bool",o.fields.can_deposit),canWithdraw:ge("bool",o.fields.can_withdraw),decimals:ge("u8",o.fields.decimals),balance:ge(Ot.reified(r),o.fields.balance)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{id:this.id,state:this.state.toJSONField(),rewards:this.rewards.toJSONField(),feeShareBp:this.feeShareBp.toString(),canDeposit:this.canDeposit,canWithdraw:this.canWithdraw,decimals:this.decimals,balance:this.balance.toJSONField()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({id:he(Tr.reified(),o.id),state:he(vo.reified(r),o.state),rewards:he(So.reified(r),o.rewards),feeShareBp:he("u64",o.feeShareBp),canDeposit:he("bool",o.canDeposit),canWithdraw:he("bool",o.canWithdraw),decimals:he("u8",o.decimals),balance:he(Ot.reified(r),o.balance)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return _r(ve(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!cc(o.type))throw new Error(`object at ${o.fields.id} is not a Pool object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!cc(o.bcs.type))throw new Error("object at is not a Pool object");let s=kt(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,Be.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching Pool object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!cc(i.data.bcs.type))throw new Error(`object at id ${s} is not a Pool object`);return n.fromSuiObjectData(o,i.data)}};wt();var fd=ye(Gn());Pt();function lc(n){return n=ne(n),n.startsWith(`${fd.PKG_V1}::user_deposit::UserDeposit<`)}var dc=class n{__StructClass=!0;static get $typeName(){return`${fd.PKG_V1}::user_deposit::UserDeposit`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;lpAmount;rewardDebt;constructor(r,o){this.$fullTypeName=ve(n.$typeName,...r),this.$typeArgs=r,this.id=o.id,this.lpAmount=o.lpAmount,this.rewardDebt=o.rewardDebt}static reified(r){return{typeName:n.$typeName,fullTypeName:ve(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("UserDeposit",{id:Tr.bcs,lp_amount:R.u64(),reward_debt:R.u64()})}static fromFields(r,o){return n.reified(r).new({id:Pe(Tr.reified(),o.id),lpAmount:Pe("u64",o.lp_amount),rewardDebt:Pe("u64",o.reward_debt)})}static fromFieldsWithTypes(r,o){if(!lc(o.type))throw new Error("not a UserDeposit type");return tn(o,[r]),n.reified(r).new({id:ge(Tr.reified(),o.fields.id),lpAmount:ge("u64",o.fields.lp_amount),rewardDebt:ge("u64",o.fields.reward_debt)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{id:this.id,lpAmount:this.lpAmount.toString(),rewardDebt:this.rewardDebt.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({id:he(Tr.reified(),o.id),lpAmount:he("u64",o.lpAmount),rewardDebt:he("u64",o.rewardDebt)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return _r(ve(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!lc(o.type))throw new Error(`object at ${o.fields.id} is not a UserDeposit object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!lc(o.bcs.type))throw new Error("object at is not a UserDeposit object");let s=kt(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,Be.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching UserDeposit object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!lc(i.data.bcs.type))throw new Error(`object at id ${s} is not a UserDeposit object`);return n.fromSuiObjectData(o,i.data)}};function zm(n,r,o){if(r.length===0||!r[0])return[];let s=r[0],i=n.reduce((u,l)=>u+BigInt(l),BigInt(0)),a=BigInt(s.balance),c=[];for(let u of r.slice(1)){if(a>i)return jm(o,s,c,n);a+=BigInt(u.balance),c.push(u)}return a>=i?jm(o,s,c,n):[]}function jm(n,r,o,s){let i=s.map(a=>n.pure.u64(a));return o.length>0&&n.mergeCoins(r.coinObjectId,o.map(a=>a.coinObjectId)),n.splitCoins(r.coinObjectId,i)}var XT="0x0000000000000000000000000000000000000000000000000000000000000000";async function Vm(n,r,o){let s=await n.devInspectTransactionBlock({sender:XT,transactionBlock:r});if(s.effects.status.status!=="success")throw new Error(`inspectionResult failed. ${JSON.stringify(s,null,2)}`);let i=s.results?.pop()?.returnValues?.pop();if(!i)throw new Error(`Something with inspectionResult went wrong. ${JSON.stringify(s,null,2)}`);let[a,c]=i;return typeof o=="object"?o.fromBcs(Uint8Array.from(a)).toJSONField():hi(o).parse(Uint8Array.from(a))}var pc=class extends dr{constructor(o,s){super();this.suiRpcUrl=o;this.api=s;this.client=new Cn({url:o})}chainType="SUI";client;async getUserBalanceInfo(o,s){if(!s.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let i=s.suiAddresses;if(!i)throw new _("SUI token must contain 'suiAddresses'");(0,fs.setAddress)(i.bridgeAddress,i.bridgeAddressOrigin);let c=(await this.fetchDeposits(o,s.originTokenAddress)).reduce((u,l)=>{if(l.data)return u.lpAmount+=BigInt(l.data.content.fields.lp_amount),u.rewardDebt+=BigInt(l.data.content.fields.reward_debt),u;throw new _("Deposits fetch failed")},{lpAmount:BigInt(0),rewardDebt:BigInt(0)});return new jt({lpAmount:c.lpAmount.toString(),rewardDebt:c.rewardDebt.toString()})}async fetchDeposits(o,s){return await rn(i=>this.client.getOwnedObjects({owner:o,filter:{StructType:dc.phantom(qe(s)).phantomType},options:{showContent:!0},cursor:i}))}async getPoolInfoFromChain(o){let s=o.suiAddresses;if(!s)throw new _("SUI token must contain 'suiAddresses'");if((0,fs.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let i=48,a=new Ur;Bm(a,o.originTokenAddress,s.bridgeObjectAddress);let c=await Vm(this.client,a,uc.reified(qe(o.originTokenAddress))),u=c.state.tokenBalance,l=c.state.vusdBalance,p=xt({tokenBalance:u,vUsdBalance:l});return{dValue:c.state.d,aValue:c.state.a,totalLpAmount:c.rewards.lpSupply,vUsdBalance:l,tokenBalance:u,accRewardPerShareP:c.rewards.accRewardPerShareP,p:i,imbalance:p}}async buildRawTransactionDeposit(o){let s=o.token.suiAddresses;if(!s)throw new _("SUI token must contain 'suiAddresses'");if((0,fs.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let i=await rn(g=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:g}));if(i.length===0||!i[0])throw new Gr("No coins to deposit");let a=i[0],c=new Ur;c.setSender(o.accountAddress);let{depositObj:u,isNewDeposit:l}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,c),[p]=zm([o.amount],i,c);if(!p)throw new Gr("No coins to deposit");if(!o.token.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let A=Pm(c,o.token.originTokenAddress,{bridge:s.bridgeObjectAddress,userDeposit:u,coin:p});return c.mergeCoins(a.coinObjectId,[A]),l&&c.transferObjects([u],o.accountAddress),await c.toJSON({client:this.client})}async getDepositObject(o,s,i){let a=await this.fetchDeposits(o,s);if(a.length===0||!a[0]){let c=qe(s).phantomType;return{depositObj:Wm(i,c),isNewDeposit:!0}}else{if(a[0].data?.objectId)return{depositObj:a[0].data.objectId,isNewDeposit:!1};throw new _("Something went wrong while deposit")}}async buildRawTransactionWithdraw(o){let s=o.token.suiAddresses;if(!s)throw new _("SUI token must contain 'suiAddresses'");if((0,fs.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let i=qe(o.token.originTokenAddress).phantomType,a=new Ur;a.setSender(o.accountAddress);let{depositObj:c,isNewDeposit:u}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,a);if(u)throw new Gr("No deposit found");let l=wm(a,i,{bridge:s.bridgeObjectAddress,userDeposit:c,amountLp:BigInt(o.amount)}),p=await rn(A=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:A}));if(!l[0]||!l[1])throw new _("No rewards found");return p[0]?a.mergeCoins(p[0].coinObjectId,[l[0],l[1]]):(a.mergeCoins(l[0],[l[1]]),a.transferObjects([l[0]],o.accountAddress)),await a.toJSON({client:this.client})}async buildRawTransactionClaimRewards(o){let s=o.token.suiAddresses;if(!s)throw new _("SUI token must contain 'suiAddresses'");if((0,fs.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");let i=qe(o.token.originTokenAddress).phantomType,a=new Ur;a.setSender(o.accountAddress);let{depositObj:c,isNewDeposit:u}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,a);if(u)throw new Gr("No deposit found");let l=Cm(a,i,{bridge:s.bridgeObjectAddress,userDeposit:c}),p=await rn(A=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:A}));return p[0]?a.mergeCoins(p[0].coinObjectId,[l]):a.transferObjects([l],o.accountAddress),await a.toJSON({client:this.client})}};var on=require("web3");var Ti=class extends dr{constructor(o,s,i){super();this.tronWeb=o;this.api=s;i&&(this.web3=new on.Web3(i))}chainType="TRX";P=52;web3;async getUserBalanceInfo(o,s){let i;if(this.web3)try{i=await this.getUserBalanceInfoByBatch(this.web3,o,s)}catch{i=await this.getUserBalanceInfoPerProperty(o,s)}else i=await this.getUserBalanceInfoPerProperty(o,s);return i}async getUserBalanceInfoByBatch(o,s,i){let a=new o.BatchRequest,c=new o.eth.Contract(ls.abi,await ya(i.poolAddress)),u=c.methods.userRewardDebt(s).encodeABI(),l=c.methods.balanceOf(s).encodeABI();a.add({method:"eth_call",params:[{to:i.poolAddress,data:u},"latest"]}),a.add({method:"eth_call",params:[{to:i.poolAddress,data:l},"latest"]});let[p,A]=await a.execute();if(p&&A&&!p.error&&!A.error)return new jt({lpAmount:on.Web3.utils.toBigInt(A.result).toString(),rewardDebt:on.Web3.utils.toBigInt(p.result).toString()});throw new Error("Batched failed")}async getUserBalanceInfoPerProperty(o,s){this.tronWeb.defaultAddress.base58||this.tronWeb.setAddress(o);let i=this.getContract(s.poolAddress),a=(await i.methods.userRewardDebt(o).call()).toString(),c=(await i.methods.balanceOf(o).call()).toString();return new jt({lpAmount:c,rewardDebt:a})}async getPoolInfoFromChain(o){let s;if(this.web3)try{s=await this.getPoolInfoByBatch(this.web3,o)}catch{s=await this.getPoolInfoPerProperty(o)}else s=await this.getPoolInfoPerProperty(o);return s}async getPoolInfoByBatch(o,s){let i=new o.BatchRequest,a=new o.eth.Contract(ls.abi,await ya(s.poolAddress),this.web3),c=a.methods.a().encodeABI(),u=a.methods.d().encodeABI(),l=a.methods.tokenBalance().encodeABI(),p=a.methods.vUsdBalance().encodeABI(),A=a.methods.totalSupply().encodeABI(),g=a.methods.accRewardPerShareP().encodeABI();i.add({method:"eth_call",params:[{to:s.poolAddress,data:c},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:u},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:l},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:p},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:A},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:g},"latest"]});let[P,b,W,S,F,U]=await i.execute();if(P&&b&&W&&S&&F&&U&&!P.error&&!b.error&&!W.error&&!S.error&&!F.error&&!U.error){let V=on.Web3.utils.toBigInt(W.result).toString(),L=on.Web3.utils.toBigInt(S.result).toString(),X=xt({tokenBalance:V,vUsdBalance:L});return{aValue:on.Web3.utils.toBigInt(P.result).toString(),dValue:on.Web3.utils.toBigInt(b.result).toString(),tokenBalance:V,vUsdBalance:L,totalLpAmount:on.Web3.utils.toBigInt(F.result).toString(),accRewardPerShareP:on.Web3.utils.toBigInt(U.result).toString(),p:this.P,imbalance:X}}throw new Error("Batched failed")}async getPoolInfoPerProperty(o){this.tronWeb.defaultAddress.base58||this.tronWeb.setAddress(o.poolAddress);let s=this.getContract(o.poolAddress),[i,a,c,u,l,p]=await Promise.all([s.methods.a().call(),s.methods.d().call(),s.methods.tokenBalance().call(),s.methods.vUsdBalance().call(),s.methods.totalSupply().call(),s.methods.accRewardPerShareP().call()]),A=c.toString(),g=u.toString(),P=xt({tokenBalance:A,vUsdBalance:g});return{aValue:i.toString(),dValue:a.toString(),tokenBalance:A,vUsdBalance:g,totalLpAmount:l.toString(),accRewardPerShareP:p.toString(),p:this.P,imbalance:P}}buildRawTransactionDeposit(o){let{amount:s,accountAddress:i}=o,a=[{type:"uint256",value:s}];return this.buildRawTransaction(o.token.poolAddress,"deposit(uint256)",a,"0",i)}buildRawTransactionWithdraw(o){let{amount:s,accountAddress:i}=o,a=[{type:"uint256",value:s}];return this.buildRawTransaction(o.token.poolAddress,"withdraw(uint256)",a,"0",i)}buildRawTransactionClaimRewards(o){let{accountAddress:s}=o,i=[];return this.buildRawTransaction(o.token.poolAddress,"claimRewards()",i,"0",s)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new _("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}getContract(o){return this.tronWeb.contract(ls.abi,o)}};var Ac=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i;this.rawTxBuilder=new tc(r,o,this.params,i);let a=s.cachePoolInfoChainSec>0?s.cachePoolInfoChainSec*1e3:20*1e3;this.cache=new sn({defaultTtl:a})}rawTxBuilder;cache;async getAllowance(r,o){if(o){let s=r,i=o;return await this.tokenService.getAllowance({...i,spender:i.token.poolAddress},s)}else{let s=r;return await this.tokenService.getAllowance({...s,spender:s.token.poolAddress})}}async checkAllowance(r,o){if(o){let s=r,i=o;return this.tokenService.checkAllowance({...i,spender:i.token.poolAddress},s)}else{let s=r;return this.tokenService.checkAllowance({...s,spender:s.token.poolAddress})}}async approve(r,o){return this.tokenService.approve(r,{...o,spender:o.token.poolAddress})}async getAmountToBeDeposited(r,o,s){je(r),Le("amount",r,o.decimals);let i=await this.getPoolInfoFromChain(o,s),{vUsdBalance:a,tokenBalance:c,aValue:u,dValue:l}=i,p=Nm(r,u,l,c,a);return we(p,3).toFixed()}async getAmountToBeWithdrawn(r,o,s,i){je(r),Le("amount",r,s.decimals);let a=await this.getPoolInfoFromChain(s,i),c=Um(r),u=qt(c,s.decimals),p=(await this.getUserBalanceInfo(o,s,i)).earned(a)||"0",A=(0,Gm.Big)(u).plus(p).toFixed();return we(A,s.decimals).toFixed()}async getUserBalanceInfo(r,o,s){return(await ds(o.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,s)).getUserBalanceInfo(r,o)}async getPoolInfoFromChain(r,o){let s={chainSymbol:r.chainSymbol,poolAddress:r.poolAddress},i=this.cache.get(s);if(i)return i;{let a=await(await ds(r.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).getPoolInfoFromChain(r);return this.cache.put(s,a),this.api.cachePut({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress},a),a}}};async function ds(n,r,o,s,i){switch(Me.getChainProperty(n).chainType){case"EVM":{if(i)return new bi(i,r);{let a=o.getNodeRpcUrl(n),c=new ms.Web3(a);return c.defaultReturnFormat={number:ms.FMT_NUMBER.STR,bytes:ms.FMT_BYTES.HEX},new bi(c,r)}}case"TRX":{let a=o.getNodeRpcUrl(n),c=s.tronJsonRpc;if(i){let u=await vr();return new Ti(i,r,c)}else{let u=new(await vr())({fullHost:a});return new Ti(u,r,c)}}case"SOLANA":{let a=o.getNodeRpcUrl(n);return new rc(a,r)}case"SRB":return new oc(o,s,r);case"SUI":return new pc(o.getNodeRpcUrl(n),r)}}var Qe=require("big.js");function Zm(n,r,o){let s=YT(n,{decimals:r.decimals,feeShare:r.feeShare},r.poolInfo),i=qT(s.amountIncludingCommissionInSystemPrecision,{decimals:o.decimals,feeShare:o.feeShare},o.poolInfo);return{swapToVUsdCalcResult:s,swapFromVUsdCalcResult:i}}function Jm(n,r,o){let s=QT(n,{decimals:o.decimals,feeShare:o.feeShare},o.poolInfo),i=eP(s.amountIncludingCommissionInSystemPrecision,{decimals:r.decimals,feeShare:r.feeShare},r.poolInfo);return{swapToVUsdCalcResult:s,swapFromVUsdCalcResult:i}}function YT(n,{feeShare:r,decimals:o},s){let i=(0,Qe.Big)(n),a=i.times(r),c=i.minus(a);return{bridgeFeeInTokenPrecision:a.round().toFixed(),amountIncludingCommissionInSystemPrecision:Lm(Jn(c,o),s),amountExcludingCommissionInSystemPrecision:Lm(Jn(i,o),s)}}function Lm(n,r){if(n.eq(0))return"0";let o=(0,Qe.Big)(r.tokenBalance).plus(n),s=Jr(o.toFixed(),r.aValue,r.dValue);return(0,Qe.Big)(r.vUsdBalance).minus(s).round().toFixed()}function qT(n,{feeShare:r,decimals:o},s){if((0,Qe.Big)(n).eq(0))return{bridgeFeeInTokenPrecision:"0",amountIncludingCommissionInTokenPrecision:"0",amountExcludingCommissionInTokenPrecision:"0"};let a=(0,Qe.Big)(n).plus(s.vUsdBalance),c=Jr(a,s.aValue,s.dValue),u=qt((0,Qe.Big)(s.tokenBalance).minus(c),o),l=(0,Qe.Big)(u).times(r),p=(0,Qe.Big)(u).minus(l).round();return{bridgeFeeInTokenPrecision:l.round().toFixed(),amountIncludingCommissionInTokenPrecision:p.toFixed(),amountExcludingCommissionInTokenPrecision:u.toFixed()}}function QT(n,{feeShare:r,decimals:o},s){let i=(0,Qe.Big)(r).div((0,Qe.Big)(1).minus(r)),a=(0,Qe.Big)(n).times(i),c=(0,Qe.Big)(n).plus(a);return{bridgeFeeInTokenPrecision:a.round().toFixed(),amountIncludingCommissionInSystemPrecision:$m(Jn(c,o),s),amountExcludingCommissionInSystemPrecision:$m(Jn(n,o),s)}}function $m(n,r){let o=(0,Qe.Big)(r.tokenBalance).minus(n),s=Jr(o.toFixed(),r.aValue,r.dValue);return(0,Qe.Big)(s).minus(r.vUsdBalance).round().toFixed()}function eP(n,{feeShare:r,decimals:o},s){if((0,Qe.Big)(n).eq(0))return{bridgeFeeInTokenPrecision:"0",amountIncludingCommissionInTokenPrecision:"0",amountExcludingCommissionInTokenPrecision:"0"};let i=(0,Qe.Big)(s.vUsdBalance).minus(n),a=Jr(i.toFixed(),s.aValue,s.dValue),c=(0,Qe.Big)(a).minus(s.tokenBalance),u=qt(c.toFixed(),o),l=(0,Qe.Big)(r).div((0,Qe.Big)(1).minus(r)),p=(0,Qe.Big)(u).times(l),A=(0,Qe.Big)(u).plus(p);return{bridgeFeeInTokenPrecision:p.round().toFixed(),amountIncludingCommissionInTokenPrecision:A.round().toFixed(),amountExcludingCommissionInTokenPrecision:u.toFixed()}}var Sn=require("big.js");function Hm(n,r,o,s,i){let a=Zr(n,r,o),c=qt(a,r.decimals),u=Cs(a,s,i),l=(0,Sn.Big)(n).times(r.feeShare),p=(0,Sn.Big)(u).div((0,Sn.Big)(1).minus(s.feeShare)).minus(u);return{sourceLPSwap:{fee:we(l,r.decimals).neg().round(r.decimals,Sn.Big.roundUp).toFixed(),swap:we((0,Sn.Big)(n).minus(c).minus(l),r.decimals).neg().round(r.decimals,Sn.Big.roundUp).toFixed()},destLPSwap:{fee:we(p,s.decimals).neg().round(s.decimals,Sn.Big.roundUp).toFixed(),swap:we(qt(a,s.decimals).minus(u).minus(p),s.decimals).neg().round(s.decimals,Sn.Big.roundUp).toFixed()}}}var gs=require("@solana/web3.js");var fc=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.params=o}async addMemoToTx(r,o){if(o.length>28)throw new _("InvalidArgumentException memo cannot be more than 28 characters");let s=new gs.Connection(this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"),"confirmed"),i=await mo(r,s),a=gs.TransactionMessage.decompile(r.message,{addressLookupTableAccounts:i}),c=a.instructions[a.instructions.length-1];if(!c?.keys)throw new _("Last instruction or its keys are invalid.");c.keys.push({pubkey:new gs.PublicKey(Buffer.from(o)),isSigner:!1,isWritable:!1}),r.message=a.compileToV0Message(i)}};var _e=require("@stellar/stellar-sdk");var x2=require("@stellar/stellar-sdk"),tP=x2.contract.Spec,rP=x2.contract.Client;var Pi=class extends rP{constructor(o){super(new tP(["AAAAAAAAAYlSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW4gdGhlIHNwZW5kZXIgdHJhbnNmZXJzIGFtb3VudHMsIHRoZSBhbGxvd2FuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQgdHJhbnNmZXJlZC4KCiMgQXJndW1lbnRzCgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHRvIGJlIGRyYXduIGZyb20uCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3Mgc3BlbmRpbmcgdGhlIHRva2VucyBoZWxkIGJ5IGBmcm9tYC4AAAAAAAAJYWxsb3dhbmNlAAAAAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEwAAAAEAAAAL","AAAAAAAAAIlSZXR1cm5zIHRydWUgaWYgYGlkYCBpcyBhdXRob3JpemVkIHRvIHVzZSBpdHMgYmFsYW5jZS4KCiMgQXJndW1lbnRzCgoqIGBpZGAgLSBUaGUgYWRkcmVzcyBmb3Igd2hpY2ggdG9rZW4gYXV0aG9yaXphdGlvbiBpcyBiZWluZyBjaGVja2VkLgAAAAAAAAphdXRob3JpemVkAAAAAAABAAAAAAAAAAJpZAAAAAAAEwAAAAEAAAAB","AAAAAAAAA55TZXQgdGhlIGFsbG93YW5jZSBieSBgYW1vdW50YCBmb3IgYHNwZW5kZXJgIHRvIHRyYW5zZmVyL2J1cm4gZnJvbQpgZnJvbWAuCgpUaGUgYW1vdW50IHNldCBpcyB0aGUgYW1vdW50IHRoYXQgc3BlbmRlciBpcyBhcHByb3ZlZCB0byB0cmFuc2ZlciBvdXQgb2YKZnJvbSdzIGJhbGFuY2UuIFRoZSBzcGVuZGVyIHdpbGwgYmUgYWxsb3dlZCB0byB0cmFuc2ZlciBhbW91bnRzLCBhbmQKd2hlbiBhbiBhbW91bnQgaXMgdHJhbnNmZXJyZWQgdGhlIGFsbG93YW5jZSB3aWxsIGJlIHJlZHVjZWQgYnkgdGhlCmFtb3VudCB0cmFuc2ZlcmVkLgoKIyBBcmd1bWVudHMKCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgdG8gYmUgZHJhd24gZnJvbS4KKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBiZWluZyBhdXRob3JpemVkIHRvIHNwZW5kIHRoZSB0b2tlbnMgaGVsZCBieQpgZnJvbWAuCiogYGFtb3VudGAgLSBUaGUgdG9rZW5zIHRvIGJlIG1hZGUgYXZhaWxhYmxlIHRvIGBzcGVuZGVyYC4KKiBgZXhwaXJhdGlvbl9sZWRnZXJgIC0gVGhlIGxlZGdlciBudW1iZXIgd2hlcmUgdGhpcyBhbGxvd2FuY2UgZXhwaXJlcy4gQ2Fubm90CmJlIGxlc3MgdGhhbiB0aGUgY3VycmVudCBsZWRnZXIgbnVtYmVyIHVubGVzcyB0aGUgYW1vdW50IGlzIGJlaW5nIHNldCB0byAwLgpBbiBleHBpcmVkIGVudHJ5ICh3aGVyZSBleHBpcmF0aW9uX2xlZGdlciA8IHRoZSBjdXJyZW50IGxlZGdlciBudW1iZXIpCnNob3VsZCBiZSB0cmVhdGVkIGFzIGEgMCBhbW91bnQgYWxsb3dhbmNlLgoKIyBFdmVudHMKCkVtaXRzIGFuIGV2ZW50IHdpdGggdG9waWNzIGBbImFwcHJvdmUiLCBmcm9tOiBBZGRyZXNzLApzcGVuZGVyOiBBZGRyZXNzXSwgZGF0YSA9IFthbW91bnQ6IGkxMjgsIGV4cGlyYXRpb25fbGVkZ2VyOiB1MzJdYAAAAAAAB2FwcHJvdmUAAAAABAAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAAAAABFleHBpcmF0aW9uX2xlZGdlcgAAAAAAAAQAAAAA","AAAAAAAAAJhSZXR1cm5zIHRoZSBiYWxhbmNlIG9mIGBpZGAuCgojIEFyZ3VtZW50cwoKKiBgaWRgIC0gVGhlIGFkZHJlc3MgZm9yIHdoaWNoIGEgYmFsYW5jZSBpcyBiZWluZyBxdWVyaWVkLiBJZiB0aGUKYWRkcmVzcyBoYXMgbm8gZXhpc3RpbmcgYmFsYW5jZSwgcmV0dXJucyAwLgAAAAdiYWxhbmNlAAAAAAEAAAAAAAAAAmlkAAAAAAATAAAAAQAAAAs=","AAAAAAAAAWRCdXJuIGBhbW91bnRgIGZyb20gYGZyb21gLgoKUmVkdWNlcyBmcm9tJ3MgYmFsYW5jZSBieSB0aGUgYW1vdW50LCB3aXRob3V0IHRyYW5zZmVycmluZyB0aGUgYmFsYW5jZQp0byBhbm90aGVyIGhvbGRlcidzIGJhbGFuY2UuCgojIEFyZ3VtZW50cwoKKiBgZnJvbWAgLSBUaGUgYWRkcmVzcyBob2xkaW5nIHRoZSBiYWxhbmNlIG9mIHRva2VucyB3aGljaCB3aWxsIGJlCmJ1cm5lZCBmcm9tLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgYnVybmVkLgoKIyBFdmVudHMKCkVtaXRzIGFuIGV2ZW50IHdpdGggdG9waWNzIGBbImJ1cm4iLCBmcm9tOiBBZGRyZXNzXSwgZGF0YSA9IFthbW91bnQ6CmkxMjhdYAAAAARidXJuAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAtxCdXJuIGBhbW91bnRgIGZyb20gYGZyb21gLCBjb25zdW1pbmcgdGhlIGFsbG93YW5jZSBvZiBgc3BlbmRlcmAuCgpSZWR1Y2VzIGZyb20ncyBiYWxhbmNlIGJ5IHRoZSBhbW91bnQsIHdpdGhvdXQgdHJhbnNmZXJyaW5nIHRoZSBiYWxhbmNlCnRvIGFub3RoZXIgaG9sZGVyJ3MgYmFsYW5jZS4KClRoZSBzcGVuZGVyIHdpbGwgYmUgYWxsb3dlZCB0byBidXJuIHRoZSBhbW91bnQgZnJvbSBmcm9tJ3MgYmFsYW5jZSwgaWYKdGhlIGFtb3VudCBpcyBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gdGhlIGFsbG93YW5jZSB0aGF0IHRoZSBzcGVuZGVyIGhhcwpvbiB0aGUgZnJvbSdzIGJhbGFuY2UuIFRoZSBzcGVuZGVyJ3MgYWxsb3dhbmNlIG9uIGZyb20ncyBiYWxhbmNlIHdpbGwgYmUKcmVkdWNlZCBieSB0aGUgYW1vdW50LgoKIyBBcmd1bWVudHMKCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3MgYXV0aG9yaXppbmcgdGhlIGJ1cm4sIGFuZCBoYXZpbmcgaXRzIGFsbG93YW5jZQpjb25zdW1lZCBkdXJpbmcgdGhlIGJ1cm4uCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgd2hpY2ggd2lsbCBiZQpidXJuZWQgZnJvbS4KKiBgYW1vdW50YCAtIFRoZSBhbW91bnQgb2YgdG9rZW5zIHRvIGJlIGJ1cm5lZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJidXJuIiwgZnJvbTogQWRkcmVzc10sIGRhdGEgPSBbYW1vdW50OgppMTI4XWAAAAAJYnVybl9mcm9tAAAAAAAAAwAAAAAAAAAHc3BlbmRlcgAAAAATAAAAAAAAAARmcm9tAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==","AAAAAAAAAVNDbGF3YmFjayBgYW1vdW50YCBmcm9tIGBmcm9tYCBhY2NvdW50LiBgYW1vdW50YCBpcyBidXJuZWQgaW4gdGhlCmNsYXdiYWNrIHByb2Nlc3MuCgojIEFyZ3VtZW50cwoKKiBgZnJvbWAgLSBUaGUgYWRkcmVzcyBob2xkaW5nIHRoZSBiYWxhbmNlIGZyb20gd2hpY2ggdGhlIGNsYXdiYWNrIHdpbGwKdGFrZSB0b2tlbnMuCiogYGFtb3VudGAgLSBUaGUgYW1vdW50IG9mIHRva2VucyB0byBiZSBjbGF3ZWQgYmFjay4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJjbGF3YmFjayIsIGFkbWluOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAACGNsYXdiYWNrAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAIBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZGVjaW1hbHMgdXNlZCB0byByZXByZXNlbnQgYW1vdW50cyBvZiB0aGlzIHRva2VuLgoKIyBQYW5pY3MKCklmIHRoZSBjb250cmFjdCBoYXMgbm90IHlldCBiZWVuIGluaXRpYWxpemVkLgAAAAhkZWNpbWFscwAAAAAAAAABAAAABA==","AAAAAAAAAPVNaW50cyBgYW1vdW50YCB0byBgdG9gLgoKIyBBcmd1bWVudHMKCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgbWludGVkIHRva2Vucy4KKiBgYW1vdW50YCAtIFRoZSBhbW91bnQgb2YgdG9rZW5zIHRvIGJlIG1pbnRlZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJtaW50IiwgYWRtaW46IEFkZHJlc3MsIHRvOiBBZGRyZXNzXSwgZGF0YQo9IFthbW91bnQ6IGkxMjhdYAAAAAAAAARtaW50AAAAAgAAAAAAAAACdG8AAAAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAFlSZXR1cm5zIHRoZSBuYW1lIGZvciB0aGlzIHRva2VuLgoKIyBQYW5pY3MKCklmIHRoZSBjb250cmFjdCBoYXMgbm90IHlldCBiZWVuIGluaXRpYWxpemVkLgAAAAAAAARuYW1lAAAAAAAAAAEAAAAQ","AAAAAAAAAQxTZXRzIHRoZSBhZG1pbmlzdHJhdG9yIHRvIHRoZSBzcGVjaWZpZWQgYWRkcmVzcyBgbmV3X2FkbWluYC4KCiMgQXJndW1lbnRzCgoqIGBuZXdfYWRtaW5gIC0gVGhlIGFkZHJlc3Mgd2hpY2ggd2lsbCBoZW5jZWZvcnRoIGJlIHRoZSBhZG1pbmlzdHJhdG9yCm9mIHRoaXMgdG9rZW4gY29udHJhY3QuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsic2V0X2FkbWluIiwgYWRtaW46IEFkZHJlc3NdLCBkYXRhID0KW25ld19hZG1pbjogQWRkcmVzc11gAAAACXNldF9hZG1pbgAAAAAAAAEAAAAAAAAACW5ld19hZG1pbgAAAAAAABMAAAAA","AAAAAAAAAEZSZXR1cm5zIHRoZSBhZG1pbiBvZiB0aGUgY29udHJhY3QuCgojIFBhbmljcwoKSWYgdGhlIGFkbWluIGlzIG5vdCBzZXQuAAAAAAAFYWRtaW4AAAAAAAAAAAAAAQAAABM=","AAAAAAAAAVBTZXRzIHdoZXRoZXIgdGhlIGFjY291bnQgaXMgYXV0aG9yaXplZCB0byB1c2UgaXRzIGJhbGFuY2UuIElmCmBhdXRob3JpemVkYCBpcyB0cnVlLCBgaWRgIHNob3VsZCBiZSBhYmxlIHRvIHVzZSBpdHMgYmFsYW5jZS4KCiMgQXJndW1lbnRzCgoqIGBpZGAgLSBUaGUgYWRkcmVzcyBiZWluZyAoZGUtKWF1dGhvcml6ZWQuCiogYGF1dGhvcml6ZWAgLSBXaGV0aGVyIG9yIG5vdCBgaWRgIGNhbiB1c2UgaXRzIGJhbGFuY2UuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsic2V0X2F1dGhvcml6ZWQiLCBpZDogQWRkcmVzc10sIGRhdGEgPQpbYXV0aG9yaXplOiBib29sXWAAAAAOc2V0X2F1dGhvcml6ZWQAAAAAAAIAAAAAAAAAAmlkAAAAAAATAAAAAAAAAAlhdXRob3JpemUAAAAAAAABAAAAAA==","AAAAAAAAAFtSZXR1cm5zIHRoZSBzeW1ib2wgZm9yIHRoaXMgdG9rZW4uCgojIFBhbmljcwoKSWYgdGhlIGNvbnRyYWN0IGhhcyBub3QgeWV0IGJlZW4gaW5pdGlhbGl6ZWQuAAAAAAZzeW1ib2wAAAAAAAAAAAABAAAAEA==","AAAAAAAAAWRUcmFuc2ZlciBgYW1vdW50YCBmcm9tIGBmcm9tYCB0byBgdG9gLgoKIyBBcmd1bWVudHMKCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgd2hpY2ggd2lsbCBiZQp3aXRoZHJhd24gZnJvbS4KKiBgdG9gIC0gVGhlIGFkZHJlc3Mgd2hpY2ggd2lsbCByZWNlaXZlIHRoZSB0cmFuc2ZlcnJlZCB0b2tlbnMuCiogYGFtb3VudGAgLSBUaGUgYW1vdW50IG9mIHRva2VucyB0byBiZSB0cmFuc2ZlcnJlZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJ0cmFuc2ZlciIsIGZyb206IEFkZHJlc3MsIHRvOiBBZGRyZXNzXSwKZGF0YSA9IFthbW91bnQ6IGkxMjhdYAAAAAh0cmFuc2ZlcgAAAAMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==","AAAAAAAAAzNUcmFuc2ZlciBgYW1vdW50YCBmcm9tIGBmcm9tYCB0byBgdG9gLCBjb25zdW1pbmcgdGhlIGFsbG93YW5jZSB0aGF0CmBzcGVuZGVyYCBoYXMgb24gYGZyb21gJ3MgYmFsYW5jZS4gQXV0aG9yaXplZCBieSBzcGVuZGVyCihgc3BlbmRlci5yZXF1aXJlX2F1dGgoKWApLgoKVGhlIHNwZW5kZXIgd2lsbCBiZSBhbGxvd2VkIHRvIHRyYW5zZmVyIHRoZSBhbW91bnQgZnJvbSBmcm9tJ3MgYmFsYW5jZQppZiB0aGUgYW1vdW50IGlzIGxlc3MgdGhhbiBvciBlcXVhbCB0byB0aGUgYWxsb3dhbmNlIHRoYXQgdGhlIHNwZW5kZXIKaGFzIG9uIHRoZSBmcm9tJ3MgYmFsYW5jZS4gVGhlIHNwZW5kZXIncyBhbGxvd2FuY2Ugb24gZnJvbSdzIGJhbGFuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQuCgojIEFyZ3VtZW50cwoKKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBhdXRob3JpemluZyB0aGUgdHJhbnNmZXIsIGFuZCBoYXZpbmcgaXRzCmFsbG93YW5jZSBjb25zdW1lZCBkdXJpbmcgdGhlIHRyYW5zZmVyLgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHdoaWNoIHdpbGwgYmUKd2l0aGRyYXduIGZyb20uCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA=="]),o);this.options=o}fromJSON={allowance:this.txFromJSON,authorized:this.txFromJSON,approve:this.txFromJSON,balance:this.txFromJSON,burn:this.txFromJSON,burn_from:this.txFromJSON,clawback:this.txFromJSON,decimals:this.txFromJSON,mint:this.txFromJSON,name:this.txFromJSON,set_admin:this.txFromJSON,admin:this.txFromJSON,set_authorized:this.txFromJSON,symbol:this.txFromJSON,transfer:this.txFromJSON,transfer_from:this.txFromJSON}};var nP=100,oP=180,mc=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.params=o}async buildChangeTrustLineXdrTx(r){let s=await new _e.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")).loadAccount(r.sender),a=await this.getContract(Pi,r.tokenAddress).name();if(As(a))throw new _;let c=ps(a);if(!c)throw new _;let[u,l]=c.split(":");if(u===void 0||l===void 0)throw new _("Invalid token name format. Expected format 'symbol:srbTokenAddress'");let p=new _e.Asset(u,l),A=_e.Operation.changeTrust({asset:p,limit:r.limit});return new _e.TransactionBuilder(s,{fee:nP.toString(10),networkPassphrase:this.params.sorobanNetworkPassphrase}).addOperation(A).setTimeout(oP).build().toXDR()}async getBalanceLine(r,o){let i=await this.getContract(Pi,o).name();if(As(i))throw new _;let a=ps(i);if(!a)throw new _;let[c,u]=a.split(":"),l=this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR");return(await new _e.Horizon.Server(l).loadAccount(r)).balances.find(P=>(P.asset_type==="credit_alphanum4"||P.asset_type==="credit_alphanum12")&&P.asset_code==c&&P.asset_issuer==u)}async submitTransactionStellar(r){let o=new _e.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")),s=_e.TransactionBuilder.fromXDR(r,this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR"));return await o.submitTransaction(s)}async simulateAndCheckRestoreTxRequiredSoroban(r,o){let s=new _e.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),i=await s.getAccount(o),a=_e.TransactionBuilder.fromXDR(r,this.params.sorobanNetworkPassphrase),c=await s.simulateTransaction(a);if(_e.rpc.Api.isSimulationRestore(c))return new _e.TransactionBuilder(i,{fee:(+_e.BASE_FEE+ +c.restorePreamble.minResourceFee).toString(),networkPassphrase:this.params.sorobanNetworkPassphrase}).setSorobanData(c.restorePreamble.transactionData.build()).addOperation(_e.Operation.restoreFootprint({})).setTimeout(_e.TimeoutInfinite).build().toXDR()}async sendTransactionSoroban(r){let o=new _e.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),s=_e.TransactionBuilder.fromXDR(r,this.params.sorobanNetworkPassphrase);return o.sendTransaction(s)}async confirmTx(r,o=15){let s=new _e.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),i=await ef(()=>s.getTransaction(r),c=>c.status===_e.rpc.Api.GetTransactionStatus.NOT_FOUND,o);if(i.length===0)throw new _("No transaction responses found.");let a=i[i.length-1];if(!a)throw new _("Unexpected error: last response is undefined.");return a}getContract(r,o){let s={contractId:o,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new r(s)}};var gc=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.srb=new mc(r,o),this.sol=new fc(r,o)}srb;sol};var Nn=(o=>(o.WITH_NATIVE_CURRENCY="native",o.WITH_STABLECOIN="stablecoin",o))(Nn||{}),qs=(o=>(o.INT="int",o.FLOAT="float",o))(qs||{});var Xm=require("big.js"),Ym=require("web3");var sP={abi:[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}]},hc=sP;var md=require("big.js"),pr=class{async checkAllowance(r){let o=await this.getAllowance(r);return(0,md.Big)(o).gte((0,md.Big)(r.amount))}};var iP="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",aP="0xdac17f958d2ee523a2206206994597c13d831ec7",cP=1e5,wi=class extends pr{constructor(o,s){super();this.web3=o;this.api=s}chainType="EVM";getAllowance(o){let s=o.token.tokenAddress,i=o.owner,a=o.spender;return this.getAllowanceByTokenAddress(s,i,a)}getAllowanceByTokenAddress(o,s,i){return this.getERC20Contract(o).methods.allowance(s,i).call()}async getTokenBalance(o){return await this.getERC20Contract(o.token.tokenAddress).methods.balanceOf(o.account).call()}async getNativeTokenBalance(o){return(await this.web3.eth.getBalance(o.account)).toString()}async approve(o){if(this.isUsdt(o.tokenAddress)&&await this.getAllowanceByTokenAddress(o.tokenAddress,o.owner,o.spender)!=="0"){let a=await this.buildRawTransactionApprove({...o,amount:"0"});await this.sendRawTransaction(a,o.chainSymbol)}let s=await this.buildRawTransactionApprove(o);return await this.sendRawTransaction(s,o.chainSymbol)}isUsdt(o){return o.toLowerCase()===aP}buildRawTransactionApprove(o){let{tokenAddress:s,spender:i,owner:a,amount:c}=o,l=this.getERC20Contract(s).methods.approve(i,c==null?iP:qa(c));return Promise.resolve({from:a,to:s,value:"0",data:l.encodeABI()})}async sendRawTransaction(o,s){let i=o,a={maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};s==="POL"?i.gas=cP:i.gas=await this.web3.eth.estimateGas(o);let{transactionHash:c}=await this.web3.eth.sendTransaction({...i,...a});return{txId:c.toString()}}getERC20Contract(o){return new this.web3.eth.Contract(hc.abi,o)}};var Km=require("@project-serum/anchor"),Io=require("@solana/web3.js");var yc=class extends pr{constructor(o,s){super();this.solanaRpcUrl=o;this.api=s}chainType="SOLANA";approve(o){throw new st}buildRawTransactionApprove(o){throw new st}buildAnchorProvider(o){let s=new Io.Connection(this.solanaRpcUrl,"confirmed"),i=new Io.PublicKey(o);return new Km.AnchorProvider(s,{publicKey:i},{preflightCommitment:"confirmed",commitment:"confirmed"})}getAllowance(o){throw new st}async getTokenBalance(o){let{account:s,token:i}=o;try{let a=await Ir(new Io.PublicKey(s),new Io.PublicKey(i.tokenAddress));return(await Qo(a,this.buildAnchorProvider(s))).amount.toString()}catch(a){if(a instanceof Error)return a.message.startsWith("Account does not exist"),"0";throw a}}async getNativeTokenBalance(o){return(await this.buildAnchorProvider(o.account).connection.getBalance(new Io.PublicKey(o.account))).toString()}};var gd=require("@stellar/stellar-sdk");var bc=class extends pr{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";getAllowance(){throw new st}async getTokenBalance(o){if(!o.token.originTokenAddress)throw new _("OriginTokenAddress missing");let[s,i]=o.token.originTokenAddress.split(":"),a=new gd.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")),c;try{c=await a.loadAccount(o.account)}catch(p){if(p instanceof gd.NotFoundError)return"0";throw p}let l=c.balances.find(p=>(p.asset_type==="credit_alphanum4"||p.asset_type==="credit_alphanum12")&&p.asset_code==s&&p.asset_issuer==i);return l?.balance?Ee(l.balance,Me.getChainDecimalsByType(Me.getChainProperty(o.token.chainSymbol).chainType)).toFixed():"0"}async getNativeTokenBalance(o){let c=(await new gd.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")).loadAccount(o.account)).balances.find(u=>u.asset_type==="native");return c?.balance?Ee(c.balance,Me.getChainDecimalsByType(Me.getChainProperty(o.chainSymbol).chainType)).toFixed():"0"}approve(){throw new st}buildRawTransactionApprove(){throw new st}};var Tc=class extends pr{constructor(o,s){super();this.suiRpcUrl=o;this.api=s;this.suiClient=new Cn({url:this.suiRpcUrl})}chainType="SUI";suiClient;approve(o){throw new st}buildRawTransactionApprove(o){throw new st}getAllowance(o){throw new st}async getTokenBalance(o){if(!o.token.originTokenAddress)throw new _("SUI token must contain 'originTokenAddress'");return(await this.suiClient.getBalance({owner:o.account,coinType:o.token.originTokenAddress})).totalBalance}async getNativeTokenBalance(o){let s=await rn(i=>this.suiClient.getCoins({owner:o.account,cursor:i}));return s.length===0?"0":s.reduce((i,a)=>i+BigInt(a.balance),BigInt(0)).toString()}};var uP="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",Ci=class extends pr{constructor(o,s){super();this.tronWeb=o;this.api=s}chainType="TRX";async getAllowance(o){let{token:{tokenAddress:s},owner:i}=o;return(await(await this.getContract(s)).methods.allowance(i,o.spender).call()).toString()}async getTokenBalance(o){return(await(await this.getContract(o.token.tokenAddress)).balanceOf(o.account).call()).toString()}async getNativeTokenBalance(o){return(await this.tronWeb.trx.getBalance(o.account)).toString()}async approve(o){let s=await this.buildRawTransactionApprove(o);return await Qa(this.tronWeb,s)}async buildRawTransactionApprove(o){let{tokenAddress:s,spender:i,owner:a,amount:c}=o,u=c==null?uP:qa(c),l=[{type:"address",value:i},{type:"uint256",value:u}];return this.buildRawTransaction(s,"approve(address,uint256)",l,"0",a)}getContract(o){return this.tronWeb.contract(hc.abi,o)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new _("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}};var Pc=class{constructor(r,o,s){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s}async getAllowance(r,o){let s=await(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).getAllowance(r);return we(s,r.token.decimals).toFixed()}async checkAllowance(r,o){return je(r.amount),Le("amount",r.amount,r.token.decimals),(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).checkAllowance(this.prepareCheckAllowanceParams(r))}async approve(r,o){return o.amount&&(je(o.amount),Le("amount",o.amount,o.token.decimals)),(await this.getChainTokenService(o.token.chainSymbol,o.owner,r)).approve(this.prepareApproveParams(o))}async buildRawTransactionApprove(r,o){return r.amount&&(je(r.amount),Le("amount",r.amount,r.token.decimals)),(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).buildRawTransactionApprove(this.prepareApproveParams(r))}async getTokenBalance(r,o){let s=await(await this.getChainTokenService(r.token.chainSymbol,r.account,o)).getTokenBalance(r);return r.token.decimals?we(s,r.token.decimals).toFixed():s}async getNativeTokenBalance(r,o){let s=await(await this.getChainTokenService(r.chainSymbol,r.account,o)).getNativeTokenBalance(r);return{int:s,float:we(s,Me.getChainDecimalsByType(Me.getChainProperty(r.chainSymbol).chainType)).toFixed()}}async getChainTokenService(r,o,s){switch(Me.getChainProperty(r).chainType){case"EVM":{if(s)return new wi(s,this.api);{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r);return new wi(new Ym.Web3(i),this.api)}}case"TRX":if(s){let i=await vr();return new Ci(s,this.api)}else{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r),a=new(await vr())({fullHost:i});return a.setAddress(o),new Ci(a,this.api)}case"SOLANA":{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r);return new yc(i,this.api)}case"SRB":return new bc(this.nodeRpcUrlsConfig,this.params,this.api);case"SUI":return new Tc(this.nodeRpcUrlsConfig.getNodeRpcUrl(r),this.api)}}prepareCheckAllowanceParams(r){return{...r,amount:Ee(r.amount,r.token.decimals)}}prepareApproveParams(r){return{tokenAddress:r.token.tokenAddress,owner:r.owner,spender:r.spender,chainSymbol:r.token.chainSymbol,amount:r.amount==null?void 0:(0,Xm.Big)(r.amount).toFixed()}}};var Bi=class{constructor(r){this.nodeRpcUrls=r}getNodeRpcUrl(r){let o=this.nodeRpcUrls[r];if(o!==void 0)return o;throw new Ts(r)}},wc=class{api;tokenService;params;bridge;pool;constructor(r,o=hs){Me.addChainsProperties(o.additionalChainsProperties);let s=new Mi(o),i=new Ri(s),a=new Fi(i),c=new Oi(a);this.api=new ki(c,o),this.tokenService=new Pc(this.api,r,o),this.bridge=new ec(this.api,r,o,this.tokenService),this.pool=new Ac(this.api,r,o,this.tokenService),this.params=o}async chainDetailsMap(r){return this.api.getChainDetailsMap(r)}async tokens(r){return this.api.tokens(r)}async tokensByChain(r,o){let i=(await this.api.getChainDetailsMap(o))[r];return i?i.tokens:[]}async getTransferStatus(r,o){return this.api.getTransferStatus(r,o)}async getGasBalance(r,o){return this.api.getGasBalance(r,o)}async checkAddress(){return new Promise(r=>{r({status:"OK",gasBalance:null})})}async getPendingStatusInfo(r,o,s,i){je(r);let a;o=="float"?(Le("amount",r,s.decimals),a=Ee(r,s.decimals).toFixed()):a=r;let c=Zr(a,s,await lt(this.api,s)),u=await lt(this.api,i),l=this.getAmountFromVUsdFormatted(c,i,u),p,A=await this.api.getPendingInfo();for(let g in A[i.chainSymbol]){let P=A[i.chainSymbol];if(!P)throw new _("Cannot find pending info for "+i.chainSymbol);p=P[g]}if(p){let g=Pd(p.totalSentAmount,u),P=this.getAmountFromVUsdFormatted(c,i,g),b;return(0,zt.Big)(P.int).gt(l.int)?b={min:l,max:P}:b={min:P,max:l},{pendingTxs:p.pendingTxs,pendingAmount:{int:$r(p.totalSentAmount,3,i.decimals).toFixed(0),float:we(p.totalSentAmount,3).toFixed()},estimatedAmount:b}}return{pendingTxs:0,pendingAmount:{int:"0",float:"0"},estimatedAmount:{min:l,max:l}}}async getTokenBalance(r,o){return this.tokenService.getTokenBalance(r,o)}async getNativeTokenBalance(r,o){return this.tokenService.getNativeTokenBalance(r,o)}async calculateFeePercentOnSourceChain(r,o){je(r),Le("amountFloat",r,o.decimals);let s=Ee(r,o.decimals);if(s.eq(0))return 0;let i=Zr(s,o,await lt(this.api,o)),a=qt(i,o.decimals);return Bc(s,a)}async calculateFeePercentOnDestinationChain(r,o,s){je(r),Le("amountFloat",r,o.decimals);let i=Ee(r,o.decimals);if(i.eq(0))return 0;let a=Zr(i,o,await lt(this.api,o)),c=Cs(a,s,await lt(this.api,s)),u=qt(a,s.decimals);return Bc(u,c)}async getAmountToBeReceivedAndGasFeeOptions(r,o,s,i){return je(r),Le("amountToSendFloat",r,o.decimals),{amountToSendFloat:(0,zt.Big)(r).toFixed(),amountToBeReceivedFloat:await this.getAmountToBeReceived(r,o,s,i),gasFeeOptions:await this.getGasFeeOptions(o,s,i)}}async getAmountToSendAndGasFeeOptions(r,o,s,i){return je(r),Le("amountToBeReceivedFloat",r,s.decimals),{amountToSendFloat:await this.getAmountToSend(r,o,s,i),amountToBeReceivedFloat:(0,zt.Big)(r).toFixed(),gasFeeOptions:await this.getGasFeeOptions(o,s,i)}}async getAmountToBeReceived(r,o,s,i){let a=await lt(this.api,o),c=await lt(this.api,s);return this.getAmountToBeReceivedFromPools(r,o,s,a,c,i)}async getAmountToBeReceivedFromChain(r,o,s,i,a,c){let u=await this.pool.getPoolInfoFromChain(o,a),l=await this.pool.getPoolInfoFromChain(s,c);return this.getAmountToBeReceivedFromPools(r,o,s,u,l,i)}getAmountToBeReceivedFromPools(r,o,s,i,a,c){je(r),Le("amountToSendFloat",r,o.decimals);let u=Ee(r,o.decimals);if(c&&c==3){if(!o.cctpAddress||!s.cctpAddress||!o.cctpFeeShare)throw new Ct("Such route does not support CCTP protocol");let p=u.mul((0,zt.Big)(1).minus(o.cctpFeeShare)).round(0,zt.Big.roundUp),A=$r(p,o.decimals,s.decimals).round(0);return we(A,s.decimals).toFixed()}if(c&&c==4){if(!o.cctpV2Address||!s.cctpV2Address||!o.cctpV2FeeShare)throw new Ct("Such route does not support CCTP V2 protocol");let p=u.mul((0,zt.Big)(1).minus(o.cctpV2FeeShare)).round(0,zt.Big.roundUp),A=$r(p,o.decimals,s.decimals).round(0);return we(A,s.decimals).toFixed()}let l=Zr(u,o,i);return this.getAmountFromVUsdFormatted(l,s,a).float}async getAmountToSend(r,o,s,i){let a=await lt(this.api,o),c=await lt(this.api,s);return this.getAmountToSendFromPools(r,o,s,a,c,i)}async getAmountToSendFromChain(r,o,s,i,a,c){let u=await this.pool.getPoolInfoFromChain(o,a),l=await this.pool.getPoolInfoFromChain(s,c);return this.getAmountToSendFromPools(r,o,s,u,l,i)}getAmountToSendFromPools(r,o,s,i,a,c){je(r),Le("amountToBeReceivedFloat",r,s.decimals);let u=Ee(r,s.decimals);if(c&&c==3){if(!o.cctpAddress||!s.cctpAddress||!o.cctpFeeShare)throw new Ct("Such route does not support CCTP protocol");let A=u.div((0,zt.Big)(1).minus(o.cctpFeeShare)).round(0,zt.Big.roundDown),g=$r(A,s.decimals,o.decimals).round(0);return we(g,o.decimals).toFixed()}if(c&&c==4){if(!o.cctpV2Address||!s.cctpV2Address||!o.cctpV2FeeShare)throw new Ct("Such route does not support CCTP V2 protocol");let A=u.div((0,zt.Big)(1).minus(o.cctpV2FeeShare)).round(0,zt.Big.roundDown),g=$r(A,s.decimals,o.decimals).round(0);return we(g,o.decimals).toFixed()}let l=Cd(u,s,a),p=wd(l,o,i);if((0,zt.Big)(p).lte(0))throw new Lr;return we(p,o.decimals).toFixed()}async getGasFeeOptions(r,o,s){return el(r.allbridgeChainId,r.chainType,o.allbridgeChainId,r.decimals,s,this.api)}getAverageTransferTime(r,o,s){return r.transferTime?.[o.chainSymbol]?.[s]??null}async getPoolInfoByToken(r){return await this.api.getPoolInfoByKey({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress})}async refreshPoolInfo(r){if(r){let s=(r instanceof Array?r:[r]).map(i=>({chainSymbol:i.chainSymbol,poolAddress:i.poolAddress}));return this.api.refreshPoolInfo(s)}return this.api.refreshPoolInfo()}aprInPercents(r){return Wd(r)}async getExtraGasMaxLimits(r,o){return await tl(r,o,this.api)}async getVUsdFromAmount(r,o,s){je(r);let i;o=="float"?(Le("amount",r,s.decimals),i=Ee(r,s.decimals).toFixed()):i=r;let a=Zr(i,s,await lt(this.api,s));return{int:a,float:we(a,3).toFixed()}}async getAmountFromVUsd(r,o){return this.getAmountFromVUsdFormatted(r,o,await lt(this.api,o))}getAmountFromVUsdFormatted(r,o,s){je(r);let i=Cs(r,o,s);if((0,zt.Big)(i).lt(0))throw new Lr;return{int:i,float:we(i,o.decimals).toFixed()}}async swapAndBridgeFeeCalculation(r,o,s){return Zm(r,{decimals:o.decimals,feeShare:o.feeShare,poolInfo:await lt(this.api,o)},{decimals:s.decimals,feeShare:s.feeShare,poolInfo:await lt(this.api,s)})}async swapAndBridgeFeeCalculationReverse(r,o,s){let i=Jm(r,{decimals:o.decimals,feeShare:o.feeShare,poolInfo:await lt(this.api,o)},{decimals:s.decimals,feeShare:s.feeShare,poolInfo:await lt(this.api,s)}),a=i.swapFromVUsdCalcResult.amountIncludingCommissionInTokenPrecision;if((0,zt.Big)(a).lt(0))throw new Lr;return i}async getSendAmountDetails(r,o,s,i){je(r);let a;return o=="float"?(Le("amount",r,s.decimals),a=Ee(r,s.decimals).toFixed()):a=r,Hm(a,s,await lt(this.api,s),i,await lt(this.api,i))}};function lP(n){return"solanaRpcUrl"in n}var hd=class{params;bridge;pool;utils;service;constructor(r,o=hs){let s;lP(r)?s=new Bi({SOL:r.solanaRpcUrl,TRX:r.tronRpcUrl}):s=new Bi(r),this.service=new wc(s,o),this.bridge=this.service.bridge,this.pool=this.service.pool,this.utils=new gc(s,o),this.params=o}async chainDetailsMap(r="swap"){return this.service.chainDetailsMap(r)}async tokens(r="swap"){return this.service.tokens(r)}async tokensByChain(r,o="swap"){return this.service.tokensByChain(r,o)}async getTransferStatus(r,o){return this.service.getTransferStatus(r,o)}async getGasBalance(r,o){return this.service.getGasBalance(r,o)}async checkAddress(r,o,s){return await this.service.checkAddress()}async getPendingStatusInfo(r,o,s,i){return this.service.getPendingStatusInfo(r,o,s,i)}async getTokenBalance(r,o){return this.service.getTokenBalance(r,o)}async getNativeTokenBalance(r,o){return this.service.getNativeTokenBalance(r,o)}async calculateFeePercentOnSourceChain(r,o){return this.service.calculateFeePercentOnSourceChain(r,o)}async calculateFeePercentOnDestinationChain(r,o,s){return this.service.calculateFeePercentOnDestinationChain(r,o,s)}async getAmountToBeReceivedAndGasFeeOptions(r,o,s,i){return this.service.getAmountToBeReceivedAndGasFeeOptions(r,o,s,i)}async getAmountToSendAndGasFeeOptions(r,o,s,i){return this.service.getAmountToSendAndGasFeeOptions(r,o,s,i)}async getAmountToBeReceived(r,o,s,i){return this.service.getAmountToBeReceived(r,o,s,i)}async getAmountToBeReceivedFromChain(r,o,s,i,a,c){return this.service.getAmountToBeReceivedFromChain(r,o,s,i,a,c)}getAmountToBeReceivedFromPools(r,o,s,i,a,c){return this.service.getAmountToBeReceivedFromPools(r,o,s,i,a,c)}async getAmountToSend(r,o,s,i){return this.service.getAmountToSend(r,o,s,i)}async getAmountToSendFromChain(r,o,s,i,a,c){return this.service.getAmountToSendFromChain(r,o,s,i,a,c)}getAmountToSendFromPools(r,o,s,i,a,c){return this.service.getAmountToSendFromPools(r,o,s,i,a,c)}async getGasFeeOptions(r,o,s){return this.service.getGasFeeOptions(r,o,s)}getAverageTransferTime(r,o,s){return this.service.getAverageTransferTime(r,o,s)}async getPoolInfoByToken(r){return this.service.getPoolInfoByToken(r)}async refreshPoolInfo(r){return this.service.refreshPoolInfo(r)}aprInPercents(r){return this.service.aprInPercents(r)}async getExtraGasMaxLimits(r,o){return this.service.getExtraGasMaxLimits(r,o)}async getVUsdFromAmount(r,o,s){return this.service.getVUsdFromAmount(r,o,s)}async getAmountFromVUsd(r,o){return this.service.getAmountFromVUsd(r,o)}async swapAndBridgeFeeCalculation(r,o,s){return this.service.swapAndBridgeFeeCalculation(r,o,s)}async swapAndBridgeFeeCalculationReverse(r,o,s){return this.service.swapAndBridgeFeeCalculationReverse(r,o,s)}async getSendAmountDetails(r,o,s,i){return this.service.getSendAmountDetails(r,o,s,i)}};0&&(module.exports={AddressStatus,AllbridgeCoreSdk,AmountFormat,AmountNotEnoughError,ArgumentInvalidDecimalsError,CCTPDoesNotSupportedError,ChainSymbol,ChainType,ErrorCode,ExtraGasMaxLimitExceededError,FeePaymentMethod,InsufficientPoolLiquidityError,InvalidAmountError,InvalidGasFeePaymentOptionError,InvalidMessengerOptionError,InvalidTxError,JupiterError,Messenger,MethodNotSupportedError,NodeRpcUrlNotInitializedError,SdkError,SdkRootError,SolanaAutoTxFee,TimeoutError,TxTooLargeError,VerifyTxError,mainnet,nodeRpcUrlsDefault,nodeUrlsDefault});
|
|
1
|
+
"use strict";var ng=Object.create;var Si=Object.defineProperty;var og=Object.getOwnPropertyDescriptor;var sg=Object.getOwnPropertyNames;var ig=Object.getPrototypeOf,ag=Object.prototype.hasOwnProperty;var se=(n,r)=>()=>(n&&(r=n(n=0)),r);var Ot=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),Gt=(n,r)=>{for(var o in r)Si(n,o,{get:r[o],enumerable:!0})},gd=(n,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of sg(r))!ag.call(n,i)&&i!==o&&Si(n,i,{get:()=>r[i],enumerable:!(s=og(r,i))||s.enumerable});return n};var be=(n,r,o)=>(o=n!=null?ng(ig(n)):{},gd(r||!n||!n.__esModule?Si(o,"default",{value:n,enumerable:!0}):o,n)),cg=n=>gd(Si({},"__esModule",{value:!0}),n);var Wt,ws,kd=se(()=>{Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ws=class{encode(r){let o="",s,i,a,c,u,l,p,A=0;for(;A<r.length;)s=r.charCodeAt(A++),i=r.charCodeAt(A++),a=r.charCodeAt(A++),c=s>>2,u=(s&3)<<4|i>>4,l=(i&15)<<2|a>>6,p=a&63,isNaN(i)?l=p=64:isNaN(a)&&(p=64),o=o+Wt.charAt(c)+Wt.charAt(u)+Wt.charAt(l)+Wt.charAt(p);return o}encodeIgnoreUtf8(r){let o="",s,i,a,c,u,l,p,A=0;for(;A<r.length;)s=r[A++],i=r[A++],a=r[A++],c=s>>2,u=(s&3)<<4|i>>4,l=(i&15)<<2|a>>6,p=a&63,isNaN(i)?l=p=64:isNaN(a)&&(p=64),o=o+Wt.charAt(c)+Wt.charAt(u)+Wt.charAt(l)+Wt.charAt(p);return o}decode(r){let o="",s,i,a,c,u,l,p,A=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");A<r.length;)c=Wt.indexOf(r.charAt(A++)),u=Wt.indexOf(r.charAt(A++)),l=Wt.indexOf(r.charAt(A++)),p=Wt.indexOf(r.charAt(A++)),s=c<<2|u>>4,i=(u&15)<<4|l>>2,a=(l&3)<<6|p,o=o+String.fromCharCode(s),l!=64&&(o=o+String.fromCharCode(i)),p!=64&&(o=o+String.fromCharCode(a));return this._utf8_decode(o)}decodeToByteArray(r){let o="",s,i,a,c,u,l,p,A=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");A<r.length;)c=Wt.indexOf(r.charAt(A++)),u=Wt.indexOf(r.charAt(A++)),l=Wt.indexOf(r.charAt(A++)),p=Wt.indexOf(r.charAt(A++)),s=c<<2|u>>4,i=(u&15)<<4|l>>2,a=(l&3)<<6|p,o=o+String.fromCharCode(s),l!=64&&(o=o+String.fromCharCode(i)),p!=64&&(o=o+String.fromCharCode(a));return this._out2ByteArray(o)}_out2ByteArray(r){let o=new Array(r.length),s=0,i=0;for(;s<r.length;)i=r.charCodeAt(s),o[s]=i,s++;return o}_utf8_encode(r){r=r.replace(/\r\n/g,`
|
|
2
|
+
`);let o="";for(let s=0;s<r.length;s++){let i=r.charCodeAt(s);i<128?o+=String.fromCharCode(i):i>127&&i<2048?(o+=String.fromCharCode(i>>6|192),o+=String.fromCharCode(i&63|128)):(o+=String.fromCharCode(i>>12|224),o+=String.fromCharCode(i>>6&63|128),o+=String.fromCharCode(i&63|128))}return o}_utf8_decode(r){let o="",s=0,i=0,a=0,c=0;for(;s<r.length;)i=r.charCodeAt(s),i<128?(o+=String.fromCharCode(i),s++):i>191&&i<224?(a=r.charCodeAt(s+1),o+=String.fromCharCode((i&31)<<6|a&63),s+=2):(a=r.charCodeAt(s+1),c=r.charCodeAt(s+2),o+=String.fromCharCode((i&15)<<12|(a&63)<<6|c&63),s+=3);return o}}});var Mc={};Gt(Mc,{base64DecodeFromString:()=>sn,base64EncodeToString:()=>Cs,byte2hexStr:()=>Oo,byteArray2hexStr:()=>Ae,bytesToString:()=>Ei,hextoString:()=>Ic});function Oo(n){if(n<0||n>255)throw new Error("Input must be a byte");let r="0123456789ABCDEF",o="";return o+=r.charAt(n>>4),o+=r.charAt(n&15),o}function Ei(n){let r="";for(let o=0;o<n.length;o++){let s=n[o].toString(2),i=s.match(/^1+?(?=0)/);if(i&&s.length===8){let a=i[0].length,c=n[o].toString(2).slice(7-a);for(let u=1;u<a;u++)c+=n[u+o].toString(2).slice(2);r+=String.fromCharCode(parseInt(c,2)),o+=a-1}else r+=String.fromCharCode(n[o])}return r}function Ic(n){let r=n.replace(/^0x/,"").split(""),o="";for(let s=0;s<r.length/2;s++){let i=`0x${r[s*2]}${r[s*2+1]}`;o+=String.fromCharCode(parseInt(i))}return o}function Ae(n){let r="";for(let o=0;o<n.length;o++)r+=Oo(n[o]);return r}function sn(n){return new ws().decodeToByteArray(n)}function Cs(n){return new ws().encodeIgnoreUtf8(n)}var Jn=se(()=>{kd()});var Fc={};Gt(Fc,{arrayEquals:()=>Cg,base64DecodeFromString:()=>sn,base64EncodeToString:()=>Cs,bin2String:()=>wg,byte2hexStr:()=>Oo,byteArray2hexStr:()=>Ae,bytesToString:()=>Ei,getStringType:()=>Sg,hexChar2byte:()=>Od,hexStr2byteArray:()=>it,hextoString:()=>Ic,isHexChar:()=>Rc,isNumber:()=>Ed,strToDate:()=>Wg,stringToBytes:()=>Bg});function wg(n){return Ei(n)}function Cg(n,r,o=!1){if(n.length!=r.length)return!1;for(let s=0;s<n.length;s++)if(o){if(n[s]!=r[s])return!1}else if(JSON.stringify(n[s])!=JSON.stringify(r[s]))return!1;return!0}function Bg(n){let r=[],o=n.length,s;for(let i=0;i<o;i++)s=n.charCodeAt(i),s>=65536&&s<=1114111?(r.push(s>>18&7|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)):s>=2048&&s<=65535?(r.push(s>>12&15|224),r.push(s>>6&63|128),r.push(s&63|128)):s>=128&&s<=2047?(r.push(s>>6&31|192),r.push(s&63|128)):r.push(s&255);return r}function Od(n){let r;if(n>="A"&&n<="F"?r=n.charCodeAt(0)-65+10:n>="a"&&n<="f"?r=n.charCodeAt(0)-97+10:n>="0"&&n<="9"&&(r=n.charCodeAt(0)-48),typeof r=="number")return r;throw new Error("The passed hex char is not a valid hex char")}function Rc(n){return n>="A"&&n<="F"||n>="a"&&n<="f"||n>="0"&&n<="9"?1:0}function it(n,r=!1){let o=n.length;r&&o%2&&(n=`0${n}`,o++);let s=[],i=0,a=0,c=0;for(let u=0;u<o;u++){let l=n.charAt(u);if(Rc(l))i<<=4,i+=Od(l),a++,a%2===0&&(s[c++]=i,i=0);else throw new Error("The passed hex char is not a valid hex string")}return s}function Wg(n){if(!/^\d{4}-\d{2}-\d{2}( \d{2}-\d{2}-\d{2}|)/.test(n))throw new Error("The passed date string is not valid");let r=n.split(" "),o=r[0].split("-"),s=parseInt(o[0],10),i=parseInt(o[1],10)-1,a=parseInt(o[2],10);if(r.length>1){let c=r[1].split("-"),u=parseInt(c[0],10),l=parseInt(c[1],10),p=parseInt(c[2],10);return new Date(s,i,a,u,l,p)}return new Date(s,i,a)}function Ed(n){return n>="0"&&n<="9"?1:0}function Sg(n){if(n==null||n.length==0||n=="")return-1;let r=0;if(n.length==40)for(;r<40;r++){let o=n.charAt(r);if(!Rc(o))break}if(r==40)return 1;for(r=0;r<n.length;r++){let o=n.charAt(r);if(!Ed(o))break}if(r==n.length)return 2;for(r=0;r<n.length;r++)if(n.charAt(r)>" ")return 3;return-1}var Hn=se(()=>{Jn()});var Ec={};Gt(Ec,{hasProperties:()=>Oc,hasProperty:()=>Nd,isArray:()=>Kn,isBigNumber:()=>Ig,isBoolean:()=>kc,isFunction:()=>Mg,isHex:()=>Jr,isInteger:()=>Hr,isJson:()=>vg,isNotNullOrUndefined:()=>yt,isObject:()=>Wn,isString:()=>at,isValidURL:()=>Bs,mapEvent:()=>Rg,padLeft:()=>kg,parseEvent:()=>Fg,sleep:()=>Og});function Bs(n){return typeof n!="string"?!1:Dd.default.isURL(n.toString(),{protocols:["http","https"],require_tld:!1})}function Wn(n){return n===Object(n)&&Object.prototype.toString.call(n)!=="[object Array]"}function Kn(n){return Array.isArray(n)}function vg(n){try{return!!JSON.parse(n)}catch{return!1}}function kc(n){return typeof n=="boolean"}function Ig(n){return!!n&&(n instanceof xd.BigNumber||n.constructor&&n.constructor.name==="BigNumber")}function at(n){return typeof n=="string"||!!n&&n.constructor&&n.constructor.name==="String"}function Mg(n){return typeof n=="function"}function Jr(n){return typeof n=="string"&&!isNaN(parseInt(n,16))&&/^(0x|)[a-fA-F0-9]+$/.test(n)}function Hr(n){return n===null?!1:Number.isInteger(Number(n))}function Nd(n,r){return Object.prototype.hasOwnProperty.call(n,r)}function Oc(n,...r){return r.length&&!r.map(o=>Nd(n,o)).includes(!1)}function Rg(n){let r={block:n.block_number,timestamp:n.block_timestamp,contract:n.contract_address,name:n.event_name,transaction:n.transaction_id,result:n.result,resourceNode:n.resource_Node||(n._unconfirmed?"fullNode":"solidityNode")};return n._unconfirmed&&(r.unconfirmed=n._unconfirmed),n._fingerprint&&(r.fingerprint=n._fingerprint),r}function Fg(n,{inputs:r}){if(!n.result)return n;if(Wn(n.result))for(let o=0;o<r.length;o++){let s=r[o];s.type=="address"&&s.name in n.result&&(n.result[s.name]=ht+n.result[s.name].substr(2).toLowerCase())}else Kn(n.result)&&(n.result=n.result.reduce((o,s,i)=>{let{name:a,type:c}=r[i];return c=="address"&&(s=ht+s.substr(2).toLowerCase()),o[a]=s,o},{}));return n}function kg(n,r,o){let s=n.toString();for(;s.length<o;)s=r+s;return s}function yt(n){return n!==null&&typeof n<"u"}async function Og(n=1e3){return new Promise(r=>setTimeout(r,n))}var xd,Dd,an=se(()=>{xd=require("bignumber.js"),Dd=be(require("validator"),1);qt()});function xt(n){let r=new Set;return n.forEach(o=>r.add(o)),Object.freeze(r)}function Sn(n){let r=[],o=c=>{let u=a<n.length?JSON.stringify(n[a]):"$EOI";throw new Error(`invalid token ${u} at ${a}: ${c}`)},s=[],i=[],a=0;for(;a<n.length;){let c=n.substring(a),u=c.match(jg);u&&(a+=u[1].length,c=n.substring(a));let l={depth:s.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};r.push(l);let p=_g[c[0]]||"";if(p){if(l.type=p,l.text=c[0],a++,p==="OPEN_PAREN")s.push(r.length-1),i.push(r.length-1);else if(p=="CLOSE_PAREN")s.length===0&&o("no matching open bracket"),l.match=s.pop(),r[l.match].match=r.length-1,l.depth--,l.linkBack=i.pop(),r[l.linkBack].linkNext=r.length-1;else if(p==="COMMA")l.linkBack=i.pop(),r[l.linkBack].linkNext=r.length-1,i.push(r.length-1);else if(p==="OPEN_BRACKET")l.type="BRACKET";else if(p==="CLOSE_BRACKET"){let A=r.pop().text;if(r.length>0&&r[r.length-1].type==="NUMBER"){let g=r.pop().text;A=g+A,r[r.length-1].value=(0,ve.getNumber)(g)}if(r.length===0||r[r.length-1].type!=="BRACKET")throw new Error("missing opening bracket");r[r.length-1].text+=A}continue}if(u=c.match(Vg),u){if(l.text=u[1],a+=l.text.length,Ug.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(qd)){l.type="TYPE";continue}l.type="ID";continue}if(u=c.match(zg),u){l.text=u[1],l.type="NUMBER",a+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(c[0])} at position ${a}`)}return new fr(r.map(c=>Object.freeze(c)))}function Ud(n,r){let o=[];for(let s in r.keys())n.has(s)&&o.push(s);if(o.length>1)throw new Error(`conflicting types: ${o.join(", ")}`)}function Ni(n,r){if(r.peekKeyword(Kd)){let o=r.pop().text;if(o!==n)throw new Error(`expected ${n}, got ${o}`)}return r.popType("ID")}function un(n,r){let o=new Set;for(;;){let s=n.peekType("KEYWORD");if(s==null||r&&!r.has(s))break;if(n.pop(),o.has(s))throw new Error(`duplicate keywords: ${JSON.stringify(s)}`);o.add(s)}return Object.freeze(o)}function Qd(n){let r=un(n,Eg);return Ud(r,xt("constant payable nonpayable".split(" "))),Ud(r,xt("pure view payable nonpayable".split(" "))),r.has("view")?"view":r.has("pure")?"pure":r.has("payable")?"payable":r.has("nonpayable")?"nonpayable":r.has("constant")?"view":"nonpayable"}function cn(n,r){return n.popParams().map(o=>Dt.from(o,r))}function ep(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return(0,ve.getBigInt)(n.pop().text);throw new Error("invalid gas")}return null}function Qn(n){if(n.length)throw new Error(`unexpected tokens: ${n.toString()}`)}function _d(n){let r=n.match(qd);if((0,ve.assertArgument)(r,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(r[2]){let o=parseInt(r[2]);(0,ve.assertArgument)(o!==0&&o<=32,"invalid bytes length","type",n)}else if(r[3]){let o=parseInt(r[3]);(0,ve.assertArgument)(o!==0&&o<=256&&o%8===0,"invalid numeric width","type",n)}return n}function Ss(n,r){return"("+r.map(o=>o.format(n)).join(n==="full"?", ":",")+")"}var ve,Di,xc,Jd,Eg,Hd,Kd,Xd,xg,Dg,Ng,Ug,_g,jg,zg,Vg,Yd,qd,fr,Gg,Je,Lt,jd,zd,Vd,Gd,Ld,$d,Zd,Dt,eo,Eo,Ar,Xn,Yn,xi,qn,Ws,tp=se(()=>{ve=require("ethers"),Di=require("ethers");Jd="constant external internal payable private public pure view",Eg=xt(Jd.split(" ")),Hd="constructor error event fallback function receive struct",Kd=xt(Hd.split(" ")),Xd="calldata memory storage payable indexed",xg=xt(Xd.split(" ")),Dg="tuple returns",Ng=[Hd,Xd,Dg,Jd].join(" "),Ug=xt(Ng.split(" ")),_g={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},jg=new RegExp("^(\\s*)"),zg=new RegExp("^([0-9]+)"),Vg=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Yd=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),qd=new RegExp("^(trcToken|address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),fr=class{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(r){this.#e=0,this.#t=r.slice()}clone(){return new xc(this.#t)}reset(){this.#e=0}#n(r=0,o=0){return new xc(this.#t.slice(r,o).map(s=>Object.freeze(Object.assign({},s,{match:s.match-r,linkBack:s.linkBack-r,linkNext:s.linkNext-r}))))}popKeyword(r){let o=this.peek();if(o.type!=="KEYWORD"||!r.has(o.text))throw new Error(`expected keyword ${o.text}`);return this.pop().text}popType(r){if(this.peek().type!==r)throw new Error(`expected ${r}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){let r=this.peek();if(r.type!=="OPEN_PAREN")throw new Error("bad start");let o=this.#n(this.#e+1,r.match+1);return this.#e=r.match+1,o}popParams(){let r=this.peek();if(r.type!=="OPEN_PAREN")throw new Error("bad start");let o=[];for(;this.#e<r.match-1;){let s=this.peek().linkNext;o.push(this.#n(this.#e+1,s)),this.#e=s}return this.#e=r.match+1,o}peek(){if(this.#e>=this.#t.length)throw new Error("out-of-bounds");return this.#t[this.#e]}peekKeyword(r){let o=this.peekType("KEYWORD");return o!=null&&r.has(o)?o:null}peekType(r){if(this.length===0)return null;let o=this.peek();return o.type===r?o.text:null}pop(){let r=this.peek();return this.#e++,r}toString(){let r=[];for(let o=this.#e;o<this.#t.length;o++){let s=this.#t[o];r.push(`${s.type}:${s.text}`)}return`<TokenString ${r.join(" ")}>`}};xc=fr;Gg=new RegExp(/^(.*)\[([0-9]*)\]$/);Je={},Lt=Symbol.for("_ethers_internal"),jd="_ParamTypeInternal",zd="_ErrorInternal",Vd="_EventInternal",Gd="_ConstructorInternal",Ld="_FallbackInternal",$d="_FunctionInternal",Zd="_StructInternal",Dt=class n{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(r,o,s,i,a,c,u,l){if((0,ve.assertPrivate)(r,Je,"ParamType"),Object.defineProperty(this,Lt,{value:jd}),c&&(c=Object.freeze(c.slice())),i==="array"){if(u==null||l==null)throw new Error("")}else if(u!=null||l!=null)throw new Error("");if(i==="tuple"){if(c==null)throw new Error("")}else if(c!=null)throw new Error("");(0,ve.defineProperties)(this,{name:o,type:s,baseType:i,indexed:a,components:c,arrayLength:u,arrayChildren:l})}format(r){if(r==null&&(r="sighash"),r==="json"){let s={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(r)))),JSON.stringify(s)}let o="";return this.isArray()?(o+=this.arrayChildren.format(r),o+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(r!=="sighash"&&(o+=this.type),o+="("+this.components.map(s=>s.format(r)).join(r==="full"?", ":",")+")"):o+=this.type,r!=="sighash"&&(this.indexed===!0&&(o+=" indexed"),r==="full"&&this.name&&(o+=" "+this.name)),o}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(r,o){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");return r.map(s=>this.arrayChildren?.walk(s,o))}if(this.isTuple()){if(!Array.isArray(r))throw new Error("invalid tuple value");if(r.length!==this.components.length)throw new Error("array is wrong length");return r.map((s,i)=>this.components?.[i].walk(s,o))}return o(this.type,r)}#e(r,o,s,i){if(this.isArray()){if(!Array.isArray(o))throw new Error("invalid array value");if(this.arrayLength!==-1&&o.length!==this.arrayLength)throw new Error("array is wrong length");let c=this.arrayChildren,u=o.slice();u.forEach((l,p)=>{c.#e(r,l,s,A=>{u[p]=A})}),i(u);return}if(this.isTuple()){let c=this.components,u;if(Array.isArray(o))u=o.slice();else{if(o==null||typeof o!="object")throw new Error("invalid tuple value");u=c.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in o))throw new Error(`missing value for component ${l.name}`);return o[l.name]})}if(u.length!==this.components.length)throw new Error("array is wrong length");u.forEach((l,p)=>{c[p].#e(r,l,s,A=>{u[p]=A})}),i(u);return}let a=s(this.type,o);a.then?r.push(async function(){i(await a)}()):i(a)}async walkAsync(r,o){let s=[],i=[r];return this.#e(s,r,o,a=>{i[0]=a}),s.length&&await Promise.all(s),i[0]}static from(r,o){if(n.isParamType(r))return r;if(typeof r=="string")return n.from(Sn(r),o);if(r instanceof fr){let u="",l="",p=null;un(r,xt(["tuple"])).has("tuple")||r.peekType("OPEN_PAREN")?(l="tuple",p=r.popParams().map(I=>n.from(I)),u=`tuple(${p.map(I=>I.format()).join(",")})`):(u=_d(r.popType("TYPE")),l=u);let A=null,g=null;for(;r.length&&r.peekType("BRACKET");){let I=r.pop();A=new n(Je,"",u,l,null,p,g,A),g=I.value,u+=I.text,l="array",p=null}let P=null;if(un(r,xg).has("indexed")){if(!o)throw new Error("");P=!0}let S=r.peekType("ID")?r.pop().text:"";if(r.length)throw new Error("leftover tokens");return new n(Je,S,u,l,P,p,g,A)}let s=r.name;(0,ve.assertArgument)(!s||typeof s=="string"&&s.match(Yd),"invalid name","obj.name",s);let i=r.indexed;i!=null&&((0,ve.assertArgument)(o,"parameter cannot be indexed","obj.indexed",r.indexed),i=!!i);let a=r.type,c=a.match(Gg);if(c){let u=parseInt(c[2]||"-1"),l=n.from({type:c[1],components:r.components});return new n(Je,s||"",a,"array",i,null,u,l)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){let u=r.components!=null?r.components.map(p=>n.from(p)):null;return new n(Je,s||"",a,"tuple",i,u,null,null)}return a=_d(r.type),new n(Je,s||"",a,a,i,null,null,null)}static isParamType(r){return r&&r[Lt]===jd}},eo=class n{type;inputs;constructor(r,o,s){(0,ve.assertPrivate)(r,Je,"Fragment"),s=Object.freeze(s.slice()),(0,ve.defineProperties)(this,{type:o,inputs:s})}static from(r){if(typeof r=="string"){try{n.from(JSON.parse(r))}catch{}return n.from(Sn(r))}if(r instanceof fr)switch(r.peekKeyword(Kd)){case"constructor":return Yn.from(r);case"error":return Ar.from(r);case"event":return Xn.from(r);case"fallback":case"receive":return xi.from(r);case"function":return qn.from(r);case"struct":return Ws.from(r)}else if(typeof r=="object"){switch(r.type){case"constructor":return Yn.from(r);case"error":return Ar.from(r);case"event":return Xn.from(r);case"fallback":case"receive":return xi.from(r);case"function":return qn.from(r);case"struct":return Ws.from(r)}(0,ve.assert)(!1,`unsupported type: ${r.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}(0,ve.assertArgument)(!1,"unsupported frgament object","obj",r)}static isConstructor(r){return Yn.isFragment(r)}static isError(r){return Ar.isFragment(r)}static isEvent(r){return Xn.isFragment(r)}static isFunction(r){return qn.isFragment(r)}static isStruct(r){return Ws.isFragment(r)}},Eo=class extends eo{name;constructor(r,o,s,i){super(r,o,i),(0,ve.assertArgument)(typeof s=="string"&&s.match(Yd),"invalid identifier","name",s),i=Object.freeze(i.slice()),(0,ve.defineProperties)(this,{name:s})}};Ar=class n extends Eo{constructor(r,o,s){super(r,"error",o,s),Object.defineProperty(this,Lt,{value:zd})}get selector(){return(0,Di.id)(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("error"),o.push(this.name+Ss(r,this.inputs)),o.join(" ")}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){let o=Ni("error",r),s=cn(r);return Qn(r),new n(Je,o,s)}return new n(Je,r.name,r.inputs?r.inputs.map(Dt.from):[])}static isFragment(r){return r&&r[Lt]===zd}},Xn=class n extends Eo{anonymous;constructor(r,o,s,i){super(r,"event",o,s),Object.defineProperty(this,Lt,{value:Vd}),(0,ve.defineProperties)(this,{anonymous:i})}get topicHash(){return(0,Di.id)(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("event"),o.push(this.name+Ss(r,this.inputs)),r!=="sighash"&&this.anonymous&&o.push("anonymous"),o.join(" ")}static getTopicHash(r,o){return o=(o||[]).map(i=>Dt.from(i)),new n(Je,r,o,!1).topicHash}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){let o=Ni("event",r),s=cn(r,!0),i=!!un(r,xt(["anonymous"])).has("anonymous");return Qn(r),new n(Je,o,s,i)}return new n(Je,r.name,r.inputs?r.inputs.map(o=>Dt.from(o,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[Lt]===Vd}},Yn=class n extends eo{payable;gas;constructor(r,o,s,i,a){super(r,o,s),Object.defineProperty(this,Lt,{value:Gd}),(0,ve.defineProperties)(this,{payable:i,gas:a})}format(r){if((0,ve.assert)(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});let o=[`constructor${Ss(r,this.inputs)}`];return o.push(this.payable?"payable":"nonpayable"),this.gas!=null&&o.push(`@${this.gas.toString()}`),o.join(" ")}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){un(r,xt(["constructor"]));let o=cn(r),s=!!un(r,xt(["payable"])).has("payable"),i=ep(r);return Qn(r),new n(Je,"constructor",o,s,i)}return new n(Je,"constructor",r.inputs?r.inputs.map(Dt.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Lt]===Gd}},xi=class n extends eo{payable;constructor(r,o,s){super(r,"fallback",o),Object.defineProperty(this,Lt,{value:Ld}),(0,ve.defineProperties)(this,{payable:s})}format(r){let o=this.inputs.length===0?"receive":"fallback";if(r==="json"){let s=this.payable?"payable":"nonpayable";return JSON.stringify({type:o,stateMutability:s})}return`${o}()${this.payable?" payable":""}`}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){let o=r.toString(),s=r.peekKeyword(xt(["fallback","receive"]));if((0,ve.assertArgument)(s,"type must be fallback or receive","obj",o),r.popKeyword(xt(["fallback","receive"]))==="receive"){let u=cn(r);return(0,ve.assertArgument)(u.length===0,"receive cannot have arguments","obj.inputs",u),un(r,xt(["payable"])),Qn(r),new n(Je,[],!0)}let a=cn(r);a.length?(0,ve.assertArgument)(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(u=>u.format("minimal")).join(", ")):a=[Dt.from("bytes")];let c=Qd(r);if((0,ve.assertArgument)(c==="nonpayable"||c==="payable","fallback cannot be constants","obj.stateMutability",c),un(r,xt(["returns"])).has("returns")){let u=cn(r);(0,ve.assertArgument)(u.length===1&&u[0].type==="bytes","invalid fallback outputs","obj.outputs",u.map(l=>l.format("minimal")).join(", "))}return Qn(r),new n(Je,a,c==="payable")}if(r.type==="receive")return new n(Je,[],!0);if(r.type==="fallback"){let o=[Dt.from("bytes")],s=r.stateMutability==="payable";return new n(Je,o,s)}(0,ve.assertArgument)(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[Lt]===Ld}},qn=class n extends Eo{constant;outputs;stateMutability;payable;gas;constructor(r,o,s,i,a,c){super(r,"function",o,i),Object.defineProperty(this,Lt,{value:$d}),a=Object.freeze(a.slice()),(0,ve.defineProperties)(this,{constant:s==="view"||s==="pure",gas:c,outputs:a,payable:s==="payable",stateMutability:s})}get selector(){return(0,Di.id)(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r))),outputs:this.outputs.map(s=>JSON.parse(s.format(r)))});let o=[];return r!=="sighash"&&o.push("function"),o.push(this.name+Ss(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&o.push(this.stateMutability),this.outputs&&this.outputs.length&&(o.push("returns"),o.push(Ss(r,this.outputs))),this.gas!=null&&o.push(`@${this.gas.toString()}`)),o.join(" ")}static getSelector(r,o){return o=(o||[]).map(i=>Dt.from(i)),new n(Je,r,"view",o,[],null).selector}static from(r){if(n.isFragment(r))return r;if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){let s=Ni("function",r),i=cn(r),a=Qd(r),c=[];un(r,xt(["returns"])).has("returns")&&(c=cn(r));let u=ep(r);return Qn(r),new n(Je,s,a,i,c,u)}let o=r.stateMutability;return o==null&&(o="payable",typeof r.constant=="boolean"?(o="view",r.constant||(o="payable",typeof r.payable=="boolean"&&!r.payable&&(o="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(o="nonpayable")),new n(Je,r.name,o,r.inputs?r.inputs.map(Dt.from):[],r.outputs?r.outputs.map(Dt.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Lt]===$d}},Ws=class n extends Eo{constructor(r,o,s){super(r,"struct",o,s),Object.defineProperty(this,Lt,{value:Zd})}format(){throw new Error("@TODO")}static from(r){if(typeof r=="string")return n.from(Sn(r));if(r instanceof fr){let o=Ni("struct",r),s=cn(r);return Qn(r),new n(Je,o,s)}return new n(Je,r.name,r.inputs?r.inputs.map(Dt.from):[])}static isFragment(r){return r&&r[Lt]===Zd}}});var Dc,Nc,z,Uc,Vc,Ui,_c,jc,zc,_i,rp,np,ji,op=se(()=>{Dc=require("ethers"),Nc=require("ethers"),z=require("ethers"),Uc=require("ethers"),Vc=require("ethers");tp();Ui=require("ethers"),_c=class{fragment;name;signature;topic;args;constructor(r,o,s){let i=r.name,a=r.format();(0,z.defineProperties)(this,{fragment:r,name:i,signature:a,topic:o,args:s})}},jc=class{fragment;name;args;signature;selector;value;constructor(r,o,s,i){let a=r.name,c=r.format();(0,z.defineProperties)(this,{fragment:r,name:a,args:s,signature:c,selector:o,value:i})}},zc=class{fragment;name;args;signature;selector;constructor(r,o,s){let i=r.name,a=r.format();(0,z.defineProperties)(this,{fragment:r,name:i,args:s,signature:a,selector:o})}},_i=class{hash;_isIndexed;static isIndexed(r){return!!(r&&r._isIndexed)}constructor(r){(0,z.defineProperties)(this,{hash:r,_isIndexed:!0})}},rp={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},np={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let r="unknown panic code";return n>=0&&n<=255&&rp[n.toString()]&&(r=rp[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${r})`}}},ji=class n{fragments;deploy;fallback;receive;#e;#t;#n;#r;constructor(r){let o=[];typeof r=="string"?o=JSON.parse(r):o=r,this.#n=new Map,this.#e=new Map,this.#t=new Map;let s=[];for(let c of o)try{s.push(eo.from(c))}catch(u){console.log("EE",u)}(0,z.defineProperties)(this,{fragments:Object.freeze(s)});let i=null,a=!1;this.#r=this.getAbiCoder(),this.fragments.forEach((c,u)=>{let l;switch(c.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}(0,z.defineProperties)(this,{deploy:c});return;case"fallback":c.inputs.length===0?a=!0:((0,z.assertArgument)(!i||c.payable!==i.payable,"conflicting fallback fragments",`fragments[${u}]`,c),i=c,a=i.payable);return;case"function":l=this.#n;break;case"event":l=this.#t;break;case"error":l=this.#e;break;default:return}let p=c.format();l.has(p)||l.set(p,c)}),this.deploy||(0,z.defineProperties)(this,{deploy:Yn.from("constructor()")}),(0,z.defineProperties)(this,{fallback:i,receive:a})}format(r){let o=r?"minimal":"full";return this.fragments.map(i=>i.format(o))}formatJson(){let r=this.fragments.map(o=>o.format("json"));return JSON.stringify(r.map(o=>JSON.parse(o)))}getAbiCoder(){return Uc.AbiCoder.defaultAbiCoder()}#o(r,o,s){if((0,z.isHexString)(r)){let a=r.toLowerCase();for(let c of this.#n.values())if(a===c.selector)return c;return null}if(r.indexOf("(")===-1){let a=[];for(let[c,u]of this.#n)c.split("(")[0]===r&&a.push(u);if(o){let c=o.length>0?o[o.length-1]:null,u=o.length,l=!0;Ui.Typed.isTyped(c)&&c.type==="overrides"&&(l=!1,u--);for(let p=a.length-1;p>=0;p--){let A=a[p].inputs.length;A!==u&&(!l||A!==u-1)&&a.splice(p,1)}for(let p=a.length-1;p>=0;p--){let A=a[p].inputs;for(let g=0;g<o.length;g++)if(Ui.Typed.isTyped(o[g])){if(g>=A.length){if(o[g].type==="overrides")continue;a.splice(p,1);break}if(o[g].type!==A[g].baseType){a.splice(p,1);break}}}}if(a.length===1&&o&&o.length!==a[0].inputs.length){let c=o[o.length-1];(c==null||Array.isArray(c)||typeof c!="object")&&a.splice(0,1)}if(a.length===0)return null;if(a.length>1&&s){let c=a.map(u=>JSON.stringify(u.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous function description (i.e. matches ${c})`,"key",r)}return a[0]}let i=this.#n.get(qn.from(r).format());return i||null}getFunctionName(r){let o=this.#o(r,null,!1);return(0,z.assertArgument)(o,"no matching function","key",r),o.name}hasFunction(r){return!!this.#o(r,null,!1)}getFunction(r,o){return this.#o(r,o||null,!0)}forEachFunction(r){let o=Array.from(this.#n.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#n.get(i),s)}}#s(r,o,s){if((0,z.isHexString)(r)){let a=r.toLowerCase();for(let c of this.#t.values())if(a===c.topicHash)return c;return null}if(r.indexOf("(")===-1){let a=[];for(let[c,u]of this.#t)c.split("(")[0]===r&&a.push(u);if(o){for(let c=a.length-1;c>=0;c--)a[c].inputs.length<o.length&&a.splice(c,1);for(let c=a.length-1;c>=0;c--){let u=a[c].inputs;for(let l=0;l<o.length;l++)if(Ui.Typed.isTyped(o[l])&&o[l].type!==u[l].baseType){a.splice(c,1);break}}}if(a.length===0)return null;if(a.length>1&&s){let c=a.map(u=>JSON.stringify(u.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous event description (i.e. matches ${c})`,"key",r)}return a[0]}let i=this.#t.get(Xn.from(r).format());return i||null}getEventName(r){let o=this.#s(r,null,!1);return(0,z.assertArgument)(o,"no matching event","key",r),o.name}hasEvent(r){return!!this.#s(r,null,!1)}getEvent(r,o){return this.#s(r,o||null,!0)}forEachEvent(r){let o=Array.from(this.#t.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#t.get(i),s)}}getError(r,o){if((0,z.isHexString)(r)){let i=r.toLowerCase();if(np[i])return Ar.from(np[i].signature);for(let a of this.#e.values())if(i===a.selector)return a;return null}if(r.indexOf("(")===-1){let i=[];for(let[a,c]of this.#e)a.split("(")[0]===r&&i.push(c);if(i.length===0)return r==="Error"?Ar.from("error Error(string)"):r==="Panic"?Ar.from("error Panic(uint256)"):null;if(i.length>1){let a=i.map(c=>JSON.stringify(c.format())).join(", ");(0,z.assertArgument)(!1,`ambiguous error description (i.e. ${a})`,"name",r)}return i[0]}if(r=Ar.from(r).format(),r==="Error(string)")return Ar.from("error Error(string)");if(r==="Panic(uint256)")return Ar.from("error Panic(uint256)");let s=this.#e.get(r);return s||null}forEachError(r){let o=Array.from(this.#e.keys());o.sort((s,i)=>s.localeCompare(i));for(let s=0;s<o.length;s++){let i=o[s];r(this.#e.get(i),s)}}_decodeParams(r,o){return this.#r.decode(r,o)}_encodeParams(r,o){return this.#r.encode(r,o)}encodeDeploy(r){return this._encodeParams(this.deploy.inputs,r||[])}decodeErrorResult(r,o){if(typeof r=="string"){let s=this.getError(r);(0,z.assertArgument)(s,"unknown error","fragment",r),r=s}return(0,z.assertArgument)((0,z.dataSlice)(o,0,4)===r.selector,`data signature does not match error ${r.name}.`,"data",o),this._decodeParams(r.inputs,(0,z.dataSlice)(o,4))}encodeErrorResult(r,o){if(typeof r=="string"){let s=this.getError(r);(0,z.assertArgument)(s,"unknown error","fragment",r),r=s}return(0,z.concat)([r.selector,this._encodeParams(r.inputs,o||[])])}decodeFunctionData(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.assertArgument)((0,z.dataSlice)(o,0,4)===r.selector,`data signature does not match function ${r.name}.`,"data",o),this._decodeParams(r.inputs,(0,z.dataSlice)(o,4))}encodeFunctionData(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.concat)([r.selector,this._encodeParams(r.inputs,o||[])])}decodeFunctionResult(r,o){if(typeof r=="string"){let a=this.getFunction(r);(0,z.assertArgument)(a,"unknown function","fragment",r),r=a}let s="invalid length for result data",i=(0,z.getBytesCopy)(o);if(i.length%32===0)try{return this.#r.decode(r.outputs,i)}catch{s="could not decode result data"}(0,z.assert)(!1,s,"BAD_DATA",{value:(0,z.hexlify)(i),info:{method:r.name,signature:r.format()}})}makeError(r,o){let s=(0,z.getBytes)(r,"data"),i=Uc.AbiCoder.getBuiltinCallException("call",o,s);if(i.message.startsWith("execution reverted (unknown custom error)")){let u=(0,z.hexlify)(s.slice(0,4)),l=this.getError(u);if(l)try{let p=this.#r.decode(l.inputs,s.slice(4));i.revert={name:l.name,signature:l.format(),args:p},i.reason=i.revert.signature,i.message=`execution reverted: ${i.reason}`}catch{i.message="execution reverted (coult not decode custom error)"}}let c=this.parseTransaction(o);return c&&(i.invocation={method:c.name,signature:c.signature,args:c.args}),i}encodeFunctionResult(r,o){if(typeof r=="string"){let s=this.getFunction(r);(0,z.assertArgument)(s,"unknown function","fragment",r),r=s}return(0,z.hexlify)(this.#r.encode(r.outputs,o||[]))}encodeFilterTopics(r,o){if(typeof r=="string"){let a=this.getEvent(r);(0,z.assertArgument)(a,"unknown event","eventFragment",r),r=a}(0,z.assert)(o.length<=r.inputs.length,`too many arguments for ${r.format()}`,"UNEXPECTED_ARGUMENT",{count:o.length,expectedCount:r.inputs.length});let s=[];r.anonymous||s.push(r.topicHash);let i=(a,c)=>a.type==="string"?(0,Nc.id)(c):a.type==="bytes"?(0,Dc.keccak256)((0,z.hexlify)(c)):(a.type==="bool"&&typeof c=="boolean"&&(c=c?"0x01":"0x00"),a.type.match(/^u?int/)&&(c=(0,z.toBeHex)(c)),a.type==="address"&&this.#r.encode(["address"],[c]),(0,z.zeroPadValue)((0,z.hexlify)(c),32));for(o.forEach((a,c)=>{let u=r.inputs[c];if(!u.indexed){(0,z.assertArgument)(a==null,"cannot filter non-indexed parameters; must be null","contract."+u.name,a);return}a==null?s.push(null):u.baseType==="array"||u.baseType==="tuple"?(0,z.assertArgument)(!1,"filtering with tuples or arrays not supported","contract."+u.name,a):Array.isArray(a)?s.push(a.map(l=>i(u,l))):s.push(i(u,a))});s.length&&s[s.length-1]===null;)s.pop();return s}encodeEventLog(r,o){if(typeof r=="string"){let c=this.getEvent(r);(0,z.assertArgument)(c,"unknown event","eventFragment",r),r=c}let s=[],i=[],a=[];return r.anonymous||s.push(r.topicHash),(0,z.assertArgument)(o.length===r.inputs.length,"event arguments/values mismatch","values",o),r.inputs.forEach((c,u)=>{let l=o[u];if(c.indexed)if(c.type==="string")s.push((0,Nc.id)(l));else if(c.type==="bytes")s.push((0,Dc.keccak256)(l));else{if(c.baseType==="tuple"||c.baseType==="array")throw new Error("not implemented");s.push(this.#r.encode([c.type],[l]))}else i.push(c),a.push(l)}),{data:this.#r.encode(i,a),topics:s}}decodeEventLog(r,o,s){if(typeof r=="string"){let b=this.getEvent(r);(0,z.assertArgument)(b,"unknown event","eventFragment",r),r=b}if(s!=null&&!r.anonymous){let b=r.topicHash;(0,z.assertArgument)((0,z.isHexString)(s[0],32)&&s[0].toLowerCase()===b,"fragment/topic mismatch","topics[0]",s[0]),s=s.slice(1)}let i=[],a=[],c=[];r.inputs.forEach((b,S)=>{b.indexed?b.type==="string"||b.type==="bytes"||b.baseType==="tuple"||b.baseType==="array"?(i.push(Dt.from({type:"bytes32",name:b.name})),c.push(!0)):(i.push(b),c.push(!1)):(a.push(b),c.push(!1))});let u=s!=null?this.#r.decode(i,(0,z.concat)(s)):null,l=this.#r.decode(a,o,!0),p=[],A=[],g=0,P=0;return r.inputs.forEach((b,S)=>{let I=null;if(b.indexed)if(u==null)I=new _i(null);else if(c[S])I=new _i(u[P++]);else try{I=u[P++]}catch(F){I=F}else try{I=l[g++]}catch(F){I=F}p.push(I),A.push(b.name||null)}),Vc.Result.fromItems(p,A)}parseTransaction(r){let o=(0,z.getBytes)(r.data,"tx.data"),s=(0,z.getBigInt)(r.value!=null?r.value:0,"tx.value"),i=this.getFunction((0,z.hexlify)(o.slice(0,4)));if(!i)return null;let a=this.#r.decode(i.inputs,o.slice(4));return new jc(i,i.selector,a,s)}parseCallResult(r){throw new Error("@TODO")}parseLog(r){let o=this.getEvent(r.topics[0]);return!o||o.anonymous?null:new _c(o,o.topicHash,this.decodeEventLog(o,r.data,r.topics))}parseError(r){let o=(0,z.hexlify)(r),s=this.getError((0,z.dataSlice)(o,0,4));if(!s)return null;let i=this.#r.decode(s.inputs,(0,z.dataSlice)(o,4));return new zc(s,s.selector,i)}static from(r){return r instanceof n?r:typeof r=="string"?new n(JSON.parse(r)):typeof r.format=="function"?new n(r.format("json")):new n(r)}}});var $c={};Gt($c,{AbiCoder:()=>k.AbiCoder,FormatTypes:()=>$g,Interface:()=>ji,Mnemonic:()=>k.Mnemonic,Signature:()=>k.Signature,SigningKey:()=>k.SigningKey,Wordlist:()=>k.Wordlist,arrayify:()=>Lc,concat:()=>k.concat,ethersHDNodeWallet:()=>k.HDNodeWallet,id:()=>k.id,isValidMnemonic:()=>Zg,joinSignature:()=>Gc,keccak256:()=>k.keccak256,recoverAddress:()=>k.recoverAddress,sha256:()=>k.sha256,splitSignature:()=>Lg,toUtf8Bytes:()=>k.toUtf8Bytes,toUtf8String:()=>k.toUtf8String,wordlists:()=>k.wordlists});var k,Lg,Gc,Lc,$g,Zg,Qt=se(()=>{k=require("ethers");op();Lg=n=>k.Signature.from(n),Gc=n=>k.Signature.from(n).serialized,Lc=n=>(0,k.getBytes)(n),$g={sighash:"sighash",minimal:"minimal",full:"full",json:"json"},Zg=k.Mnemonic.isValidMnemonic;k.computeHmac.register((n,r,o)=>k.computeHmac._(n,Buffer.from(r),Buffer.from(o)))});var Yc={};Gt(Yc,{ADDRESS_PREFIX:()=>ht,ADDRESS_PREFIX_BYTE:()=>Jc,ADDRESS_PREFIX_REGEX:()=>ln,ADDRESS_SIZE:()=>Zc,TRON_BIP39_PATH_INDEX_0:()=>zi,TRON_BIP39_PATH_PREFIX:()=>sp,fromHex:()=>Hc,fromPrivateKey:()=>Xc,isAddress:()=>to,isChecksumAddress:()=>Kc,toChecksumAddress:()=>Vi,toHex:()=>L});function Hc(n){return Jr(n)?wr(it(n.replace(/^0x/,ht))):n}function L(n){return Jr(n)?n.toLowerCase().replace(/^0x/,ht):Ae(qc(n)).toLowerCase()}function Jg(n){n=n.toLowerCase();let r=n.substring(2).split(""),o=new Uint8Array(40);for(let i=0;i<40;i++)o[i]=r[i].charCodeAt(0);let s=it((0,k.keccak256)(o).slice(2));for(let i=0;i<40;i+=2)s[i>>1]>>4>=8&&(r[i]=r[i].toUpperCase()),(s[i>>1]&15)>=8&&(r[i+1]=r[i+1].toUpperCase());return ht+r.join("")}function Vi(n){if(!to(n))throw new Error(`'${n}' is not a valid address string`);return Jg(L(n))}function Kc(n){if(!Jr(n)||n.length!==42)return!1;try{return Vi(n)===n}catch{return!1}}function Xc(n,r=!1){try{return xo(n,r)}catch{return!1}}function to(n){if(!n||!at(n))return!1;if(n.length===42)try{return to(wr(it(n)))}catch{return!1}try{return Qc(n)}catch{return!1}}var Zc,ht,Jc,ln,sp,zi,qt=se(()=>{Hn();vn();an();Qt();Zc=34,ht="41",Jc=65,ln=/^(41)/,sp="m/44'/195'",zi=sp+"/0'/0/0"});var nu={};Gt(nu,{decode58:()=>Is,encode58:()=>ru});function ru(n){if(n.length===0)return"";let r,o,s=[0];for(r=0;r<n.length;r++){for(o=0;o<s.length;o++)s[o]<<=8;s[0]+=n[r];let i=0;for(o=0;o<s.length;++o)s[o]+=i,i=s[o]/vs|0,s[o]%=vs;for(;i;)s.push(i%vs),i=i/vs|0}for(r=0;n[r]===0&&r<n.length-1;r++)s.push(0);return s.reverse().map(i=>eu[i]).join("")}function Is(n){if(n.length===0)return[];let r,o,s=[0];for(r=0;r<n.length;r++){let i=n[r];if(!(i in tu))throw new Error("Non-base58 character");for(o=0;o<s.length;o++)s[o]*=vs;s[0]+=tu[i];let a=0;for(o=0;o<s.length;++o)s[o]+=a,a=s[o]>>8,s[o]&=255;for(;a;)s.push(a&255),a>>=8}for(r=0;n[r]==="1"&&r<n.length-1;r++)s.push(0);return s.reverse()}var eu,tu,vs,Gi=se(()=>{eu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",tu={};for(let n=0;n<eu.length;n++)tu[eu.charAt(n)]=n;vs=58});var ip,ro,ap=se(()=>{ip=be(require("axios"),1);an();ro=class{host;timeout;user;password;headers;statusPage;instance;constructor(r,o=3e4,s="",i="",a={},c="/"){if(!Bs(r))throw new Error("Invalid URL provided to HttpProvider");if(isNaN(o)||o<0)throw new Error("Invalid timeout duration provided");if(!Wn(a))throw new Error("Invalid headers object provided");r=r.replace(/\/+$/,""),this.host=r,this.timeout=o,this.user=s,this.password=i,this.headers=a,this.statusPage=c,this.instance=ip.default.create({baseURL:r,timeout:o,headers:a,auth:s?{username:s,password:i}:void 0})}setStatusPage(r="/"){this.statusPage=r}async isConnected(r=this.statusPage){return this.request(r).then(o=>Oc(o,"blockID","block_header")).catch(()=>!1)}request(r,o={},s="get"){return s=s.toLowerCase(),this.instance.request({data:s=="post"&&Object.keys(o).length?o:null,params:s=="get"&&o,url:r,method:s}).then(({data:i})=>i)}}});var bt,Li=se(()=>{ap();bt={HttpProvider:ro}});var su={};Gt(su,{decodeParams:()=>Hg,decodeParamsV2ByABI:()=>ou,encodeParams:()=>Kg,encodeParamsV2ByABI:()=>Do});function cp(n){return ie.address.toHex(n).replace(ln,"0x")}function Hg(n,r,o,s=!1){if(s&&o.replace(/^0x/,"").length%64===8&&(o="0x"+o.replace(/^0x/,"").substring(8)),o.replace(/^0x/,"").length%64)throw new Error("The encoded string is not valid. Its length must be a multiple of 64.");return r=r.map(i=>(/trcToken/.test(i)&&(i=i.replace(/trcToken/,"uint256")),i)),$i.decode(r,o).reduce((i,a,c)=>(r[c]=="address"&&(a=ht+a.substr(2).toLowerCase()),n.length?i[n[c]]=a:i.push(a),i),n.length?{}:[])}function Kg(n,r){for(let o=0;o<n.length;o++)n[o]==="address"&&(r[o]=ie.address.toHex(r[o]).replace(ln,"0x"));return $i.encode(n,r)}function Ms(n){let r=n.match(/([a-zA-Z0-9])(\[.*\])/);return r?r[2]:""}function up(n){return(Ms(n).match(/\]\[/g)||[]).length+1}function Do(n,r){let o=[],s=l=>l&&l.type.indexOf("tuple")===0&&l.components?`tuple(${l.components.map(A=>s(A)).join(",")})${Ms(l.type)}`:/trcToken/.test(l.type)?l.type.replace(/trcToken/,"uint256"):l.type,i=l=>{for(let p=0;p<l.length;p++){let A=l[p];/trcToken/.test(A)&&(l[p]=A.replace(/trcToken/,"uint256"))}},a=l=>Array.isArray(l)?(l.forEach((p,A)=>{l[A]=a(p)}),l):cp(l),c=(l,p,A)=>{A>1?p.length&&p.forEach(g=>{c(l,g,A-1)}):p.length&&A&&p.forEach(g=>{u(l,g)})},u=(l=[],p)=>{l.length&&l.forEach((A,g)=>{let P=A.type;if(p[g]){if(P==="address")p[g]=cp(p[g]);else if(P.match(/^([^\x5b]*)(\x5b|$)/)[0]==="address[")a(p[g]);else if(P.indexOf("tuple")===0)if(Ms(P)){let b=up(P);c(A.components,p[g],b)}else u(A.components,p[g])}})};if(n.inputs&&n.inputs.length)for(let l=0;l<n.inputs.length;l++){let p=n.inputs[l].type;p==="bool"&&r[l]==="false"&&(r[l]=!1),o.push(p.indexOf("tuple")===0?s(n.inputs[l]):p),r.length<o.length&&r.push("")}return u(n.inputs,r),i(o),$i.encode(o,r)}function ou(n,r){let o=u=>{for(let l=0;l<u.length;l++){let p=u[l];/^trcToken/.test(p)&&(u[l]=p.replace(/^trcToken/,"uint256"))}},s=u=>Array.isArray(u)?(u.forEach((l,p)=>{u[p]=s(l)}),u):ie.address.toHex(u),i=(u,l,p)=>{p>1?l.length&&l.forEach(A=>{i(u,A,p-1)}):l.length&&p&&l.forEach(A=>{c(u,A)})},a=u=>{let l=u.name?` ${u.name}`:"";return u&&u.type.indexOf("tuple")===0&&u.components?`tuple(${u.components.map(A=>a(A)).join(",")})${Ms(u.type)}${l}`:/trcToken/.test(u.type)?u.type.replace(/trcToken/,"uint256")+l:u.type+l},c=(u,l)=>{u.length&&u.forEach((p,A)=>{let{type:g,name:P}=p;if(l[A])if(g==="address")l[A]=ie.address.toHex(l[A]),P&&(l[P]=ie.address.toHex(l[A]));else if(g.match(/^([^\x5b]*)(\x5b|$)/)[0]==="address[")s(l[A]),P&&(l[P]=s(l[A]));else if(g.indexOf("tuple")===0){if(Ms(g)){let b=up(g);i(p.components,l[A],b)}else c(p.components,l[A]);P&&(l[P]=l[A])}else P&&(l[P]=l[A]);else P&&(l[P]=l[A])})};if("outputs"in n&&n.outputs&&n.outputs.length>0){let u=[];for(let A=0;A<n.outputs.length;A++){let g=n.outputs[A].type,P=n.outputs[A].name?` ${n.outputs[A].name}`:"";u.push(g.indexOf("tuple")===0?a(n.outputs[A]):g+P)}o(u),(!r||!r.length)&&(r=new Uint8Array(32*n.outputs.length));let p=$i.decode(u,r).toArray(!0);return c(n.outputs,p),p}return[]}var $i,Rs=se(()=>{Qt();Cr();qt();$i=new k.AbiCoder});var No,iu=se(()=>{qt();an();No=class{invalid(r){return r.msg||`Invalid ${r.name}${r.type==="address"?" address":""} provided`}notPositive(r){return`${r.name} must be a positive integer`}notEqual(r){return r.msg||`${r.names?.[0]} can not be equal to ${r.names?.[1]}`}notValid(r){let o={},s=!1;for(let i of r){let{name:a,names:c,value:u,type:l,gt:p,lt:A,gte:g,lte:P,optional:b}=i;if(!(b&&(!yt(u)||l!=="boolean"&&u===!1))){switch(o[a]=i.value,l){case"address":to(u)?o[a]=L(u):s=!0;break;case"integer":(!Hr(u)||typeof p=="number"&&u<=p||typeof A=="number"&&u>=A||typeof g=="number"&&u<g||typeof P=="number"&&u>P)&&(s=!0);break;case"positive-integer":if(!Hr(u)||u<=0)throw new Error(this.notPositive(i));break;case"tokenId":(!at(u)||!u.length)&&(s=!0);break;case"notEmptyObject":(!Wn(u)||!Object.keys(u).length)&&(s=!0);break;case"notEqual":if(c&&o[c[0]]===o[c[1]])throw new Error(this.notEqual(i));break;case"resource":["BANDWIDTH","ENERGY"].includes(u)||(s=!0);break;case"url":Bs(u)||(s=!0);break;case"hex":Jr(u)||(s=!0);break;case"array":Array.isArray(u)||(s=!0);break;case"not-empty-string":(!at(u)||!u.length)&&(s=!0);break;case"boolean":kc(u)||(s=!0);break;case"string":(!at(u)||typeof p=="number"&&u.length<=p||typeof A=="number"&&u.length>=A||typeof g=="number"&&u.length<g||typeof P=="number"&&u.length>P)&&(s=!0);break}if(s)throw new Error(this.invalid(i))}}return!1}}});var pe,au,cu,uu=se(()=>{(function(n){n.AccountCreateContract="AccountCreateContract",n.TransferContract="TransferContract",n.TransferAssetContract="TransferAssetContract",n.VoteAssetContract="VoteAssetContract",n.VoteWitnessContract="VoteWitnessContract",n.WitnessCreateContract="WitnessCreateContract",n.AssetIssueContract="AssetIssueContract",n.WitnessUpdateContract="WitnessUpdateContract",n.ParticipateAssetIssueContract="ParticipateAssetIssueContract",n.AccountUpdateContract="AccountUpdateContract",n.FreezeBalanceContract="FreezeBalanceContract",n.UnfreezeBalanceContract="UnfreezeBalanceContract",n.CancelAllUnfreezeV2Contract="CancelAllUnfreezeV2Contract",n.WithdrawBalanceContract="WithdrawBalanceContract",n.UnfreezeAssetContract="UnfreezeAssetContract",n.UpdateAssetContract="UpdateAssetContract",n.ProposalCreateContract="ProposalCreateContract",n.ProposalApproveContract="ProposalApproveContract",n.ProposalDeleteContract="ProposalDeleteContract",n.SetAccountIdContract="SetAccountIdContract",n.CustomContract="CustomContract",n.CreateSmartContract="CreateSmartContract",n.TriggerSmartContract="TriggerSmartContract",n.GetContract="GetContract",n.UpdateSettingContract="UpdateSettingContract",n.ExchangeCreateContract="ExchangeCreateContract",n.ExchangeInjectContract="ExchangeInjectContract",n.ExchangeWithdrawContract="ExchangeWithdrawContract",n.ExchangeTransactionContract="ExchangeTransactionContract",n.UpdateEnergyLimitContract="UpdateEnergyLimitContract",n.AccountPermissionUpdateContract="AccountPermissionUpdateContract",n.ClearABIContract="ClearABIContract",n.UpdateBrokerageContract="UpdateBrokerageContract",n.ShieldedTransferContract="ShieldedTransferContract",n.MarketSellAssetContract="MarketSellAssetContract",n.MarketCancelOrderContract="MarketCancelOrderContract",n.FreezeBalanceV2Contract="FreezeBalanceV2Contract",n.UnfreezeBalanceV2Contract="UnfreezeBalanceV2Contract",n.WithdrawExpireUnfreezeContract="WithdrawExpireUnfreezeContract",n.DelegateResourceContract="DelegateResourceContract",n.UnDelegateResourceContract="UnDelegateResourceContract",n.UNRECOGNIZED="UNRECOGNIZED"})(pe||(pe={}));(function(n){n[n.Owner=0]="Owner",n[n.Witness=1]="Witness",n[n.Active=2]="Active",n[n.UNRECOGNIZED=-1]="UNRECOGNIZED"})(au||(au={}));(function(n){n[n.Normal=0]="Normal",n[n.AssetIssue=1]="AssetIssue",n[n.Contract=2]="Contract",n[n.UNRECOGNIZED=-1]="UNRECOGNIZED"})(cu||(cu={}))});var mr=Ot(Tt=>{var fu=typeof Object.defineProperties=="function"?Object.defineProperty:function(n,r,o){n!=Array.prototype&&n!=Object.prototype&&(n[r]=o.value)},no=typeof window<"u"&&window===Tt?Tt:typeof global<"u"&&global!=null?global:Tt;function Xg(n,r){if(r){var o=no;n=n.split(".");for(var s=0;s<n.length-1;s++){var i=n[s];i in o||(o[i]={}),o=o[i]}n=n[n.length-1],s=o[n],r=r(s),r!=s&&r!=null&&fu(o,n,{configurable:!0,writable:!0,value:r})}}function Yg(n){var r=0;return function(){return r<n.length?{done:!1,value:n[r++]}:{done:!0}}}function mp(){mp=function(){},no.Symbol||(no.Symbol=qg)}function gp(n,r){this.a=n,fu(this,"description",{configurable:!0,writable:!0,value:r})}gp.prototype.toString=function(){return this.a};var qg=function(){function n(o){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return new gp("jscomp_symbol_"+(o||"")+"_"+r++,o)}var r=0;return n}();function mu(){mp();var n=no.Symbol.iterator;n||(n=no.Symbol.iterator=no.Symbol("Symbol.iterator")),typeof Array.prototype[n]!="function"&&fu(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return Qg(Yg(this))}}),mu=function(){}}function Qg(n){return mu(),n={next:n},n[no.Symbol.iterator]=function(){return this},n}function eh(n,r){mu(),n instanceof String&&(n+="");var o=0,s={next:function(){if(o<n.length){var i=o++;return{value:r(i,n[i]),done:!1}}return s.next=function(){return{done:!0,value:void 0}},s.next()}};return s[Symbol.iterator]=function(){return s},s}Xg("Array.prototype.entries",function(n){return n||function(){return eh(this,function(r,o){return[r,o]})}});var th=Tt||self;function V(n,r,o){n=n.split("."),o=o||th,n[0]in o||typeof o.execScript>"u"||o.execScript("var "+n[0]);for(var s;n.length&&(s=n.shift());)n.length||r===void 0?o[s]&&o[s]!==Object.prototype[s]?o=o[s]:o=o[s]={}:o[s]=r}function dn(n){var r=typeof n;if(r=="object")if(n){if(n instanceof Array)return"array";if(n instanceof Object)return r;var o=Object.prototype.toString.call(n);if(o=="[object Window]")return"object";if(o=="[object Array]"||typeof n.length=="number"&&typeof n.splice<"u"&&typeof n.propertyIsEnumerable<"u"&&!n.propertyIsEnumerable("splice"))return"array";if(o=="[object Function]"||typeof n.call<"u"&&typeof n.propertyIsEnumerable<"u"&&!n.propertyIsEnumerable("call"))return"function"}else return"null";else if(r=="function"&&typeof n.call>"u")return"object";return r}function lp(n){var r=typeof n;return r=="object"&&n!=null||r=="function"}function rh(n,r,o){V(n,r,o)}function nh(n,r){function o(){}o.prototype=r.prototype,n.prototype=new o,n.prototype.constructor=n}var dp="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function oh(n,r){for(var o,s,i=1;i<arguments.length;i++){s=arguments[i];for(o in s)n[o]=s[o];for(var a=0;a<dp.length;a++)o=dp[a],Object.prototype.hasOwnProperty.call(s,o)&&(n[o]=s[o])}}var sh=Array.prototype.forEach?function(n,r){Array.prototype.forEach.call(n,r,void 0)}:function(n,r){for(var o=n.length,s=typeof n=="string"?n.split(""):n,i=0;i<o;i++)i in s&&r.call(void 0,s[i],i,n)},xs=Array.prototype.map?function(n,r){return Array.prototype.map.call(n,r,void 0)}:function(n,r){for(var o=n.length,s=Array(o),i=typeof n=="string"?n.split(""):n,a=0;a<o;a++)a in i&&(s[a]=r.call(void 0,i[a],a,n));return s};function ih(n,r,o){return 2>=arguments.length?Array.prototype.slice.call(n,r):Array.prototype.slice.call(n,r,o)}function Ji(n,r,o,s){var i="Assertion failed";if(o){i+=": "+o;var a=s}else n&&(i+=": "+n,a=r);throw Error(i,a||[])}function W(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];return n||Ji("",null,r,s),n}function ah(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];typeof n!="string"&&Ji("Expected string but got %s: %s.",[dn(n),n],r,s)}function ch(n,r,o){for(var s=[],i=2;i<arguments.length;++i)s[i-2]=arguments[i];Array.isArray(n)||Ji("Expected array but got %s: %s.",[dn(n),n],r,s)}function ct(n,r){for(var o=[],s=1;s<arguments.length;++s)o[s-1]=arguments[s];throw Error("Failure"+(n?": "+n:""),o)}function Wr(n,r,o,s){for(var i=[],a=3;a<arguments.length;++a)i[a-3]=arguments[a];n instanceof r||Ji("Expected instanceof %s but got %s.",[pp(r),pp(n)],o,i)}function pp(n){return n instanceof Function?n.displayName||n.name||"unknown type name":n instanceof Object?n.constructor.displayName||n.constructor.name||Object.prototype.toString.call(n):n===null?"null":typeof n}function ee(n,r){if(this.c=n,this.b=r,this.a={},this.arrClean=!0,0<this.c.length){for(n=0;n<this.c.length;n++){r=this.c[n];var o=r[0];this.a[o.toString()]=new hp(o,r[1])}this.arrClean=!0}}V("jspb.Map",ee,void 0);ee.prototype.g=function(){if(this.arrClean){if(this.b){var n=this.a,r;for(r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var o=n[r].a;o&&o.g()}}}else{for(this.c.length=0,n=In(this),n.sort(),r=0;r<n.length;r++){var s=this.a[n[r]];(o=s.a)&&o.g(),this.c.push([s.key,s.value])}this.arrClean=!0}return this.c};ee.prototype.toArray=ee.prototype.g;ee.prototype.Mc=function(n,r){for(var o=this.g(),s=[],i=0;i<o.length;i++){var a=this.a[o[i][0].toString()];_o(this,a);var c=a.a;c?(W(r),s.push([a.key,r(n,c)])):s.push([a.key,a.value])}return s};ee.prototype.toObject=ee.prototype.Mc;ee.fromObject=function(n,r,o){r=new ee([],r);for(var s=0;s<n.length;s++){var i=n[s][0],a=o(n[s][1]);r.set(i,a)}return r};function Ds(n){this.a=0,this.b=n}Ds.prototype.next=function(){return this.a<this.b.length?{done:!1,value:this.b[this.a++]}:{done:!0,value:void 0}};typeof Symbol<"u"&&(Ds.prototype[Symbol.iterator]=function(){return this});ee.prototype.Jb=function(){return In(this).length};ee.prototype.getLength=ee.prototype.Jb;ee.prototype.clear=function(){this.a={},this.arrClean=!1};ee.prototype.clear=ee.prototype.clear;ee.prototype.Cb=function(n){n=n.toString();var r=this.a.hasOwnProperty(n);return delete this.a[n],this.arrClean=!1,r};ee.prototype.del=ee.prototype.Cb;ee.prototype.Eb=function(){var n=[],r=In(this);r.sort();for(var o=0;o<r.length;o++){var s=this.a[r[o]];n.push([s.key,s.value])}return n};ee.prototype.getEntryList=ee.prototype.Eb;ee.prototype.entries=function(){var n=[],r=In(this);r.sort();for(var o=0;o<r.length;o++){var s=this.a[r[o]];n.push([s.key,_o(this,s)])}return new Ds(n)};ee.prototype.entries=ee.prototype.entries;ee.prototype.keys=function(){var n=[],r=In(this);r.sort();for(var o=0;o<r.length;o++)n.push(this.a[r[o]].key);return new Ds(n)};ee.prototype.keys=ee.prototype.keys;ee.prototype.values=function(){var n=[],r=In(this);r.sort();for(var o=0;o<r.length;o++)n.push(_o(this,this.a[r[o]]));return new Ds(n)};ee.prototype.values=ee.prototype.values;ee.prototype.forEach=function(n,r){var o=In(this);o.sort();for(var s=0;s<o.length;s++){var i=this.a[o[s]];n.call(r,_o(this,i),i.key,this)}};ee.prototype.forEach=ee.prototype.forEach;ee.prototype.set=function(n,r){var o=new hp(n);return this.b?(o.a=r,o.value=r.g()):o.value=r,this.a[n.toString()]=o,this.arrClean=!1,this};ee.prototype.set=ee.prototype.set;function _o(n,r){return n.b?(r.a||(r.a=new n.b(r.value)),r.a):r.value}ee.prototype.get=function(n){if(n=this.a[n.toString()])return _o(this,n)};ee.prototype.get=ee.prototype.get;ee.prototype.has=function(n){return n.toString()in this.a};ee.prototype.has=ee.prototype.has;ee.prototype.Jc=function(n,r,o,s,i){var a=In(this);a.sort();for(var c=0;c<a.length;c++){var u=this.a[a[c]];r.Va(n),o.call(r,1,u.key),this.b?s.call(r,2,_o(this,u),i):s.call(r,2,u.value),r.Ya()}};ee.prototype.serializeBinary=ee.prototype.Jc;ee.deserializeBinary=function(n,r,o,s,i,a,c){for(;r.oa()&&!r.bb();){var u=r.c;u==1?a=o.call(r):u==2&&(n.b?(W(i),c||(c=new n.b),s.call(r,c,i)):c=s.call(r))}W(a!=null),W(c!=null),n.set(a,c)};function In(n){n=n.a;var r=[],o;for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&r.push(o);return r}function hp(n,r){this.key=n,this.value=r,this.a=void 0}function yp(n){if(8192>=n.length)return String.fromCharCode.apply(null,n);for(var r="",o=0;o<n.length;o+=8192)r+=String.fromCharCode.apply(null,ih(n,o,o+8192));return r}var lu={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},Zi={"'":"\\'"},bp={},Fs=null;function Tp(n,r){r===void 0&&(r=0),wp(),r=bp[r];for(var o=[],s=0;s<n.length;s+=3){var i=n[s],a=s+1<n.length,c=a?n[s+1]:0,u=s+2<n.length,l=u?n[s+2]:0,p=i>>2;i=(i&3)<<4|c>>4,c=(c&15)<<2|l>>6,l&=63,u||(l=64,a||(c=64)),o.push(r[p],r[i],r[c]||"",r[l]||"")}return o.join("")}function Pp(n){var r=n.length,o=3*r/4;o%3?o=Math.floor(o):"=.".indexOf(n[r-1])!=-1&&(o="=.".indexOf(n[r-2])!=-1?o-2:o-1);var s=new Uint8Array(o),i=0;return uh(n,function(a){s[i++]=a}),s.subarray(0,i)}function uh(n,r){function o(l){for(;s<n.length;){var p=n.charAt(s++),A=Fs[p];if(A!=null)return A;if(!/^[\s\xa0]*$/.test(p))throw Error("Unknown base64 encoding at char: "+p)}return l}wp();for(var s=0;;){var i=o(-1),a=o(0),c=o(64),u=o(64);if(u===64&&i===-1)break;r(i<<2|a>>4),c!=64&&(r(a<<4&240|c>>2),u!=64&&r(c<<6&192|u))}}function wp(){if(!Fs){Fs={};for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),r=["+/=","+/","-_=","-_.","-_"],o=0;5>o;o++){var s=n.concat(r[o].split(""));bp[o]=s;for(var i=0;i<s.length;i++){var a=s[i];Fs[a]===void 0&&(Fs[a]=i)}}}}V("jspb.ConstBinaryMessage",function(){},void 0);V("jspb.BinaryMessage",function(){},void 0);V("jspb.BinaryConstants.FieldType",{yb:-1,ee:1,FLOAT:2,ke:3,te:4,je:5,xb:6,wb:7,BOOL:8,re:9,ie:10,le:11,ce:12,se:13,ge:14,me:15,ne:16,oe:17,pe:18,he:30,ve:31},void 0);V("jspb.BinaryConstants.WireType",{yb:-1,ue:0,xb:1,de:2,qe:3,fe:4,wb:5},void 0);V("jspb.BinaryConstants.FieldTypeToWireType",function(n){switch(n){case 5:case 3:case 13:case 4:case 17:case 18:case 8:case 14:case 31:return 0;case 1:case 6:case 16:case 30:return 1;case 9:case 11:case 12:return 2;case 2:case 7:case 15:return 5;default:return-1}},void 0);V("jspb.BinaryConstants.INVALID_FIELD_NUMBER",-1,void 0);V("jspb.BinaryConstants.FLOAT32_EPS",1401298464324817e-60,void 0);V("jspb.BinaryConstants.FLOAT32_MIN",11754943508222875e-54,void 0);V("jspb.BinaryConstants.FLOAT32_MAX",34028234663852886e22,void 0);V("jspb.BinaryConstants.FLOAT64_EPS",5e-324,void 0);V("jspb.BinaryConstants.FLOAT64_MIN",22250738585072014e-324,void 0);V("jspb.BinaryConstants.FLOAT64_MAX",17976931348623157e292,void 0);V("jspb.BinaryConstants.TWO_TO_20",1048576,void 0);V("jspb.BinaryConstants.TWO_TO_23",8388608,void 0);V("jspb.BinaryConstants.TWO_TO_31",2147483648,void 0);V("jspb.BinaryConstants.TWO_TO_32",4294967296,void 0);V("jspb.BinaryConstants.TWO_TO_52",4503599627370496,void 0);V("jspb.BinaryConstants.TWO_TO_63",9223372036854776e3,void 0);V("jspb.BinaryConstants.TWO_TO_64",18446744073709552e3,void 0);V("jspb.BinaryConstants.ZERO_HASH","\0\0\0\0\0\0\0\0",void 0);var Fe=0,Oe=0;V("jspb.utils.getSplit64Low",function(){return Fe},void 0);V("jspb.utils.getSplit64High",function(){return Oe},void 0);function gu(n){var r=n>>>0;n=Math.floor((n-r)/4294967296)>>>0,Fe=r,Oe=n}V("jspb.utils.splitUint64",gu,void 0);function Ns(n){var r=0>n;n=Math.abs(n);var o=n>>>0;n=Math.floor((n-o)/4294967296),n>>>=0,r&&(n=~n>>>0,o=(~o>>>0)+1,4294967295<o&&(o=0,n++,4294967295<n&&(n=0))),Fe=o,Oe=n}V("jspb.utils.splitInt64",Ns,void 0);function Cp(n){var r=0>n;n=2*Math.abs(n),gu(n),n=Fe;var o=Oe;r&&(n==0?o==0?o=n=4294967295:(o--,n=4294967295):n--),Fe=n,Oe=o}V("jspb.utils.splitZigzag64",Cp,void 0);function Bp(n){var r=0>n?1:0;if(n=r?-n:n,n===0)0<1/n?Fe=Oe=0:(Oe=0,Fe=2147483648);else if(isNaN(n))Oe=0,Fe=2147483647;else if(34028234663852886e22<n)Oe=0,Fe=(r<<31|2139095040)>>>0;else if(11754943508222875e-54>n)n=Math.round(n/Math.pow(2,-149)),Oe=0,Fe=(r<<31|n)>>>0;else{var o=Math.floor(Math.log(n)/Math.LN2);n*=Math.pow(2,-o),n=Math.round(8388608*n),16777216<=n&&++o,Oe=0,Fe=(r<<31|o+127<<23|n&8388607)>>>0}}V("jspb.utils.splitFloat32",Bp,void 0);function Wp(n){var r=0>n?1:0;if(n=r?-n:n,n===0)Oe=0<1/n?0:2147483648,Fe=0;else if(isNaN(n))Oe=2147483647,Fe=4294967295;else if(17976931348623157e292<n)Oe=(r<<31|2146435072)>>>0,Fe=0;else if(22250738585072014e-324>n)n/=Math.pow(2,-1074),Oe=(r<<31|n/4294967296)>>>0,Fe=n>>>0;else{var o=n,s=0;if(2<=o)for(;2<=o&&1023>s;)s++,o/=2;else for(;1>o&&-1022<s;)o*=2,s--;n*=Math.pow(2,-s),Oe=(r<<31|s+1023<<20|1048576*n&1048575)>>>0,Fe=4503599627370496*n>>>0}}V("jspb.utils.splitFloat64",Wp,void 0);function Mn(n){var r=n.charCodeAt(4),o=n.charCodeAt(5),s=n.charCodeAt(6),i=n.charCodeAt(7);Fe=n.charCodeAt(0)+(n.charCodeAt(1)<<8)+(n.charCodeAt(2)<<16)+(n.charCodeAt(3)<<24)>>>0,Oe=r+(o<<8)+(s<<16)+(i<<24)>>>0}V("jspb.utils.splitHash64",Mn,void 0);function jo(n,r){return 4294967296*r+(n>>>0)}V("jspb.utils.joinUint64",jo,void 0);function Us(n,r){var o=r&2147483648;return o&&(n=~n+1>>>0,r=~r>>>0,n==0&&(r=r+1>>>0)),n=jo(n,r),o?-n:n}V("jspb.utils.joinInt64",Us,void 0);function Hi(n,r,o){var s=r>>31;return o(n<<1^s,(r<<1|n>>>31)^s)}V("jspb.utils.toZigzag64",Hi,void 0);function Sp(n,r){return Ki(n,r,Us)}V("jspb.utils.joinZigzag64",Sp,void 0);function Ki(n,r,o){var s=-(n&1);return o((n>>>1|r<<31)^s,r>>>1^s)}V("jspb.utils.fromZigzag64",Ki,void 0);function vp(n){var r=2*(n>>31)+1,o=n>>>23&255;return n&=8388607,o==255?n?NaN:1/0*r:o==0?r*Math.pow(2,-149)*n:r*Math.pow(2,o-150)*(n+Math.pow(2,23))}V("jspb.utils.joinFloat32",vp,void 0);function Ip(n,r){var o=2*(r>>31)+1,s=r>>>20&2047;return n=4294967296*(r&1048575)+n,s==2047?n?NaN:1/0*o:s==0?o*Math.pow(2,-1074)*n:o*Math.pow(2,s-1075)*(n+4503599627370496)}V("jspb.utils.joinFloat64",Ip,void 0);function Xi(n,r){return String.fromCharCode(n>>>0&255,n>>>8&255,n>>>16&255,n>>>24&255,r>>>0&255,r>>>8&255,r>>>16&255,r>>>24&255)}V("jspb.utils.joinHash64",Xi,void 0);V("jspb.utils.DIGITS","0123456789abcdef".split(""),void 0);function _s(n,r){function o(i,a){return i=i?String(i):"",a?"0000000".slice(i.length)+i:i}if(2097151>=r)return""+jo(n,r);var s=(n>>>24|r<<8)>>>0&16777215;return r=r>>16&65535,n=(n&16777215)+6777216*s+6710656*r,s+=8147497*r,r*=2,1e7<=n&&(s+=Math.floor(n/1e7),n%=1e7),1e7<=s&&(r+=Math.floor(s/1e7),s%=1e7),o(r,0)+o(s,r)+o(n,1)}V("jspb.utils.joinUnsignedDecimalString",_s,void 0);function js(n,r){var o=r&2147483648;return o&&(n=~n+1>>>0,r=~r+(n==0?1:0)>>>0),n=_s(n,r),o?"-"+n:n}V("jspb.utils.joinSignedDecimalString",js,void 0);function Mp(n,r){Mn(n),n=Fe;var o=Oe;return r?js(n,o):_s(n,o)}V("jspb.utils.hash64ToDecimalString",Mp,void 0);V("jspb.utils.hash64ArrayToDecimalStrings",function(n,r){for(var o=Array(n.length),s=0;s<n.length;s++)o[s]=Mp(n[s],r);return o},void 0);function zs(n){function r(c,u){for(var l=0;8>l&&(c!==1||0<u);l++)u=c*i[l]+u,i[l]=u&255,u>>>=8}function o(){for(var c=0;8>c;c++)i[c]=~i[c]&255}W(0<n.length);var s=!1;n[0]==="-"&&(s=!0,n=n.slice(1));for(var i=[0,0,0,0,0,0,0,0],a=0;a<n.length;a++)r(10,n.charCodeAt(a)-48);return s&&(o(),r(1,1)),yp(i)}V("jspb.utils.decimalStringToHash64",zs,void 0);V("jspb.utils.splitDecimalString",function(n){Mn(zs(n))},void 0);function Ap(n){return String.fromCharCode(10>n?48+n:87+n)}function fp(n){return 97<=n?n-97+10:n-48}V("jspb.utils.hash64ToHexString",function(n){var r=Array(18);r[0]="0",r[1]="x";for(var o=0;8>o;o++){var s=n.charCodeAt(7-o);r[2*o+2]=Ap(s>>4),r[2*o+3]=Ap(s&15)}return r.join("")},void 0);V("jspb.utils.hexStringToHash64",function(n){n=n.toLowerCase(),W(n.length==18),W(n[0]=="0"),W(n[1]=="x");for(var r="",o=0;8>o;o++)r=String.fromCharCode(16*fp(n.charCodeAt(2*o+2))+fp(n.charCodeAt(2*o+3)))+r;return r},void 0);V("jspb.utils.hash64ToNumber",function(n,r){Mn(n),n=Fe;var o=Oe;return r?Us(n,o):jo(n,o)},void 0);V("jspb.utils.numberToHash64",function(n){return Ns(n),Xi(Fe,Oe)},void 0);V("jspb.utils.countVarints",function(n,r,o){for(var s=0,i=r;i<o;i++)s+=n[i]>>7;return o-r-s},void 0);V("jspb.utils.countVarintFields",function(n,r,o,s){var i=0;if(s*=8,128>s)for(;r<o&&n[r++]==s;)for(i++;;){var a=n[r++];if(!(a&128))break}else for(;r<o;){for(a=s;128<a;){if(n[r]!=(a&127|128))return i;r++,a>>=7}if(n[r++]!=a)break;for(i++;a=n[r++],(a&128)!=0;);}return i},void 0);function Rp(n,r,o,s,i){var a=0;if(128>s)for(;r<o&&n[r++]==s;)a++,r+=i;else for(;r<o;){for(var c=s;128<c;){if(n[r++]!=(c&127|128))return a;c>>=7}if(n[r++]!=c)break;a++,r+=i}return a}V("jspb.utils.countFixed32Fields",function(n,r,o,s){return Rp(n,r,o,8*s+5,4)},void 0);V("jspb.utils.countFixed64Fields",function(n,r,o,s){return Rp(n,r,o,8*s+1,8)},void 0);V("jspb.utils.countDelimitedFields",function(n,r,o,s){var i=0;for(s=8*s+2;r<o;){for(var a=s;128<a;){if(n[r++]!=(a&127|128))return i;a>>=7}if(n[r++]!=a)break;i++;for(var c=0,u=1;a=n[r++],c+=(a&127)*u,u*=128,(a&128)!=0;);r+=c}return i},void 0);V("jspb.utils.debugBytesToTextFormat",function(n){var r='"';if(n){n=Yi(n);for(var o=0;o<n.length;o++)r+="\\x",16>n[o]&&(r+="0"),r+=n[o].toString(16)}return r+'"'},void 0);V("jspb.utils.debugScalarToTextFormat",function(n){if(typeof n=="string"){n=String(n);for(var r=['"'],o=0;o<n.length;o++){var s=n.charAt(o),i=s.charCodeAt(0),a=o+1,c;(c=lu[s])||(31<i&&127>i||(i=s,i in Zi?s=Zi[i]:i in lu?s=Zi[i]=lu[i]:(c=i.charCodeAt(0),31<c&&127>c?s=i:(256>c?(s="\\x",(16>c||256<c)&&(s+="0")):(s="\\u",4096>c&&(s+="0")),s+=c.toString(16).toUpperCase()),s=Zi[i]=s)),c=s),r[a]=c}r.push('"'),n=r.join("")}else n=n.toString();return n},void 0);V("jspb.utils.stringToByteArray",function(n){for(var r=new Uint8Array(n.length),o=0;o<n.length;o++){var s=n.charCodeAt(o);if(255<s)throw Error("Conversion error: string contains codepoint outside of byte range");r[o]=s}return r},void 0);function Yi(n){return n.constructor===Uint8Array?n:n.constructor===ArrayBuffer?new Uint8Array(n):n.constructor===Array?new Uint8Array(n):n.constructor===String?Pp(n):n instanceof Uint8Array?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):(ct("Type not convertible to Uint8Array."),new Uint8Array(0))}V("jspb.utils.byteSourceToUint8Array",Yi,void 0);function C(n,r,o){this.b=null,this.a=this.c=this.h=0,this.v=!1,n&&this.H(n,r,o)}V("jspb.BinaryDecoder",C,void 0);var ks=[];C.getInstanceCacheLength=function(){return ks.length};function qi(n,r,o){if(ks.length){var s=ks.pop();return n&&s.H(n,r,o),s}return new C(n,r,o)}C.alloc=qi;C.prototype.Ca=function(){this.clear(),100>ks.length&&ks.push(this)};C.prototype.free=C.prototype.Ca;C.prototype.clone=function(){return qi(this.b,this.h,this.c-this.h)};C.prototype.clone=C.prototype.clone;C.prototype.clear=function(){this.b=null,this.a=this.c=this.h=0,this.v=!1};C.prototype.clear=C.prototype.clear;C.prototype.Y=function(){return this.b};C.prototype.getBuffer=C.prototype.Y;C.prototype.H=function(n,r,o){this.b=Yi(n),this.h=r!==void 0?r:0,this.c=o!==void 0?this.h+o:this.b.length,this.a=this.h};C.prototype.setBlock=C.prototype.H;C.prototype.Db=function(){return this.c};C.prototype.getEnd=C.prototype.Db;C.prototype.setEnd=function(n){this.c=n};C.prototype.setEnd=C.prototype.setEnd;C.prototype.reset=function(){this.a=this.h};C.prototype.reset=C.prototype.reset;C.prototype.B=function(){return this.a};C.prototype.getCursor=C.prototype.B;C.prototype.Ma=function(n){this.a=n};C.prototype.setCursor=C.prototype.Ma;C.prototype.advance=function(n){this.a+=n,W(this.a<=this.c)};C.prototype.advance=C.prototype.advance;C.prototype.ya=function(){return this.a==this.c};C.prototype.atEnd=C.prototype.ya;C.prototype.Qb=function(){return this.a>this.c};C.prototype.pastEnd=C.prototype.Qb;C.prototype.getError=function(){return this.v||0>this.a||this.a>this.c};C.prototype.getError=C.prototype.getError;C.prototype.w=function(n){for(var r=128,o=0,s=0,i=0;4>i&&128<=r;i++)r=this.b[this.a++],o|=(r&127)<<7*i;if(128<=r&&(r=this.b[this.a++],o|=(r&127)<<28,s|=(r&127)>>4),128<=r)for(i=0;5>i&&128<=r;i++)r=this.b[this.a++],s|=(r&127)<<7*i+3;if(128>r)return n(o>>>0,s>>>0);ct("Failed to read varint, encoding is invalid."),this.v=!0};C.prototype.readSplitVarint64=C.prototype.w;C.prototype.ea=function(n){return this.w(function(r,o){return Ki(r,o,n)})};C.prototype.readSplitZigzagVarint64=C.prototype.ea;C.prototype.ta=function(n){var r=this.b,o=this.a;this.a+=8;for(var s=0,i=0,a=o+7;a>=o;a--)s=s<<8|r[a],i=i<<8|r[a+4];return n(s,i)};C.prototype.readSplitFixed64=C.prototype.ta;C.prototype.kb=function(){for(;this.b[this.a]&128;)this.a++;this.a++};C.prototype.skipVarint=C.prototype.kb;C.prototype.mb=function(n){for(;128<n;)this.a--,n>>>=7;this.a--};C.prototype.unskipVarint=C.prototype.mb;C.prototype.o=function(){var n=this.b,r=n[this.a],o=r&127;return 128>r?(this.a+=1,W(this.a<=this.c),o):(r=n[this.a+1],o|=(r&127)<<7,128>r?(this.a+=2,W(this.a<=this.c),o):(r=n[this.a+2],o|=(r&127)<<14,128>r?(this.a+=3,W(this.a<=this.c),o):(r=n[this.a+3],o|=(r&127)<<21,128>r?(this.a+=4,W(this.a<=this.c),o):(r=n[this.a+4],o|=(r&15)<<28,128>r?(this.a+=5,W(this.a<=this.c),o>>>0):(this.a+=5,128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&128<=n[this.a++]&&W(!1),W(this.a<=this.c),o)))))};C.prototype.readUnsignedVarint32=C.prototype.o;C.prototype.da=function(){return~~this.o()};C.prototype.readSignedVarint32=C.prototype.da;C.prototype.O=function(){return this.o().toString()};C.prototype.Ea=function(){return this.da().toString()};C.prototype.readSignedVarint32String=C.prototype.Ea;C.prototype.Ia=function(){var n=this.o();return n>>>1^-(n&1)};C.prototype.readZigzagVarint32=C.prototype.Ia;C.prototype.Ga=function(){return this.w(jo)};C.prototype.readUnsignedVarint64=C.prototype.Ga;C.prototype.Ha=function(){return this.w(_s)};C.prototype.readUnsignedVarint64String=C.prototype.Ha;C.prototype.sa=function(){return this.w(Us)};C.prototype.readSignedVarint64=C.prototype.sa;C.prototype.Fa=function(){return this.w(js)};C.prototype.readSignedVarint64String=C.prototype.Fa;C.prototype.Ja=function(){return this.w(Sp)};C.prototype.readZigzagVarint64=C.prototype.Ja;C.prototype.fb=function(){return this.ea(Xi)};C.prototype.readZigzagVarintHash64=C.prototype.fb;C.prototype.Ka=function(){return this.ea(js)};C.prototype.readZigzagVarint64String=C.prototype.Ka;C.prototype.Gc=function(){var n=this.b[this.a];return this.a+=1,W(this.a<=this.c),n};C.prototype.readUint8=C.prototype.Gc;C.prototype.Ec=function(){var n=this.b[this.a],r=this.b[this.a+1];return this.a+=2,W(this.a<=this.c),n<<0|r<<8};C.prototype.readUint16=C.prototype.Ec;C.prototype.m=function(){var n=this.b[this.a],r=this.b[this.a+1],o=this.b[this.a+2],s=this.b[this.a+3];return this.a+=4,W(this.a<=this.c),(n<<0|r<<8|o<<16|s<<24)>>>0};C.prototype.readUint32=C.prototype.m;C.prototype.ga=function(){var n=this.m(),r=this.m();return jo(n,r)};C.prototype.readUint64=C.prototype.ga;C.prototype.ha=function(){var n=this.m(),r=this.m();return _s(n,r)};C.prototype.readUint64String=C.prototype.ha;C.prototype.Xb=function(){var n=this.b[this.a];return this.a+=1,W(this.a<=this.c),n<<24>>24};C.prototype.readInt8=C.prototype.Xb;C.prototype.Vb=function(){var n=this.b[this.a],r=this.b[this.a+1];return this.a+=2,W(this.a<=this.c),(n<<0|r<<8)<<16>>16};C.prototype.readInt16=C.prototype.Vb;C.prototype.P=function(){var n=this.b[this.a],r=this.b[this.a+1],o=this.b[this.a+2],s=this.b[this.a+3];return this.a+=4,W(this.a<=this.c),n<<0|r<<8|o<<16|s<<24};C.prototype.readInt32=C.prototype.P;C.prototype.ba=function(){var n=this.m(),r=this.m();return Us(n,r)};C.prototype.readInt64=C.prototype.ba;C.prototype.ca=function(){var n=this.m(),r=this.m();return js(n,r)};C.prototype.readInt64String=C.prototype.ca;C.prototype.aa=function(){var n=this.m();return vp(n,0)};C.prototype.readFloat=C.prototype.aa;C.prototype.Z=function(){var n=this.m(),r=this.m();return Ip(n,r)};C.prototype.readDouble=C.prototype.Z;C.prototype.pa=function(){return!!this.b[this.a++]};C.prototype.readBool=C.prototype.pa;C.prototype.ra=function(){return this.da()};C.prototype.readEnum=C.prototype.ra;C.prototype.fa=function(n){var r=this.b,o=this.a;n=o+n;for(var s=[],i="";o<n;){var a=r[o++];if(128>a)s.push(a);else{if(192>a)continue;if(224>a){var c=r[o++];s.push((a&31)<<6|c&63)}else if(240>a){c=r[o++];var u=r[o++];s.push((a&15)<<12|(c&63)<<6|u&63)}else if(248>a){c=r[o++],u=r[o++];var l=r[o++];a=(a&7)<<18|(c&63)<<12|(u&63)<<6|l&63,a-=65536,s.push((a>>10&1023)+55296,(a&1023)+56320)}}8192<=s.length&&(i+=String.fromCharCode.apply(null,s),s.length=0)}return i+=yp(s),this.a=o,i};C.prototype.readString=C.prototype.fa;C.prototype.Dc=function(){var n=this.o();return this.fa(n)};C.prototype.readStringWithLength=C.prototype.Dc;C.prototype.qa=function(n){if(0>n||this.a+n>this.b.length)return this.v=!0,ct("Invalid byte length!"),new Uint8Array(0);var r=this.b.subarray(this.a,this.a+n);return this.a+=n,W(this.a<=this.c),r};C.prototype.readBytes=C.prototype.qa;C.prototype.ia=function(){return this.w(Xi)};C.prototype.readVarintHash64=C.prototype.ia;C.prototype.$=function(){var n=this.b,r=this.a,o=n[r],s=n[r+1],i=n[r+2],a=n[r+3],c=n[r+4],u=n[r+5],l=n[r+6];return n=n[r+7],this.a+=8,String.fromCharCode(o,s,i,a,c,u,l,n)};C.prototype.readFixedHash64=C.prototype.$;function h(n,r,o){this.a=qi(n,r,o),this.O=this.a.B(),this.b=this.c=-1,this.h=!1,this.v=null}V("jspb.BinaryReader",h,void 0);var Uo=[];h.clearInstanceCache=function(){Uo=[]};h.getInstanceCacheLength=function(){return Uo.length};function Fp(n,r,o){if(Uo.length){var s=Uo.pop();return n&&s.a.H(n,r,o),s}return new h(n,r,o)}h.alloc=Fp;h.prototype.zb=Fp;h.prototype.alloc=h.prototype.zb;h.prototype.Ca=function(){this.a.clear(),this.b=this.c=-1,this.h=!1,this.v=null,100>Uo.length&&Uo.push(this)};h.prototype.free=h.prototype.Ca;h.prototype.Fb=function(){return this.O};h.prototype.getFieldCursor=h.prototype.Fb;h.prototype.B=function(){return this.a.B()};h.prototype.getCursor=h.prototype.B;h.prototype.Y=function(){return this.a.Y()};h.prototype.getBuffer=h.prototype.Y;h.prototype.Hb=function(){return this.c};h.prototype.getFieldNumber=h.prototype.Hb;h.prototype.Lb=function(){return this.b};h.prototype.getWireType=h.prototype.Lb;h.prototype.Mb=function(){return this.b==2};h.prototype.isDelimited=h.prototype.Mb;h.prototype.bb=function(){return this.b==4};h.prototype.isEndGroup=h.prototype.bb;h.prototype.getError=function(){return this.h||this.a.getError()};h.prototype.getError=h.prototype.getError;h.prototype.H=function(n,r,o){this.a.H(n,r,o),this.b=this.c=-1};h.prototype.setBlock=h.prototype.H;h.prototype.reset=function(){this.a.reset(),this.b=this.c=-1};h.prototype.reset=h.prototype.reset;h.prototype.advance=function(n){this.a.advance(n)};h.prototype.advance=h.prototype.advance;h.prototype.oa=function(){if(this.a.ya())return!1;if(this.getError())return ct("Decoder hit an error"),!1;this.O=this.a.B();var n=this.a.o(),r=n>>>3;return n&=7,n!=0&&n!=5&&n!=1&&n!=2&&n!=3&&n!=4?(ct("Invalid wire type: %s (at position %s)",n,this.O),this.h=!0,!1):(this.c=r,this.b=n,!0)};h.prototype.nextField=h.prototype.oa;h.prototype.Oa=function(){this.a.mb(this.c<<3|this.b)};h.prototype.unskipHeader=h.prototype.Oa;h.prototype.Lc=function(){var n=this.c;for(this.Oa();this.oa()&&this.c==n;)this.C();this.a.ya()||this.Oa()};h.prototype.skipMatchingFields=h.prototype.Lc;h.prototype.lb=function(){this.b!=0?(ct("Invalid wire type for skipVarintField"),this.C()):this.a.kb()};h.prototype.skipVarintField=h.prototype.lb;h.prototype.gb=function(){if(this.b!=2)ct("Invalid wire type for skipDelimitedField"),this.C();else{var n=this.a.o();this.a.advance(n)}};h.prototype.skipDelimitedField=h.prototype.gb;h.prototype.hb=function(){this.b!=5?(ct("Invalid wire type for skipFixed32Field"),this.C()):this.a.advance(4)};h.prototype.skipFixed32Field=h.prototype.hb;h.prototype.ib=function(){this.b!=1?(ct("Invalid wire type for skipFixed64Field"),this.C()):this.a.advance(8)};h.prototype.skipFixed64Field=h.prototype.ib;h.prototype.jb=function(){var n=this.c;do{if(!this.oa()){ct("Unmatched start-group tag: stream EOF"),this.h=!0;break}if(this.b==4){this.c!=n&&(ct("Unmatched end-group tag"),this.h=!0);break}this.C()}while(!0)};h.prototype.skipGroup=h.prototype.jb;h.prototype.C=function(){switch(this.b){case 0:this.lb();break;case 1:this.ib();break;case 2:this.gb();break;case 5:this.hb();break;case 3:this.jb();break;default:ct("Invalid wire encoding for field.")}};h.prototype.skipField=h.prototype.C;h.prototype.Hc=function(n,r){this.v===null&&(this.v={}),W(!this.v[n]),this.v[n]=r};h.prototype.registerReadCallback=h.prototype.Hc;h.prototype.Ic=function(n){return W(this.v!==null),n=this.v[n],W(n),n(this)};h.prototype.runReadCallback=h.prototype.Ic;h.prototype.Yb=function(n,r){W(this.b==2);var o=this.a.c,s=this.a.o();s=this.a.B()+s,this.a.setEnd(s),r(n,this),this.a.Ma(s),this.a.setEnd(o)};h.prototype.readMessage=h.prototype.Yb;h.prototype.Ub=function(n,r,o){W(this.b==3),W(this.c==n),o(r,this),this.h||this.b==4||(ct("Group submessage did not end with an END_GROUP tag"),this.h=!0)};h.prototype.readGroup=h.prototype.Ub;h.prototype.Gb=function(){W(this.b==2);var n=this.a.o(),r=this.a.B(),o=r+n;return n=qi(this.a.Y(),r,n),this.a.Ma(o),n};h.prototype.getFieldDecoder=h.prototype.Gb;h.prototype.P=function(){return W(this.b==0),this.a.da()};h.prototype.readInt32=h.prototype.P;h.prototype.Wb=function(){return W(this.b==0),this.a.Ea()};h.prototype.readInt32String=h.prototype.Wb;h.prototype.ba=function(){return W(this.b==0),this.a.sa()};h.prototype.readInt64=h.prototype.ba;h.prototype.ca=function(){return W(this.b==0),this.a.Fa()};h.prototype.readInt64String=h.prototype.ca;h.prototype.m=function(){return W(this.b==0),this.a.o()};h.prototype.readUint32=h.prototype.m;h.prototype.Fc=function(){return W(this.b==0),this.a.O()};h.prototype.readUint32String=h.prototype.Fc;h.prototype.ga=function(){return W(this.b==0),this.a.Ga()};h.prototype.readUint64=h.prototype.ga;h.prototype.ha=function(){return W(this.b==0),this.a.Ha()};h.prototype.readUint64String=h.prototype.ha;h.prototype.zc=function(){return W(this.b==0),this.a.Ia()};h.prototype.readSint32=h.prototype.zc;h.prototype.Ac=function(){return W(this.b==0),this.a.Ja()};h.prototype.readSint64=h.prototype.Ac;h.prototype.Bc=function(){return W(this.b==0),this.a.Ka()};h.prototype.readSint64String=h.prototype.Bc;h.prototype.Rb=function(){return W(this.b==5),this.a.m()};h.prototype.readFixed32=h.prototype.Rb;h.prototype.Sb=function(){return W(this.b==1),this.a.ga()};h.prototype.readFixed64=h.prototype.Sb;h.prototype.Tb=function(){return W(this.b==1),this.a.ha()};h.prototype.readFixed64String=h.prototype.Tb;h.prototype.vc=function(){return W(this.b==5),this.a.P()};h.prototype.readSfixed32=h.prototype.vc;h.prototype.wc=function(){return W(this.b==5),this.a.P().toString()};h.prototype.readSfixed32String=h.prototype.wc;h.prototype.xc=function(){return W(this.b==1),this.a.ba()};h.prototype.readSfixed64=h.prototype.xc;h.prototype.yc=function(){return W(this.b==1),this.a.ca()};h.prototype.readSfixed64String=h.prototype.yc;h.prototype.aa=function(){return W(this.b==5),this.a.aa()};h.prototype.readFloat=h.prototype.aa;h.prototype.Z=function(){return W(this.b==1),this.a.Z()};h.prototype.readDouble=h.prototype.Z;h.prototype.pa=function(){return W(this.b==0),!!this.a.o()};h.prototype.readBool=h.prototype.pa;h.prototype.ra=function(){return W(this.b==0),this.a.sa()};h.prototype.readEnum=h.prototype.ra;h.prototype.fa=function(){W(this.b==2);var n=this.a.o();return this.a.fa(n)};h.prototype.readString=h.prototype.fa;h.prototype.qa=function(){W(this.b==2);var n=this.a.o();return this.a.qa(n)};h.prototype.readBytes=h.prototype.qa;h.prototype.ia=function(){return W(this.b==0),this.a.ia()};h.prototype.readVarintHash64=h.prototype.ia;h.prototype.Cc=function(){return W(this.b==0),this.a.fb()};h.prototype.readSintHash64=h.prototype.Cc;h.prototype.w=function(n){return W(this.b==0),this.a.w(n)};h.prototype.readSplitVarint64=h.prototype.w;h.prototype.ea=function(n){return W(this.b==0),this.a.w(function(r,o){return Ki(r,o,n)})};h.prototype.readSplitZigzagVarint64=h.prototype.ea;h.prototype.$=function(){return W(this.b==1),this.a.$()};h.prototype.readFixedHash64=h.prototype.$;h.prototype.ta=function(n){return W(this.b==1),this.a.ta(n)};h.prototype.readSplitFixed64=h.prototype.ta;function He(n,r){W(n.b==2);var o=n.a.o();o=n.a.B()+o;for(var s=[];n.a.B()<o;)s.push(r.call(n.a));return s}h.prototype.gc=function(){return He(this,this.a.da)};h.prototype.readPackedInt32=h.prototype.gc;h.prototype.hc=function(){return He(this,this.a.Ea)};h.prototype.readPackedInt32String=h.prototype.hc;h.prototype.ic=function(){return He(this,this.a.sa)};h.prototype.readPackedInt64=h.prototype.ic;h.prototype.jc=function(){return He(this,this.a.Fa)};h.prototype.readPackedInt64String=h.prototype.jc;h.prototype.qc=function(){return He(this,this.a.o)};h.prototype.readPackedUint32=h.prototype.qc;h.prototype.rc=function(){return He(this,this.a.O)};h.prototype.readPackedUint32String=h.prototype.rc;h.prototype.sc=function(){return He(this,this.a.Ga)};h.prototype.readPackedUint64=h.prototype.sc;h.prototype.tc=function(){return He(this,this.a.Ha)};h.prototype.readPackedUint64String=h.prototype.tc;h.prototype.nc=function(){return He(this,this.a.Ia)};h.prototype.readPackedSint32=h.prototype.nc;h.prototype.oc=function(){return He(this,this.a.Ja)};h.prototype.readPackedSint64=h.prototype.oc;h.prototype.pc=function(){return He(this,this.a.Ka)};h.prototype.readPackedSint64String=h.prototype.pc;h.prototype.bc=function(){return He(this,this.a.m)};h.prototype.readPackedFixed32=h.prototype.bc;h.prototype.cc=function(){return He(this,this.a.ga)};h.prototype.readPackedFixed64=h.prototype.cc;h.prototype.dc=function(){return He(this,this.a.ha)};h.prototype.readPackedFixed64String=h.prototype.dc;h.prototype.kc=function(){return He(this,this.a.P)};h.prototype.readPackedSfixed32=h.prototype.kc;h.prototype.lc=function(){return He(this,this.a.ba)};h.prototype.readPackedSfixed64=h.prototype.lc;h.prototype.mc=function(){return He(this,this.a.ca)};h.prototype.readPackedSfixed64String=h.prototype.mc;h.prototype.fc=function(){return He(this,this.a.aa)};h.prototype.readPackedFloat=h.prototype.fc;h.prototype.$b=function(){return He(this,this.a.Z)};h.prototype.readPackedDouble=h.prototype.$b;h.prototype.Zb=function(){return He(this,this.a.pa)};h.prototype.readPackedBool=h.prototype.Zb;h.prototype.ac=function(){return He(this,this.a.ra)};h.prototype.readPackedEnum=h.prototype.ac;h.prototype.uc=function(){return He(this,this.a.ia)};h.prototype.readPackedVarintHash64=h.prototype.uc;h.prototype.ec=function(){return He(this,this.a.$)};h.prototype.readPackedFixedHash64=h.prototype.ec;function Os(n,r,o,s,i){this.ma=n,this.Ba=r,this.la=o,this.Na=s,this.na=i}V("jspb.ExtensionFieldInfo",Os,void 0);function kp(n,r,o,s,i,a){this.Za=n,this.za=r,this.Aa=o,this.Wa=s,this.Ab=i,this.Nb=a}V("jspb.ExtensionFieldBinaryInfo",kp,void 0);Os.prototype.F=function(){return!!this.la};Os.prototype.isMessageType=Os.prototype.F;function N(){}V("jspb.Message",N,void 0);N.GENERATE_TO_OBJECT=!0;N.GENERATE_FROM_OBJECT=!0;var Qi=typeof Uint8Array=="function";N.prototype.Ib=function(){return this.b};N.prototype.getJsPbMessageId=N.prototype.Ib;N.initialize=function(n,r,o,s,i,a){n.f=null,r||(r=o?[o]:[]),n.b=o?String(o):void 0,n.D=o===0?-1:0,n.u=r;e:{if(o=n.u.length,r=-1,o&&(r=o-1,o=n.u[r],!(o===null||typeof o!="object"||Array.isArray(o)||Qi&&o instanceof Uint8Array))){n.G=r-n.D,n.i=o;break e}-1<s?(n.G=Math.max(s,r+1-n.D),n.i=null):n.G=Number.MAX_VALUE}if(n.a={},i)for(s=0;s<i.length;s++)r=i[s],r<n.G?(r+=n.D,n.u[r]=n.u[r]||Es):(ea(n),n.i[r]=n.i[r]||Es);if(a&&a.length)for(s=0;s<a.length;s++)hu(n,a[s])};var Es=Object.freeze?Object.freeze([]):[];function ea(n){var r=n.G+n.D;n.u[r]||(n.i=n.u[r]={})}function Op(n,r,o){for(var s=[],i=0;i<n.length;i++)s[i]=r.call(n[i],o,n[i]);return s}N.toObjectList=Op;N.toObjectExtension=function(n,r,o,s,i){for(var a in o){var c=o[a],u=s.call(n,c);if(u!=null){for(var l in c.Ba)if(c.Ba.hasOwnProperty(l))break;r[l]=c.Na?c.na?Op(u,c.Na,i):c.Na(i,u):u}}};N.serializeBinaryExtensions=function(n,r,o,s){for(var i in o){var a=o[i],c=a.Za;if(!a.Aa)throw Error("Message extension present that was generated without binary serialization support");var u=s.call(n,c);if(u!=null)if(c.F())if(a.Wa)a.Aa.call(r,c.ma,u,a.Wa);else throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format");else a.Aa.call(r,c.ma,u)}};N.readBinaryExtension=function(n,r,o,s,i){var a=o[r.c];if(a){if(o=a.Za,!a.za)throw Error("Deserializing extension whose generated code does not support binary format");if(o.F()){var c=new o.la;a.za.call(r,c,a.Ab)}else c=a.za.call(r);o.na&&!a.Nb?(r=s.call(n,o))?r.push(c):i.call(n,o,[c]):i.call(n,o,c)}else r.C()};function er(n,r){if(r<n.G){r+=n.D;var o=n.u[r];return o===Es?n.u[r]=[]:o}if(n.i)return o=n.i[r],o===Es?n.i[r]=[]:o}N.getField=er;N.getRepeatedField=function(n,r){return er(n,r)};function Ep(n,r){return n=er(n,r),n==null?n:+n}N.getOptionalFloatingPointField=Ep;function xp(n,r){return n=er(n,r),n==null?n:!!n}N.getBooleanField=xp;N.getRepeatedFloatingPointField=function(n,r){var o=er(n,r);if(n.a||(n.a={}),!n.a[r]){for(var s=0;s<o.length;s++)o[s]=+o[s];n.a[r]=!0}return o};N.getRepeatedBooleanField=function(n,r){var o=er(n,r);if(n.a||(n.a={}),!n.a[r]){for(var s=0;s<o.length;s++)o[s]=!!o[s];n.a[r]=!0}return o};function Dp(n){return n==null||typeof n=="string"?n:Qi&&n instanceof Uint8Array?Tp(n):(ct("Cannot coerce to b64 string: "+dn(n)),null)}N.bytesAsB64=Dp;function Np(n){return n==null||n instanceof Uint8Array?n:typeof n=="string"?Pp(n):(ct("Cannot coerce to Uint8Array: "+dn(n)),null)}N.bytesAsU8=Np;N.bytesListAsB64=function(n){return Up(n),n.length&&typeof n[0]!="string"?xs(n,Dp):n};N.bytesListAsU8=function(n){return Up(n),!n.length||n[0]instanceof Uint8Array?n:xs(n,Np)};function Up(n){if(n&&1<n.length){var r=dn(n[0]);sh(n,function(o){dn(o)!=r&&ct("Inconsistent type in JSPB repeated field array. Got "+dn(o)+" expected "+r)})}}function _p(n,r,o){return n=er(n,r),n??o}N.getFieldWithDefault=_p;N.getBooleanFieldWithDefault=function(n,r,o){return n=xp(n,r),n??o};N.getFloatingPointFieldWithDefault=function(n,r,o){return n=Ep(n,r),n??o};N.getFieldProto3=_p;N.getMapField=function(n,r,o,s){if(n.f||(n.f={}),r in n.f)return n.f[r];var i=er(n,r);if(!i){if(o)return;i=[],pn(n,r,i)}return n.f[r]=new ee(i,s)};function pn(n,r,o){return Wr(n,N),r<n.G?n.u[r+n.D]=o:(ea(n),n.i[r]=o),n}N.setField=pn;N.setProto3IntField=function(n,r,o){return oo(n,r,o,0)};N.setProto3FloatField=function(n,r,o){return oo(n,r,o,0)};N.setProto3BooleanField=function(n,r,o){return oo(n,r,o,!1)};N.setProto3StringField=function(n,r,o){return oo(n,r,o,"")};N.setProto3BytesField=function(n,r,o){return oo(n,r,o,"")};N.setProto3EnumField=function(n,r,o){return oo(n,r,o,0)};N.setProto3StringIntField=function(n,r,o){return oo(n,r,o,"0")};function oo(n,r,o,s){return Wr(n,N),o!==s?pn(n,r,o):r<n.G?n.u[r+n.D]=null:(ea(n),delete n.i[r]),n}N.addToRepeatedField=function(n,r,o,s){return Wr(n,N),r=er(n,r),s!=null?r.splice(s,0,o):r.push(o),n};function jp(n,r,o,s){return Wr(n,N),(o=hu(n,o))&&o!==r&&s!==void 0&&(n.f&&o in n.f&&(n.f[o]=void 0),pn(n,o,void 0)),pn(n,r,s)}N.setOneofField=jp;function hu(n,r){for(var o,s,i=0;i<r.length;i++){var a=r[i],c=er(n,a);c!=null&&(o=a,s=c,pn(n,a,void 0))}return o?(pn(n,o,s),o):0}N.computeOneofCase=hu;N.getWrapperField=function(n,r,o,s){if(n.f||(n.f={}),!n.f[o]){var i=er(n,o);(s||i)&&(n.f[o]=new r(i))}return n.f[o]};N.getRepeatedWrapperField=function(n,r,o){return zp(n,r,o),r=n.f[o],r==Es&&(r=n.f[o]=[]),r};function zp(n,r,o){if(n.f||(n.f={}),!n.f[o]){for(var s=er(n,o),i=[],a=0;a<s.length;a++)i[a]=new r(s[a]);n.f[o]=i}}N.setWrapperField=function(n,r,o){Wr(n,N),n.f||(n.f={});var s=o&&o.g();return n.f[r]=o,pn(n,r,s)};N.setOneofWrapperField=function(n,r,o,s){Wr(n,N),n.f||(n.f={});var i=s&&s.g();return n.f[r]=s,jp(n,r,o,i)};N.setRepeatedWrapperField=function(n,r,o){Wr(n,N),n.f||(n.f={}),o=o||[];for(var s=[],i=0;i<o.length;i++)s[i]=o[i].g();return n.f[r]=o,pn(n,r,s)};N.addToRepeatedWrapperField=function(n,r,o,s,i){zp(n,s,r);var a=n.f[r];return a||(a=n.f[r]=[]),o=o||new s,n=er(n,r),i!=null?(a.splice(i,0,o),n.splice(i,0,o.g())):(a.push(o),n.push(o.g())),o};N.toMap=function(n,r,o,s){for(var i={},a=0;a<n.length;a++)i[r.call(n[a])]=o?o.call(n[a],s,n[a]):n[a];return i};function Vp(n){if(n.f)for(var r in n.f){var o=n.f[r];if(Array.isArray(o))for(var s=0;s<o.length;s++)o[s]&&o[s].g();else o&&o.g()}}N.prototype.g=function(){return Vp(this),this.u};N.prototype.toArray=N.prototype.g;N.prototype.toString=function(){return Vp(this),this.u.toString()};N.prototype.getExtension=function(n){if(this.i){this.f||(this.f={});var r=n.ma;if(n.na){if(n.F())return this.f[r]||(this.f[r]=xs(this.i[r]||[],function(o){return new n.la(o)})),this.f[r]}else if(n.F())return!this.f[r]&&this.i[r]&&(this.f[r]=new n.la(this.i[r])),this.f[r];return this.i[r]}};N.prototype.getExtension=N.prototype.getExtension;N.prototype.Kc=function(n,r){this.f||(this.f={}),ea(this);var o=n.ma;return n.na?(r=r||[],n.F()?(this.f[o]=r,this.i[o]=xs(r,function(s){return s.g()})):this.i[o]=r):n.F()?(this.f[o]=r,this.i[o]=r&&r.g()):this.i[o]=r,this};N.prototype.setExtension=N.prototype.Kc;N.difference=function(n,r){if(!(n instanceof r.constructor))throw Error("Messages have different types.");var o=n.g();r=r.g();var s=[],i=0,a=o.length>r.length?o.length:r.length;for(n.b&&(s[0]=n.b,i=1);i<a;i++)Vs(o[i],r[i])||(s[i]=r[i]);return new n.constructor(s)};N.equals=function(n,r){return n==r||!(!n||!r)&&n instanceof r.constructor&&Vs(n.g(),r.g())};function du(n,r){n=n||{},r=r||{};var o={},s;for(s in n)o[s]=0;for(s in r)o[s]=0;for(s in o)if(!Vs(n[s],r[s]))return!1;return!0}N.compareExtensions=du;function Vs(n,r){if(n==r)return!0;if(!lp(n)||!lp(r))return typeof n=="number"&&isNaN(n)||typeof r=="number"&&isNaN(r)?String(n)==String(r):!1;if(n.constructor!=r.constructor)return!1;if(Qi&&n.constructor===Uint8Array){if(n.length!=r.length)return!1;for(var o=0;o<n.length;o++)if(n[o]!=r[o])return!1;return!0}if(n.constructor===Array){var s=void 0,i=void 0,a=Math.max(n.length,r.length);for(o=0;o<a;o++){var c=n[o],u=r[o];if(c&&c.constructor==Object&&(W(s===void 0),W(o===n.length-1),s=c,c=void 0),u&&u.constructor==Object&&(W(i===void 0),W(o===r.length-1),i=u,u=void 0),!Vs(c,u))return!1}return s||i?(s=s||{},i=i||{},du(s,i)):!0}if(n.constructor===Object)return du(n,r);throw Error("Invalid type in JSPB array")}N.compareFields=Vs;N.prototype.Bb=function(){return ta(this)};N.prototype.cloneMessage=N.prototype.Bb;N.prototype.clone=function(){return ta(this)};N.prototype.clone=N.prototype.clone;N.clone=function(n){return ta(n)};function ta(n){return new n.constructor(pu(n.g()))}N.copyInto=function(n,r){Wr(n,N),Wr(r,N),W(n.constructor==r.constructor,"Copy source and target message should have the same type."),n=ta(n);for(var o=r.g(),s=n.g(),i=o.length=0;i<s.length;i++)o[i]=s[i];r.f=n.f,r.i=n.i};function pu(n){if(Array.isArray(n)){for(var r=Array(n.length),o=0;o<n.length;o++){var s=n[o];s!=null&&(r[o]=typeof s=="object"?pu(W(s)):s)}return r}if(Qi&&n instanceof Uint8Array)return new Uint8Array(n);r={};for(o in n)s=n[o],s!=null&&(r[o]=typeof s=="object"?pu(W(s)):s);return r}N.registerMessageType=function(n,r){r.we=n};var Br={dump:function(n){return Wr(n,N,"jspb.Message instance expected"),W(n.getExtension,"Only unobfuscated and unoptimized compilation modes supported."),Br.X(n)}};V("jspb.debug.dump",Br.dump,void 0);Br.X=function(n){var r=dn(n);if(r=="number"||r=="string"||r=="boolean"||r=="null"||r=="undefined"||typeof Uint8Array<"u"&&n instanceof Uint8Array)return n;if(r=="array")return ch(n),xs(n,Br.X);if(n instanceof ee){var o={};n=n.entries();for(var s=n.next();!s.done;s=n.next())o[s.value[0]]=Br.X(s.value[1]);return o}Wr(n,N,"Only messages expected: "+n),r=n.constructor;var i={$name:r.name||r.displayName};for(u in r.prototype){var a=/^get([A-Z]\w*)/.exec(u);if(a&&u!="getExtension"&&u!="getJsPbMessageId"){var c="has"+a[1];(!n[c]||n[c]())&&(c=n[u](),i[Br.$a(a[1])]=Br.X(c))}}if(n.extensionObject_)return i.$extensions="Recursive dumping of extensions not supported in compiled code. Switch to uncompiled or dump extension object directly",i;for(s in r.extensions)if(/^\d+$/.test(s)){c=r.extensions[s];var u=n.getExtension(c);a=void 0,c=c.Ba;var l=[],p=0;for(a in c)l[p++]=a;a=l[0],u!=null&&(o||(o=i.$extensions={}),o[Br.$a(a)]=Br.X(u))}return i};Br.$a=function(n){return n.replace(/^[A-Z]/,function(r){return r.toLowerCase()})};function O(){this.a=[]}V("jspb.BinaryEncoder",O,void 0);O.prototype.length=function(){return this.a.length};O.prototype.length=O.prototype.length;O.prototype.end=function(){var n=this.a;return this.a=[],n};O.prototype.end=O.prototype.end;O.prototype.l=function(n,r){for(W(n==Math.floor(n)),W(r==Math.floor(r)),W(0<=n&&4294967296>n),W(0<=r&&4294967296>r);0<r||127<n;)this.a.push(n&127|128),n=(n>>>7|r<<25)>>>0,r>>>=7;this.a.push(n)};O.prototype.writeSplitVarint64=O.prototype.l;O.prototype.A=function(n,r){W(n==Math.floor(n)),W(r==Math.floor(r)),W(0<=n&&4294967296>n),W(0<=r&&4294967296>r),this.s(n),this.s(r)};O.prototype.writeSplitFixed64=O.prototype.A;O.prototype.j=function(n){for(W(n==Math.floor(n)),W(0<=n&&4294967296>n);127<n;)this.a.push(n&127|128),n>>>=7;this.a.push(n)};O.prototype.writeUnsignedVarint32=O.prototype.j;O.prototype.M=function(n){if(W(n==Math.floor(n)),W(-2147483648<=n&&2147483648>n),0<=n)this.j(n);else{for(var r=0;9>r;r++)this.a.push(n&127|128),n>>=7;this.a.push(1)}};O.prototype.writeSignedVarint32=O.prototype.M;O.prototype.va=function(n){W(n==Math.floor(n)),W(0<=n&&18446744073709552e3>n),Ns(n),this.l(Fe,Oe)};O.prototype.writeUnsignedVarint64=O.prototype.va;O.prototype.ua=function(n){W(n==Math.floor(n)),W(-9223372036854776e3<=n&&9223372036854776e3>n),Ns(n),this.l(Fe,Oe)};O.prototype.writeSignedVarint64=O.prototype.ua;O.prototype.wa=function(n){W(n==Math.floor(n)),W(-2147483648<=n&&2147483648>n),this.j((n<<1^n>>31)>>>0)};O.prototype.writeZigzagVarint32=O.prototype.wa;O.prototype.xa=function(n){W(n==Math.floor(n)),W(-9223372036854776e3<=n&&9223372036854776e3>n),Cp(n),this.l(Fe,Oe)};O.prototype.writeZigzagVarint64=O.prototype.xa;O.prototype.Ta=function(n){this.W(zs(n))};O.prototype.writeZigzagVarint64String=O.prototype.Ta;O.prototype.W=function(n){var r=this;Mn(n),Hi(Fe,Oe,function(o,s){r.l(o>>>0,s>>>0)})};O.prototype.writeZigzagVarintHash64=O.prototype.W;O.prototype.be=function(n){W(n==Math.floor(n)),W(0<=n&&256>n),this.a.push(n>>>0&255)};O.prototype.writeUint8=O.prototype.be;O.prototype.ae=function(n){W(n==Math.floor(n)),W(0<=n&&65536>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255)};O.prototype.writeUint16=O.prototype.ae;O.prototype.s=function(n){W(n==Math.floor(n)),W(0<=n&&4294967296>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255),this.a.push(n>>>16&255),this.a.push(n>>>24&255)};O.prototype.writeUint32=O.prototype.s;O.prototype.V=function(n){W(n==Math.floor(n)),W(0<=n&&18446744073709552e3>n),gu(n),this.s(Fe),this.s(Oe)};O.prototype.writeUint64=O.prototype.V;O.prototype.Qc=function(n){W(n==Math.floor(n)),W(-128<=n&&128>n),this.a.push(n>>>0&255)};O.prototype.writeInt8=O.prototype.Qc;O.prototype.Pc=function(n){W(n==Math.floor(n)),W(-32768<=n&&32768>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255)};O.prototype.writeInt16=O.prototype.Pc;O.prototype.S=function(n){W(n==Math.floor(n)),W(-2147483648<=n&&2147483648>n),this.a.push(n>>>0&255),this.a.push(n>>>8&255),this.a.push(n>>>16&255),this.a.push(n>>>24&255)};O.prototype.writeInt32=O.prototype.S;O.prototype.T=function(n){W(n==Math.floor(n)),W(-9223372036854776e3<=n&&9223372036854776e3>n),Ns(n),this.A(Fe,Oe)};O.prototype.writeInt64=O.prototype.T;O.prototype.ka=function(n){W(n==Math.floor(n)),W(-9223372036854776e3<=+n&&9223372036854776e3>+n),Mn(zs(n)),this.A(Fe,Oe)};O.prototype.writeInt64String=O.prototype.ka;O.prototype.L=function(n){W(n===1/0||n===-1/0||isNaN(n)||-34028234663852886e22<=n&&34028234663852886e22>=n),Bp(n),this.s(Fe)};O.prototype.writeFloat=O.prototype.L;O.prototype.J=function(n){W(n===1/0||n===-1/0||isNaN(n)||-17976931348623157e292<=n&&17976931348623157e292>=n),Wp(n),this.s(Fe),this.s(Oe)};O.prototype.writeDouble=O.prototype.J;O.prototype.I=function(n){W(typeof n=="boolean"||typeof n=="number"),this.a.push(n?1:0)};O.prototype.writeBool=O.prototype.I;O.prototype.R=function(n){W(n==Math.floor(n)),W(-2147483648<=n&&2147483648>n),this.M(n)};O.prototype.writeEnum=O.prototype.R;O.prototype.ja=function(n){this.a.push.apply(this.a,n)};O.prototype.writeBytes=O.prototype.ja;O.prototype.N=function(n){Mn(n),this.l(Fe,Oe)};O.prototype.writeVarintHash64=O.prototype.N;O.prototype.K=function(n){Mn(n),this.s(Fe),this.s(Oe)};O.prototype.writeFixedHash64=O.prototype.K;O.prototype.U=function(n){var r=this.a.length;ah(n);for(var o=0;o<n.length;o++){var s=n.charCodeAt(o);if(128>s)this.a.push(s);else if(2048>s)this.a.push(s>>6|192),this.a.push(s&63|128);else if(65536>s)if(55296<=s&&56319>=s&&o+1<n.length){var i=n.charCodeAt(o+1);56320<=i&&57343>=i&&(s=1024*(s-55296)+i-56320+65536,this.a.push(s>>18|240),this.a.push(s>>12&63|128),this.a.push(s>>6&63|128),this.a.push(s&63|128),o++)}else this.a.push(s>>12|224),this.a.push(s>>6&63|128),this.a.push(s&63|128)}return this.a.length-r};O.prototype.writeString=O.prototype.U;function Y(n,r){this.lo=n,this.hi=r}V("jspb.arith.UInt64",Y,void 0);Y.prototype.cmp=function(n){return this.hi<n.hi||this.hi==n.hi&&this.lo<n.lo?-1:this.hi==n.hi&&this.lo==n.lo?0:1};Y.prototype.cmp=Y.prototype.cmp;Y.prototype.La=function(){return new Y((this.lo>>>1|(this.hi&1)<<31)>>>0,this.hi>>>1>>>0)};Y.prototype.rightShift=Y.prototype.La;Y.prototype.Da=function(){return new Y(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)};Y.prototype.leftShift=Y.prototype.Da;Y.prototype.cb=function(){return!!(this.hi&2147483648)};Y.prototype.msb=Y.prototype.cb;Y.prototype.Ob=function(){return!!(this.lo&1)};Y.prototype.lsb=Y.prototype.Ob;Y.prototype.Ua=function(){return this.lo==0&&this.hi==0};Y.prototype.zero=Y.prototype.Ua;Y.prototype.add=function(n){return new Y((this.lo+n.lo&4294967295)>>>0>>>0,((this.hi+n.hi&4294967295)>>>0)+(4294967296<=this.lo+n.lo?1:0)>>>0)};Y.prototype.add=Y.prototype.add;Y.prototype.sub=function(n){return new Y((this.lo-n.lo&4294967295)>>>0>>>0,((this.hi-n.hi&4294967295)>>>0)-(0>this.lo-n.lo?1:0)>>>0)};Y.prototype.sub=Y.prototype.sub;function Au(n,r){var o=n&65535;n>>>=16;var s=r&65535,i=r>>>16;for(r=o*s+65536*(o*i&65535)+65536*(n*s&65535),o=n*i+(o*i>>>16)+(n*s>>>16);4294967296<=r;)r-=4294967296,o+=1;return new Y(r>>>0,o>>>0)}Y.mul32x32=Au;Y.prototype.eb=function(n){var r=Au(this.lo,n);return n=Au(this.hi,n),n.hi=n.lo,n.lo=0,r.add(n)};Y.prototype.mul=Y.prototype.eb;Y.prototype.Xa=function(n){if(n==0)return[];var r=new Y(0,0),o=new Y(this.lo,this.hi);n=new Y(n,0);for(var s=new Y(1,0);!n.cb();)n=n.Da(),s=s.Da();for(;!s.Ua();)0>=n.cmp(o)&&(r=r.add(s),o=o.sub(n)),n=n.La(),s=s.La();return[r,o]};Y.prototype.div=Y.prototype.Xa;Y.prototype.toString=function(){for(var n="",r=this;!r.Ua();){r=r.Xa(10);var o=r[0];n=r[1].lo+n,r=o}return n==""&&(n="0"),n};Y.prototype.toString=Y.prototype.toString;function zo(n){for(var r=new Y(0,0),o=new Y(0,0),s=0;s<n.length;s++){if("0">n[s]||"9"<n[s])return null;o.lo=parseInt(n[s],10),r=r.eb(10).add(o)}return r}Y.fromString=zo;Y.prototype.clone=function(){return new Y(this.lo,this.hi)};Y.prototype.clone=Y.prototype.clone;function lt(n,r){this.lo=n,this.hi=r}V("jspb.arith.Int64",lt,void 0);lt.prototype.add=function(n){return new lt((this.lo+n.lo&4294967295)>>>0>>>0,((this.hi+n.hi&4294967295)>>>0)+(4294967296<=this.lo+n.lo?1:0)>>>0)};lt.prototype.add=lt.prototype.add;lt.prototype.sub=function(n){return new lt((this.lo-n.lo&4294967295)>>>0>>>0,((this.hi-n.hi&4294967295)>>>0)-(0>this.lo-n.lo?1:0)>>>0)};lt.prototype.sub=lt.prototype.sub;lt.prototype.clone=function(){return new lt(this.lo,this.hi)};lt.prototype.clone=lt.prototype.clone;lt.prototype.toString=function(){var n=(this.hi&2147483648)!=0,r=new Y(this.lo,this.hi);return n&&(r=new Y(0,0).sub(r)),(n?"-":"")+r.toString()};lt.prototype.toString=lt.prototype.toString;function ra(n){var r=0<n.length&&n[0]=="-";return r&&(n=n.substring(1)),n=zo(n),n===null?null:(r&&(n=new Y(0,0).sub(n)),new lt(n.lo,n.hi))}lt.fromString=ra;function f(){this.c=[],this.b=0,this.a=new O,this.h=[]}V("jspb.BinaryWriter",f,void 0);function Gp(n,r){var o=n.a.end();n.c.push(o),n.c.push(r),n.b+=o.length+r.length}function Ke(n,r){return Q(n,r,2),r=n.a.end(),n.c.push(r),n.b+=r.length,r.push(n.b),r}function Xe(n,r){var o=r.pop();for(o=n.b+n.a.length()-o,W(0<=o);127<o;)r.push(o&127|128),o>>>=7,n.b++;r.push(o),n.b++}f.prototype.pb=function(n,r,o){Gp(this,n.subarray(r,o))};f.prototype.writeSerializedMessage=f.prototype.pb;f.prototype.Pb=function(n,r,o){n!=null&&r!=null&&o!=null&&this.pb(n,r,o)};f.prototype.maybeWriteSerializedMessage=f.prototype.Pb;f.prototype.reset=function(){this.c=[],this.a.end(),this.b=0,this.h=[]};f.prototype.reset=f.prototype.reset;f.prototype.ab=function(){W(this.h.length==0);for(var n=new Uint8Array(this.b+this.a.length()),r=this.c,o=r.length,s=0,i=0;i<o;i++){var a=r[i];n.set(a,s),s+=a.length}return r=this.a.end(),n.set(r,s),s+=r.length,W(s==n.length),this.c=[n],n};f.prototype.getResultBuffer=f.prototype.ab;f.prototype.Kb=function(n){return Tp(this.ab(),n)};f.prototype.getResultBase64String=f.prototype.Kb;f.prototype.Va=function(n){this.h.push(Ke(this,n))};f.prototype.beginSubMessage=f.prototype.Va;f.prototype.Ya=function(){W(0<=this.h.length),Xe(this,this.h.pop())};f.prototype.endSubMessage=f.prototype.Ya;function Q(n,r,o){W(1<=r&&r==Math.floor(r)),n.a.j(8*r+o)}f.prototype.Nc=function(n,r,o){switch(n){case 1:this.J(r,o);break;case 2:this.L(r,o);break;case 3:this.T(r,o);break;case 4:this.V(r,o);break;case 5:this.S(r,o);break;case 6:this.Qa(r,o);break;case 7:this.Pa(r,o);break;case 8:this.I(r,o);break;case 9:this.U(r,o);break;case 10:ct("Group field type not supported in writeAny()");break;case 11:ct("Message field type not supported in writeAny()");break;case 12:this.ja(r,o);break;case 13:this.s(r,o);break;case 14:this.R(r,o);break;case 15:this.Ra(r,o);break;case 16:this.Sa(r,o);break;case 17:this.rb(r,o);break;case 18:this.sb(r,o);break;case 30:this.K(r,o);break;case 31:this.N(r,o);break;default:ct("Invalid field type in writeAny()")}};f.prototype.writeAny=f.prototype.Nc;function yu(n,r,o){o!=null&&(Q(n,r,0),n.a.j(o))}function bu(n,r,o){o!=null&&(Q(n,r,0),n.a.M(o))}f.prototype.S=function(n,r){r!=null&&(W(-2147483648<=r&&2147483648>r),bu(this,n,r))};f.prototype.writeInt32=f.prototype.S;f.prototype.ob=function(n,r){r!=null&&(r=parseInt(r,10),W(-2147483648<=r&&2147483648>r),bu(this,n,r))};f.prototype.writeInt32String=f.prototype.ob;f.prototype.T=function(n,r){r!=null&&(W(-9223372036854776e3<=r&&9223372036854776e3>r),r!=null&&(Q(this,n,0),this.a.ua(r)))};f.prototype.writeInt64=f.prototype.T;f.prototype.ka=function(n,r){r!=null&&(r=ra(r),Q(this,n,0),this.a.l(r.lo,r.hi))};f.prototype.writeInt64String=f.prototype.ka;f.prototype.s=function(n,r){r!=null&&(W(0<=r&&4294967296>r),yu(this,n,r))};f.prototype.writeUint32=f.prototype.s;f.prototype.ub=function(n,r){r!=null&&(r=parseInt(r,10),W(0<=r&&4294967296>r),yu(this,n,r))};f.prototype.writeUint32String=f.prototype.ub;f.prototype.V=function(n,r){r!=null&&(W(0<=r&&18446744073709552e3>r),r!=null&&(Q(this,n,0),this.a.va(r)))};f.prototype.writeUint64=f.prototype.V;f.prototype.vb=function(n,r){r!=null&&(r=zo(r),Q(this,n,0),this.a.l(r.lo,r.hi))};f.prototype.writeUint64String=f.prototype.vb;f.prototype.rb=function(n,r){r!=null&&(W(-2147483648<=r&&2147483648>r),r!=null&&(Q(this,n,0),this.a.wa(r)))};f.prototype.writeSint32=f.prototype.rb;f.prototype.sb=function(n,r){r!=null&&(W(-9223372036854776e3<=r&&9223372036854776e3>r),r!=null&&(Q(this,n,0),this.a.xa(r)))};f.prototype.writeSint64=f.prototype.sb;f.prototype.$d=function(n,r){r!=null&&r!=null&&(Q(this,n,0),this.a.W(r))};f.prototype.writeSintHash64=f.prototype.$d;f.prototype.Zd=function(n,r){r!=null&&r!=null&&(Q(this,n,0),this.a.Ta(r))};f.prototype.writeSint64String=f.prototype.Zd;f.prototype.Pa=function(n,r){r!=null&&(W(0<=r&&4294967296>r),Q(this,n,5),this.a.s(r))};f.prototype.writeFixed32=f.prototype.Pa;f.prototype.Qa=function(n,r){r!=null&&(W(0<=r&&18446744073709552e3>r),Q(this,n,1),this.a.V(r))};f.prototype.writeFixed64=f.prototype.Qa;f.prototype.nb=function(n,r){r!=null&&(r=zo(r),Q(this,n,1),this.a.A(r.lo,r.hi))};f.prototype.writeFixed64String=f.prototype.nb;f.prototype.Ra=function(n,r){r!=null&&(W(-2147483648<=r&&2147483648>r),Q(this,n,5),this.a.S(r))};f.prototype.writeSfixed32=f.prototype.Ra;f.prototype.Sa=function(n,r){r!=null&&(W(-9223372036854776e3<=r&&9223372036854776e3>r),Q(this,n,1),this.a.T(r))};f.prototype.writeSfixed64=f.prototype.Sa;f.prototype.qb=function(n,r){r!=null&&(r=ra(r),Q(this,n,1),this.a.A(r.lo,r.hi))};f.prototype.writeSfixed64String=f.prototype.qb;f.prototype.L=function(n,r){r!=null&&(Q(this,n,5),this.a.L(r))};f.prototype.writeFloat=f.prototype.L;f.prototype.J=function(n,r){r!=null&&(Q(this,n,1),this.a.J(r))};f.prototype.writeDouble=f.prototype.J;f.prototype.I=function(n,r){r!=null&&(W(typeof r=="boolean"||typeof r=="number"),Q(this,n,0),this.a.I(r))};f.prototype.writeBool=f.prototype.I;f.prototype.R=function(n,r){r!=null&&(W(-2147483648<=r&&2147483648>r),Q(this,n,0),this.a.M(r))};f.prototype.writeEnum=f.prototype.R;f.prototype.U=function(n,r){r!=null&&(n=Ke(this,n),this.a.U(r),Xe(this,n))};f.prototype.writeString=f.prototype.U;f.prototype.ja=function(n,r){r!=null&&(r=Yi(r),Q(this,n,2),this.a.j(r.length),Gp(this,r))};f.prototype.writeBytes=f.prototype.ja;f.prototype.Rc=function(n,r,o){r!=null&&(n=Ke(this,n),o(r,this),Xe(this,n))};f.prototype.writeMessage=f.prototype.Rc;f.prototype.Sc=function(n,r,o){r!=null&&(Q(this,1,3),Q(this,2,0),this.a.M(n),n=Ke(this,3),o(r,this),Xe(this,n),Q(this,1,4))};f.prototype.writeMessageSet=f.prototype.Sc;f.prototype.Oc=function(n,r,o){r!=null&&(Q(this,n,3),o(r,this),Q(this,n,4))};f.prototype.writeGroup=f.prototype.Oc;f.prototype.K=function(n,r){r!=null&&(W(r.length==8),Q(this,n,1),this.a.K(r))};f.prototype.writeFixedHash64=f.prototype.K;f.prototype.N=function(n,r){r!=null&&(W(r.length==8),Q(this,n,0),this.a.N(r))};f.prototype.writeVarintHash64=f.prototype.N;f.prototype.A=function(n,r,o){Q(this,n,1),this.a.A(r,o)};f.prototype.writeSplitFixed64=f.prototype.A;f.prototype.l=function(n,r,o){Q(this,n,0),this.a.l(r,o)};f.prototype.writeSplitVarint64=f.prototype.l;f.prototype.tb=function(n,r,o){Q(this,n,0);var s=this.a;Hi(r,o,function(i,a){s.l(i>>>0,a>>>0)})};f.prototype.writeSplitZigzagVarint64=f.prototype.tb;f.prototype.Ed=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)bu(this,n,r[o])};f.prototype.writeRepeatedInt32=f.prototype.Ed;f.prototype.Fd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ob(n,r[o])};f.prototype.writeRepeatedInt32String=f.prototype.Fd;f.prototype.Gd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.ua(s))}};f.prototype.writeRepeatedInt64=f.prototype.Gd;f.prototype.Qd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.A(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitFixed64=f.prototype.Qd;f.prototype.Rd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.l(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitVarint64=f.prototype.Rd;f.prototype.Sd=function(n,r,o,s){if(r!=null)for(var i=0;i<r.length;i++)this.tb(n,o(r[i]),s(r[i]))};f.prototype.writeRepeatedSplitZigzagVarint64=f.prototype.Sd;f.prototype.Hd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ka(n,r[o])};f.prototype.writeRepeatedInt64String=f.prototype.Hd;f.prototype.Ud=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)yu(this,n,r[o])};f.prototype.writeRepeatedUint32=f.prototype.Ud;f.prototype.Vd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ub(n,r[o])};f.prototype.writeRepeatedUint32String=f.prototype.Vd;f.prototype.Wd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.va(s))}};f.prototype.writeRepeatedUint64=f.prototype.Wd;f.prototype.Xd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.vb(n,r[o])};f.prototype.writeRepeatedUint64String=f.prototype.Xd;f.prototype.Md=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.wa(s))}};f.prototype.writeRepeatedSint32=f.prototype.Md;f.prototype.Nd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.xa(s))}};f.prototype.writeRepeatedSint64=f.prototype.Nd;f.prototype.Od=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.Ta(s))}};f.prototype.writeRepeatedSint64String=f.prototype.Od;f.prototype.Pd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++){var s=r[o];s!=null&&(Q(this,n,0),this.a.W(s))}};f.prototype.writeRepeatedSintHash64=f.prototype.Pd;f.prototype.yd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Pa(n,r[o])};f.prototype.writeRepeatedFixed32=f.prototype.yd;f.prototype.zd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Qa(n,r[o])};f.prototype.writeRepeatedFixed64=f.prototype.zd;f.prototype.Ad=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.nb(n,r[o])};f.prototype.writeRepeatedFixed64String=f.prototype.Ad;f.prototype.Jd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Ra(n,r[o])};f.prototype.writeRepeatedSfixed32=f.prototype.Jd;f.prototype.Kd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.Sa(n,r[o])};f.prototype.writeRepeatedSfixed64=f.prototype.Kd;f.prototype.Ld=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.qb(n,r[o])};f.prototype.writeRepeatedSfixed64String=f.prototype.Ld;f.prototype.Cd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.L(n,r[o])};f.prototype.writeRepeatedFloat=f.prototype.Cd;f.prototype.wd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.J(n,r[o])};f.prototype.writeRepeatedDouble=f.prototype.wd;f.prototype.ud=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.I(n,r[o])};f.prototype.writeRepeatedBool=f.prototype.ud;f.prototype.xd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.R(n,r[o])};f.prototype.writeRepeatedEnum=f.prototype.xd;f.prototype.Td=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.U(n,r[o])};f.prototype.writeRepeatedString=f.prototype.Td;f.prototype.vd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.ja(n,r[o])};f.prototype.writeRepeatedBytes=f.prototype.vd;f.prototype.Id=function(n,r,o){if(r!=null)for(var s=0;s<r.length;s++){var i=Ke(this,n);o(r[s],this),Xe(this,i)}};f.prototype.writeRepeatedMessage=f.prototype.Id;f.prototype.Dd=function(n,r,o){if(r!=null)for(var s=0;s<r.length;s++)Q(this,n,3),o(r[s],this),Q(this,n,4)};f.prototype.writeRepeatedGroup=f.prototype.Dd;f.prototype.Bd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.K(n,r[o])};f.prototype.writeRepeatedFixedHash64=f.prototype.Bd;f.prototype.Yd=function(n,r){if(r!=null)for(var o=0;o<r.length;o++)this.N(n,r[o])};f.prototype.writeRepeatedVarintHash64=f.prototype.Yd;f.prototype.ad=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.M(r[o]);Xe(this,n)}};f.prototype.writePackedInt32=f.prototype.ad;f.prototype.bd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.M(parseInt(r[o],10));Xe(this,n)}};f.prototype.writePackedInt32String=f.prototype.bd;f.prototype.cd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.ua(r[o]);Xe(this,n)}};f.prototype.writePackedInt64=f.prototype.cd;f.prototype.md=function(n,r,o,s){if(r!=null){n=Ke(this,n);for(var i=0;i<r.length;i++)this.a.A(o(r[i]),s(r[i]));Xe(this,n)}};f.prototype.writePackedSplitFixed64=f.prototype.md;f.prototype.nd=function(n,r,o,s){if(r!=null){n=Ke(this,n);for(var i=0;i<r.length;i++)this.a.l(o(r[i]),s(r[i]));Xe(this,n)}};f.prototype.writePackedSplitVarint64=f.prototype.nd;f.prototype.od=function(n,r,o,s){if(r!=null){n=Ke(this,n);for(var i=this.a,a=0;a<r.length;a++)Hi(o(r[a]),s(r[a]),function(c,u){i.l(c>>>0,u>>>0)});Xe(this,n)}};f.prototype.writePackedSplitZigzagVarint64=f.prototype.od;f.prototype.dd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++){var s=ra(r[o]);this.a.l(s.lo,s.hi)}Xe(this,n)}};f.prototype.writePackedInt64String=f.prototype.dd;f.prototype.pd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.j(r[o]);Xe(this,n)}};f.prototype.writePackedUint32=f.prototype.pd;f.prototype.qd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.j(parseInt(r[o],10));Xe(this,n)}};f.prototype.writePackedUint32String=f.prototype.qd;f.prototype.rd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.va(r[o]);Xe(this,n)}};f.prototype.writePackedUint64=f.prototype.rd;f.prototype.sd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++){var s=zo(r[o]);this.a.l(s.lo,s.hi)}Xe(this,n)}};f.prototype.writePackedUint64String=f.prototype.sd;f.prototype.hd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.wa(r[o]);Xe(this,n)}};f.prototype.writePackedSint32=f.prototype.hd;f.prototype.jd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.xa(r[o]);Xe(this,n)}};f.prototype.writePackedSint64=f.prototype.jd;f.prototype.kd=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.W(zs(r[o]));Xe(this,n)}};f.prototype.writePackedSint64String=f.prototype.kd;f.prototype.ld=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.W(r[o]);Xe(this,n)}};f.prototype.writePackedSintHash64=f.prototype.ld;f.prototype.Wc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.s(r[n])};f.prototype.writePackedFixed32=f.prototype.Wc;f.prototype.Xc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.V(r[n])};f.prototype.writePackedFixed64=f.prototype.Xc;f.prototype.Yc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++){var o=zo(r[n]);this.a.A(o.lo,o.hi)}};f.prototype.writePackedFixed64String=f.prototype.Yc;f.prototype.ed=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.S(r[n])};f.prototype.writePackedSfixed32=f.prototype.ed;f.prototype.fd=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.T(r[n])};f.prototype.writePackedSfixed64=f.prototype.fd;f.prototype.gd=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.ka(r[n])};f.prototype.writePackedSfixed64String=f.prototype.gd;f.prototype.$c=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(4*r.length),n=0;n<r.length;n++)this.a.L(r[n])};f.prototype.writePackedFloat=f.prototype.$c;f.prototype.Uc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.J(r[n])};f.prototype.writePackedDouble=f.prototype.Uc;f.prototype.Tc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(r.length),n=0;n<r.length;n++)this.a.I(r[n])};f.prototype.writePackedBool=f.prototype.Tc;f.prototype.Vc=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.R(r[o]);Xe(this,n)}};f.prototype.writePackedEnum=f.prototype.Vc;f.prototype.Zc=function(n,r){if(r!=null&&r.length)for(Q(this,n,2),this.a.j(8*r.length),n=0;n<r.length;n++)this.a.K(r[n])};f.prototype.writePackedFixedHash64=f.prototype.Zc;f.prototype.td=function(n,r){if(r!=null&&r.length){n=Ke(this,n);for(var o=0;o<r.length;o++)this.a.N(r[o]);Xe(this,n)}};f.prototype.writePackedVarintHash64=f.prototype.td;typeof Tt=="object"&&(Tt.debug=Br,Tt.Map=ee,Tt.Message=N,Tt.BinaryReader=h,Tt.BinaryWriter=f,Tt.ExtensionFieldInfo=Os,Tt.ExtensionFieldBinaryInfo=kp,Tt.exportSymbol=rh,Tt.inherits=nh,Tt.object={extend:oh},Tt.typeOf=dn)});var $p=Ot(Lp=>{var tr=mr(),na=tr,Tu=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Tu<"u"&&Tu||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();na.exportSymbol("proto.google.protobuf.Any",null,Tu);proto.google.protobuf.Any=function(n){tr.Message.initialize(this,n,0,-1,null,null)};na.inherits(proto.google.protobuf.Any,tr.Message);na.DEBUG&&!COMPILED&&(proto.google.protobuf.Any.displayName="proto.google.protobuf.Any");tr.Message.GENERATE_TO_OBJECT&&(proto.google.protobuf.Any.prototype.toObject=function(n){return proto.google.protobuf.Any.toObject(n,this)},proto.google.protobuf.Any.toObject=function(n,r){var o,s={typeUrl:tr.Message.getFieldWithDefault(r,1,""),value:r.getValue_asB64()};return n&&(s.$jspbMessageInstance=r),s});proto.google.protobuf.Any.deserializeBinary=function(n){var r=new tr.BinaryReader(n),o=new proto.google.protobuf.Any;return proto.google.protobuf.Any.deserializeBinaryFromReader(o,r)};proto.google.protobuf.Any.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readString();n.setTypeUrl(s);break;case 2:var s=r.readBytes();n.setValue(s);break;default:r.skipField();break}}return n};proto.google.protobuf.Any.prototype.serializeBinary=function(){var n=new tr.BinaryWriter;return proto.google.protobuf.Any.serializeBinaryToWriter(this,n),n.getResultBuffer()};proto.google.protobuf.Any.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getTypeUrl(),o.length>0&&r.writeString(1,o),o=n.getValue_asU8(),o.length>0&&r.writeBytes(2,o)};proto.google.protobuf.Any.prototype.getTypeUrl=function(){return tr.Message.getFieldWithDefault(this,1,"")};proto.google.protobuf.Any.prototype.setTypeUrl=function(n){return tr.Message.setProto3StringField(this,1,n)};proto.google.protobuf.Any.prototype.getValue=function(){return tr.Message.getFieldWithDefault(this,2,"")};proto.google.protobuf.Any.prototype.getValue_asB64=function(){return tr.Message.bytesAsB64(this.getValue())};proto.google.protobuf.Any.prototype.getValue_asU8=function(){return tr.Message.bytesAsU8(this.getValue())};proto.google.protobuf.Any.prototype.setValue=function(n){return tr.Message.setProto3BytesField(this,2,n)};na.object.extend(Lp,proto.google.protobuf);proto.google.protobuf.Any.prototype.getTypeName=function(){return this.getTypeUrl().split("/").pop()};proto.google.protobuf.Any.prototype.pack=function(n,r,o){o||(o="type.googleapis.com/"),o.substr(-1)!="/"?this.setTypeUrl(o+"/"+r):this.setTypeUrl(o+r),this.setValue(n)};proto.google.protobuf.Any.prototype.unpack=function(n,r){return this.getTypeName()==r?n(this.getValue_asU8()):null}});var oa=Ot(Zp=>{var d=mr(),J=d,Ue=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Ue<"u"&&Ue||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),Vo=$p();J.object.extend(proto,Vo);J.exportSymbol("TronWebProto.Account",null,Ue);J.exportSymbol("TronWebProto.Account.AccountResource",null,Ue);J.exportSymbol("TronWebProto.Account.Frozen",null,Ue);J.exportSymbol("TronWebProto.AccountId",null,Ue);J.exportSymbol("TronWebProto.AccountType",null,Ue);J.exportSymbol("TronWebProto.DelegatedResource",null,Ue);J.exportSymbol("TronWebProto.Exchange",null,Ue);J.exportSymbol("TronWebProto.Key",null,Ue);J.exportSymbol("TronWebProto.MarketOrderDetail",null,Ue);J.exportSymbol("TronWebProto.Permission",null,Ue);J.exportSymbol("TronWebProto.Permission.PermissionType",null,Ue);J.exportSymbol("TronWebProto.Proposal",null,Ue);J.exportSymbol("TronWebProto.Proposal.State",null,Ue);J.exportSymbol("TronWebProto.Transaction",null,Ue);J.exportSymbol("TronWebProto.Transaction.Contract",null,Ue);J.exportSymbol("TronWebProto.Transaction.Contract.ContractType",null,Ue);J.exportSymbol("TronWebProto.Transaction.Result",null,Ue);J.exportSymbol("TronWebProto.Transaction.Result.code",null,Ue);J.exportSymbol("TronWebProto.Transaction.Result.contractResult",null,Ue);J.exportSymbol("TronWebProto.Transaction.raw",null,Ue);J.exportSymbol("TronWebProto.Vote",null,Ue);J.exportSymbol("TronWebProto.Votes",null,Ue);J.exportSymbol("TronWebProto.Witness",null,Ue);J.exportSymbol("TronWebProto.authority",null,Ue);TronWebProto.AccountId=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.AccountId,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.AccountId.displayName="TronWebProto.AccountId");TronWebProto.Vote=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Vote,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Vote.displayName="TronWebProto.Vote");TronWebProto.Proposal=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Proposal.repeatedFields_,null)};J.inherits(TronWebProto.Proposal,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Proposal.displayName="TronWebProto.Proposal");TronWebProto.Exchange=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Exchange,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Exchange.displayName="TronWebProto.Exchange");TronWebProto.Account=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Account.repeatedFields_,null)};J.inherits(TronWebProto.Account,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.displayName="TronWebProto.Account");TronWebProto.Account.Frozen=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Account.Frozen,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.Frozen.displayName="TronWebProto.Account.Frozen");TronWebProto.Account.AccountResource=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Account.AccountResource,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Account.AccountResource.displayName="TronWebProto.Account.AccountResource");TronWebProto.Key=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Key,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Key.displayName="TronWebProto.Key");TronWebProto.DelegatedResource=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.DelegatedResource,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.DelegatedResource.displayName="TronWebProto.DelegatedResource");TronWebProto.authority=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.authority,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.authority.displayName="TronWebProto.authority");TronWebProto.Permission=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Permission.repeatedFields_,null)};J.inherits(TronWebProto.Permission,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Permission.displayName="TronWebProto.Permission");TronWebProto.Witness=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Witness,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Witness.displayName="TronWebProto.Witness");TronWebProto.Votes=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Votes.repeatedFields_,null)};J.inherits(TronWebProto.Votes,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Votes.displayName="TronWebProto.Votes");TronWebProto.MarketOrderDetail=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.MarketOrderDetail,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.MarketOrderDetail.displayName="TronWebProto.MarketOrderDetail");TronWebProto.Transaction=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.repeatedFields_,null)};J.inherits(TronWebProto.Transaction,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.displayName="TronWebProto.Transaction");TronWebProto.Transaction.Contract=function(n){d.Message.initialize(this,n,0,-1,null,null)};J.inherits(TronWebProto.Transaction.Contract,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.Contract.displayName="TronWebProto.Transaction.Contract");TronWebProto.Transaction.Result=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.Result.repeatedFields_,null)};J.inherits(TronWebProto.Transaction.Result,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.Result.displayName="TronWebProto.Transaction.Result");TronWebProto.Transaction.raw=function(n){d.Message.initialize(this,n,0,-1,TronWebProto.Transaction.raw.repeatedFields_,null)};J.inherits(TronWebProto.Transaction.raw,d.Message);J.DEBUG&&!COMPILED&&(TronWebProto.Transaction.raw.displayName="TronWebProto.Transaction.raw");d.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountId.prototype.toObject=function(n){return TronWebProto.AccountId.toObject(n,this)},TronWebProto.AccountId.toObject=function(n,r){var o,s={name:r.getName_asB64(),address:r.getAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountId.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.AccountId;return TronWebProto.AccountId.deserializeBinaryFromReader(o,r)};TronWebProto.AccountId.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setName(s);break;case 2:var s=r.readBytes();n.setAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountId.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.AccountId.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountId.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.AccountId.prototype.getName=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountId.prototype.getName_asB64=function(){return d.Message.bytesAsB64(this.getName())};TronWebProto.AccountId.prototype.getName_asU8=function(){return d.Message.bytesAsU8(this.getName())};TronWebProto.AccountId.prototype.setName=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountId.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountId.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.AccountId.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.AccountId.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Vote.prototype.toObject=function(n){return TronWebProto.Vote.toObject(n,this)},TronWebProto.Vote.toObject=function(n,r){var o,s={voteAddress:r.getVoteAddress_asB64(),voteCount:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Vote.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Vote;return TronWebProto.Vote.deserializeBinaryFromReader(o,r)};TronWebProto.Vote.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setVoteAddress(s);break;case 2:var s=r.readInt64();n.setVoteCount(s);break;default:r.skipField();break}}return n};TronWebProto.Vote.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Vote.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Vote.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getVoteAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVoteCount(),o!==0&&r.writeInt64(2,o)};TronWebProto.Vote.prototype.getVoteAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Vote.prototype.getVoteAddress_asB64=function(){return d.Message.bytesAsB64(this.getVoteAddress())};TronWebProto.Vote.prototype.getVoteAddress_asU8=function(){return d.Message.bytesAsU8(this.getVoteAddress())};TronWebProto.Vote.prototype.setVoteAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Vote.prototype.getVoteCount=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Vote.prototype.setVoteCount=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Proposal.repeatedFields_=[6];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Proposal.prototype.toObject=function(n){return TronWebProto.Proposal.toObject(n,this)},TronWebProto.Proposal.toObject=function(n,r){var o,s={proposalId:d.Message.getFieldWithDefault(r,1,0),proposerAddress:r.getProposerAddress_asB64(),parametersMap:(o=r.getParametersMap())?o.toObject(n,void 0):[],expirationTime:d.Message.getFieldWithDefault(r,4,0),createTime:d.Message.getFieldWithDefault(r,5,0),approvalsList:r.getApprovalsList_asB64(),state:d.Message.getFieldWithDefault(r,7,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Proposal.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Proposal;return TronWebProto.Proposal.deserializeBinaryFromReader(o,r)};TronWebProto.Proposal.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setProposalId(s);break;case 2:var s=r.readBytes();n.setProposerAddress(s);break;case 3:var s=n.getParametersMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readInt64,d.BinaryReader.prototype.readInt64,null,0,0)});break;case 4:var s=r.readInt64();n.setExpirationTime(s);break;case 5:var s=r.readInt64();n.setCreateTime(s);break;case 6:var s=r.readBytes();n.addApprovals(s);break;case 7:var s=r.readEnum();n.setState(s);break;default:r.skipField();break}}return n};TronWebProto.Proposal.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Proposal.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Proposal.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getProposalId(),o!==0&&r.writeInt64(1,o),o=n.getProposerAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getParametersMap(!0),o&&o.getLength()>0&&o.serializeBinary(3,r,d.BinaryWriter.prototype.writeInt64,d.BinaryWriter.prototype.writeInt64),o=n.getExpirationTime(),o!==0&&r.writeInt64(4,o),o=n.getCreateTime(),o!==0&&r.writeInt64(5,o),o=n.getApprovalsList_asU8(),o.length>0&&r.writeRepeatedBytes(6,o),o=n.getState(),o!==0&&r.writeEnum(7,o)};TronWebProto.Proposal.State={PENDING:0,DISAPPROVED:1,APPROVED:2,CANCELED:3};TronWebProto.Proposal.prototype.getProposalId=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Proposal.prototype.setProposalId=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Proposal.prototype.getProposerAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.Proposal.prototype.getProposerAddress_asB64=function(){return d.Message.bytesAsB64(this.getProposerAddress())};TronWebProto.Proposal.prototype.getProposerAddress_asU8=function(){return d.Message.bytesAsU8(this.getProposerAddress())};TronWebProto.Proposal.prototype.setProposerAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Proposal.prototype.getParametersMap=function(n){return d.Message.getMapField(this,3,n,null)};TronWebProto.Proposal.prototype.clearParametersMap=function(){return this.getParametersMap().clear(),this};TronWebProto.Proposal.prototype.getExpirationTime=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Proposal.prototype.setExpirationTime=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Proposal.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Proposal.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Proposal.prototype.getApprovalsList=function(){return d.Message.getRepeatedField(this,6)};TronWebProto.Proposal.prototype.getApprovalsList_asB64=function(){return d.Message.bytesListAsB64(this.getApprovalsList())};TronWebProto.Proposal.prototype.getApprovalsList_asU8=function(){return d.Message.bytesListAsU8(this.getApprovalsList())};TronWebProto.Proposal.prototype.setApprovalsList=function(n){return d.Message.setField(this,6,n||[])};TronWebProto.Proposal.prototype.addApprovals=function(n,r){return d.Message.addToRepeatedField(this,6,n,r)};TronWebProto.Proposal.prototype.clearApprovalsList=function(){return this.setApprovalsList([])};TronWebProto.Proposal.prototype.getState=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Proposal.prototype.setState=function(n){return d.Message.setProto3EnumField(this,7,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Exchange.prototype.toObject=function(n){return TronWebProto.Exchange.toObject(n,this)},TronWebProto.Exchange.toObject=function(n,r){var o,s={exchangeId:d.Message.getFieldWithDefault(r,1,0),creatorAddress:r.getCreatorAddress_asB64(),createTime:d.Message.getFieldWithDefault(r,3,0),firstTokenId:r.getFirstTokenId_asB64(),firstTokenBalance:d.Message.getFieldWithDefault(r,7,0),secondTokenId:r.getSecondTokenId_asB64(),secondTokenBalance:d.Message.getFieldWithDefault(r,9,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Exchange.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Exchange;return TronWebProto.Exchange.deserializeBinaryFromReader(o,r)};TronWebProto.Exchange.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setExchangeId(s);break;case 2:var s=r.readBytes();n.setCreatorAddress(s);break;case 3:var s=r.readInt64();n.setCreateTime(s);break;case 6:var s=r.readBytes();n.setFirstTokenId(s);break;case 7:var s=r.readInt64();n.setFirstTokenBalance(s);break;case 8:var s=r.readBytes();n.setSecondTokenId(s);break;case 9:var s=r.readInt64();n.setSecondTokenBalance(s);break;default:r.skipField();break}}return n};TronWebProto.Exchange.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Exchange.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Exchange.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getExchangeId(),o!==0&&r.writeInt64(1,o),o=n.getCreatorAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getCreateTime(),o!==0&&r.writeInt64(3,o),o=n.getFirstTokenId_asU8(),o.length>0&&r.writeBytes(6,o),o=n.getFirstTokenBalance(),o!==0&&r.writeInt64(7,o),o=n.getSecondTokenId_asU8(),o.length>0&&r.writeBytes(8,o),o=n.getSecondTokenBalance(),o!==0&&r.writeInt64(9,o)};TronWebProto.Exchange.prototype.getExchangeId=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Exchange.prototype.setExchangeId=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Exchange.prototype.getCreatorAddress=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.Exchange.prototype.getCreatorAddress_asB64=function(){return d.Message.bytesAsB64(this.getCreatorAddress())};TronWebProto.Exchange.prototype.getCreatorAddress_asU8=function(){return d.Message.bytesAsU8(this.getCreatorAddress())};TronWebProto.Exchange.prototype.setCreatorAddress=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Exchange.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Exchange.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Exchange.prototype.getFirstTokenId=function(){return d.Message.getFieldWithDefault(this,6,"")};TronWebProto.Exchange.prototype.getFirstTokenId_asB64=function(){return d.Message.bytesAsB64(this.getFirstTokenId())};TronWebProto.Exchange.prototype.getFirstTokenId_asU8=function(){return d.Message.bytesAsU8(this.getFirstTokenId())};TronWebProto.Exchange.prototype.setFirstTokenId=function(n){return d.Message.setProto3BytesField(this,6,n)};TronWebProto.Exchange.prototype.getFirstTokenBalance=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Exchange.prototype.setFirstTokenBalance=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Exchange.prototype.getSecondTokenId=function(){return d.Message.getFieldWithDefault(this,8,"")};TronWebProto.Exchange.prototype.getSecondTokenId_asB64=function(){return d.Message.bytesAsB64(this.getSecondTokenId())};TronWebProto.Exchange.prototype.getSecondTokenId_asU8=function(){return d.Message.bytesAsU8(this.getSecondTokenId())};TronWebProto.Exchange.prototype.setSecondTokenId=function(n){return d.Message.setProto3BytesField(this,8,n)};TronWebProto.Exchange.prototype.getSecondTokenBalance=function(){return d.Message.getFieldWithDefault(this,9,0)};TronWebProto.Exchange.prototype.setSecondTokenBalance=function(n){return d.Message.setProto3IntField(this,9,n)};TronWebProto.Account.repeatedFields_=[5,7,16,33];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.prototype.toObject=function(n){return TronWebProto.Account.toObject(n,this)},TronWebProto.Account.toObject=function(n,r){var o,s={accountName:r.getAccountName_asB64(),type:d.Message.getFieldWithDefault(r,2,0),address:r.getAddress_asB64(),balance:d.Message.getFieldWithDefault(r,4,0),votesList:d.Message.toObjectList(r.getVotesList(),TronWebProto.Vote.toObject,n),assetMap:(o=r.getAssetMap())?o.toObject(n,void 0):[],assetv2Map:(o=r.getAssetv2Map())?o.toObject(n,void 0):[],frozenList:d.Message.toObjectList(r.getFrozenList(),TronWebProto.Account.Frozen.toObject,n),netUsage:d.Message.getFieldWithDefault(r,8,0),acquiredDelegatedFrozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,41,0),delegatedFrozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,42,0),oldTronPower:d.Message.getFieldWithDefault(r,46,0),tronPower:(o=r.getTronPower())&&TronWebProto.Account.Frozen.toObject(n,o),assetOptimized:d.Message.getBooleanFieldWithDefault(r,60,!1),createTime:d.Message.getFieldWithDefault(r,9,0),latestOprationTime:d.Message.getFieldWithDefault(r,10,0),allowance:d.Message.getFieldWithDefault(r,11,0),latestWithdrawTime:d.Message.getFieldWithDefault(r,12,0),code:r.getCode_asB64(),isWitness:d.Message.getBooleanFieldWithDefault(r,14,!1),isCommittee:d.Message.getBooleanFieldWithDefault(r,15,!1),frozenSupplyList:d.Message.toObjectList(r.getFrozenSupplyList(),TronWebProto.Account.Frozen.toObject,n),assetIssuedName:r.getAssetIssuedName_asB64(),assetIssuedId:r.getAssetIssuedId_asB64(),latestAssetOperationTimeMap:(o=r.getLatestAssetOperationTimeMap())?o.toObject(n,void 0):[],latestAssetOperationTimev2Map:(o=r.getLatestAssetOperationTimev2Map())?o.toObject(n,void 0):[],freeNetUsage:d.Message.getFieldWithDefault(r,19,0),freeAssetNetUsageMap:(o=r.getFreeAssetNetUsageMap())?o.toObject(n,void 0):[],freeAssetNetUsagev2Map:(o=r.getFreeAssetNetUsagev2Map())?o.toObject(n,void 0):[],latestConsumeTime:d.Message.getFieldWithDefault(r,21,0),latestConsumeFreeTime:d.Message.getFieldWithDefault(r,22,0),accountId:r.getAccountId_asB64(),accountResource:(o=r.getAccountResource())&&TronWebProto.Account.AccountResource.toObject(n,o),codehash:r.getCodehash_asB64(),ownerPermission:(o=r.getOwnerPermission())&&TronWebProto.Permission.toObject(n,o),witnessPermission:(o=r.getWitnessPermission())&&TronWebProto.Permission.toObject(n,o),activePermissionList:d.Message.toObjectList(r.getActivePermissionList(),TronWebProto.Permission.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account;return TronWebProto.Account.deserializeBinaryFromReader(o,r)};TronWebProto.Account.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountName(s);break;case 2:var s=r.readEnum();n.setType(s);break;case 3:var s=r.readBytes();n.setAddress(s);break;case 4:var s=r.readInt64();n.setBalance(s);break;case 5:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addVotes(s);break;case 6:var s=n.getAssetMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 56:var s=n.getAssetv2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 7:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.addFrozen(s);break;case 8:var s=r.readInt64();n.setNetUsage(s);break;case 41:var s=r.readInt64();n.setAcquiredDelegatedFrozenBalanceForBandwidth(s);break;case 42:var s=r.readInt64();n.setDelegatedFrozenBalanceForBandwidth(s);break;case 46:var s=r.readInt64();n.setOldTronPower(s);break;case 47:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.setTronPower(s);break;case 60:var s=r.readBool();n.setAssetOptimized(s);break;case 9:var s=r.readInt64();n.setCreateTime(s);break;case 10:var s=r.readInt64();n.setLatestOprationTime(s);break;case 11:var s=r.readInt64();n.setAllowance(s);break;case 12:var s=r.readInt64();n.setLatestWithdrawTime(s);break;case 13:var s=r.readBytes();n.setCode(s);break;case 14:var s=r.readBool();n.setIsWitness(s);break;case 15:var s=r.readBool();n.setIsCommittee(s);break;case 16:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.addFrozenSupply(s);break;case 17:var s=r.readBytes();n.setAssetIssuedName(s);break;case 57:var s=r.readBytes();n.setAssetIssuedId(s);break;case 18:var s=n.getLatestAssetOperationTimeMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 58:var s=n.getLatestAssetOperationTimev2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 19:var s=r.readInt64();n.setFreeNetUsage(s);break;case 20:var s=n.getFreeAssetNetUsageMap();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 59:var s=n.getFreeAssetNetUsagev2Map();r.readMessage(s,function(i,a){d.Map.deserializeBinary(i,a,d.BinaryReader.prototype.readString,d.BinaryReader.prototype.readInt64,null,"",0)});break;case 21:var s=r.readInt64();n.setLatestConsumeTime(s);break;case 22:var s=r.readInt64();n.setLatestConsumeFreeTime(s);break;case 23:var s=r.readBytes();n.setAccountId(s);break;case 26:var s=new TronWebProto.Account.AccountResource;r.readMessage(s,TronWebProto.Account.AccountResource.deserializeBinaryFromReader),n.setAccountResource(s);break;case 30:var s=r.readBytes();n.setCodehash(s);break;case 31:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.setOwnerPermission(s);break;case 32:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.setWitnessPermission(s);break;case 33:var s=new TronWebProto.Permission;r.readMessage(s,TronWebProto.Permission.deserializeBinaryFromReader),n.addActivePermission(s);break;default:r.skipField();break}}return n};TronWebProto.Account.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getType(),o!==0&&r.writeEnum(2,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getBalance(),o!==0&&r.writeInt64(4,o),o=n.getVotesList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.Vote.serializeBinaryToWriter),o=n.getAssetMap(!0),o&&o.getLength()>0&&o.serializeBinary(6,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getAssetv2Map(!0),o&&o.getLength()>0&&o.serializeBinary(56,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFrozenList(),o.length>0&&r.writeRepeatedMessage(7,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getNetUsage(),o!==0&&r.writeInt64(8,o),o=n.getAcquiredDelegatedFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(41,o),o=n.getDelegatedFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(42,o),o=n.getOldTronPower(),o!==0&&r.writeInt64(46,o),o=n.getTronPower(),o!=null&&r.writeMessage(47,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getAssetOptimized(),o&&r.writeBool(60,o),o=n.getCreateTime(),o!==0&&r.writeInt64(9,o),o=n.getLatestOprationTime(),o!==0&&r.writeInt64(10,o),o=n.getAllowance(),o!==0&&r.writeInt64(11,o),o=n.getLatestWithdrawTime(),o!==0&&r.writeInt64(12,o),o=n.getCode_asU8(),o.length>0&&r.writeBytes(13,o),o=n.getIsWitness(),o&&r.writeBool(14,o),o=n.getIsCommittee(),o&&r.writeBool(15,o),o=n.getFrozenSupplyList(),o.length>0&&r.writeRepeatedMessage(16,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getAssetIssuedName_asU8(),o.length>0&&r.writeBytes(17,o),o=n.getAssetIssuedId_asU8(),o.length>0&&r.writeBytes(57,o),o=n.getLatestAssetOperationTimeMap(!0),o&&o.getLength()>0&&o.serializeBinary(18,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getLatestAssetOperationTimev2Map(!0),o&&o.getLength()>0&&o.serializeBinary(58,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFreeNetUsage(),o!==0&&r.writeInt64(19,o),o=n.getFreeAssetNetUsageMap(!0),o&&o.getLength()>0&&o.serializeBinary(20,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getFreeAssetNetUsagev2Map(!0),o&&o.getLength()>0&&o.serializeBinary(59,r,d.BinaryWriter.prototype.writeString,d.BinaryWriter.prototype.writeInt64),o=n.getLatestConsumeTime(),o!==0&&r.writeInt64(21,o),o=n.getLatestConsumeFreeTime(),o!==0&&r.writeInt64(22,o),o=n.getAccountId_asU8(),o.length>0&&r.writeBytes(23,o),o=n.getAccountResource(),o!=null&&r.writeMessage(26,o,TronWebProto.Account.AccountResource.serializeBinaryToWriter),o=n.getCodehash_asU8(),o.length>0&&r.writeBytes(30,o),o=n.getOwnerPermission(),o!=null&&r.writeMessage(31,o,TronWebProto.Permission.serializeBinaryToWriter),o=n.getWitnessPermission(),o!=null&&r.writeMessage(32,o,TronWebProto.Permission.serializeBinaryToWriter),o=n.getActivePermissionList(),o.length>0&&r.writeRepeatedMessage(33,o,TronWebProto.Permission.serializeBinaryToWriter)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.Frozen.prototype.toObject=function(n){return TronWebProto.Account.Frozen.toObject(n,this)},TronWebProto.Account.Frozen.toObject=function(n,r){var o,s={frozenBalance:d.Message.getFieldWithDefault(r,1,0),expireTime:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.Frozen.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account.Frozen;return TronWebProto.Account.Frozen.deserializeBinaryFromReader(o,r)};TronWebProto.Account.Frozen.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFrozenBalance(s);break;case 2:var s=r.readInt64();n.setExpireTime(s);break;default:r.skipField();break}}return n};TronWebProto.Account.Frozen.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.Frozen.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.Frozen.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrozenBalance(),o!==0&&r.writeInt64(1,o),o=n.getExpireTime(),o!==0&&r.writeInt64(2,o)};TronWebProto.Account.Frozen.prototype.getFrozenBalance=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Account.Frozen.prototype.setFrozenBalance=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Account.Frozen.prototype.getExpireTime=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Account.Frozen.prototype.setExpireTime=function(n){return d.Message.setProto3IntField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Account.AccountResource.prototype.toObject=function(n){return TronWebProto.Account.AccountResource.toObject(n,this)},TronWebProto.Account.AccountResource.toObject=function(n,r){var o,s={energyUsage:d.Message.getFieldWithDefault(r,1,0),frozenBalanceForEnergy:(o=r.getFrozenBalanceForEnergy())&&TronWebProto.Account.Frozen.toObject(n,o),latestConsumeTimeForEnergy:d.Message.getFieldWithDefault(r,3,0),acquiredDelegatedFrozenBalanceForEnergy:d.Message.getFieldWithDefault(r,4,0),delegatedFrozenBalanceForEnergy:d.Message.getFieldWithDefault(r,5,0),storageLimit:d.Message.getFieldWithDefault(r,6,0),storageUsage:d.Message.getFieldWithDefault(r,7,0),latestExchangeStorageTime:d.Message.getFieldWithDefault(r,8,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Account.AccountResource.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Account.AccountResource;return TronWebProto.Account.AccountResource.deserializeBinaryFromReader(o,r)};TronWebProto.Account.AccountResource.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setEnergyUsage(s);break;case 2:var s=new TronWebProto.Account.Frozen;r.readMessage(s,TronWebProto.Account.Frozen.deserializeBinaryFromReader),n.setFrozenBalanceForEnergy(s);break;case 3:var s=r.readInt64();n.setLatestConsumeTimeForEnergy(s);break;case 4:var s=r.readInt64();n.setAcquiredDelegatedFrozenBalanceForEnergy(s);break;case 5:var s=r.readInt64();n.setDelegatedFrozenBalanceForEnergy(s);break;case 6:var s=r.readInt64();n.setStorageLimit(s);break;case 7:var s=r.readInt64();n.setStorageUsage(s);break;case 8:var s=r.readInt64();n.setLatestExchangeStorageTime(s);break;default:r.skipField();break}}return n};TronWebProto.Account.AccountResource.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Account.AccountResource.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Account.AccountResource.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEnergyUsage(),o!==0&&r.writeInt64(1,o),o=n.getFrozenBalanceForEnergy(),o!=null&&r.writeMessage(2,o,TronWebProto.Account.Frozen.serializeBinaryToWriter),o=n.getLatestConsumeTimeForEnergy(),o!==0&&r.writeInt64(3,o),o=n.getAcquiredDelegatedFrozenBalanceForEnergy(),o!==0&&r.writeInt64(4,o),o=n.getDelegatedFrozenBalanceForEnergy(),o!==0&&r.writeInt64(5,o),o=n.getStorageLimit(),o!==0&&r.writeInt64(6,o),o=n.getStorageUsage(),o!==0&&r.writeInt64(7,o),o=n.getLatestExchangeStorageTime(),o!==0&&r.writeInt64(8,o)};TronWebProto.Account.AccountResource.prototype.getEnergyUsage=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Account.AccountResource.prototype.setEnergyUsage=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Account.AccountResource.prototype.getFrozenBalanceForEnergy=function(){return d.Message.getWrapperField(this,TronWebProto.Account.Frozen,2)};TronWebProto.Account.AccountResource.prototype.setFrozenBalanceForEnergy=function(n){return d.Message.setWrapperField(this,2,n)};TronWebProto.Account.AccountResource.prototype.clearFrozenBalanceForEnergy=function(){return this.setFrozenBalanceForEnergy(void 0)};TronWebProto.Account.AccountResource.prototype.hasFrozenBalanceForEnergy=function(){return d.Message.getField(this,2)!=null};TronWebProto.Account.AccountResource.prototype.getLatestConsumeTimeForEnergy=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Account.AccountResource.prototype.setLatestConsumeTimeForEnergy=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Account.AccountResource.prototype.getAcquiredDelegatedFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Account.AccountResource.prototype.setAcquiredDelegatedFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Account.AccountResource.prototype.getDelegatedFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Account.AccountResource.prototype.setDelegatedFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Account.AccountResource.prototype.getStorageLimit=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.Account.AccountResource.prototype.setStorageLimit=function(n){return d.Message.setProto3IntField(this,6,n)};TronWebProto.Account.AccountResource.prototype.getStorageUsage=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Account.AccountResource.prototype.setStorageUsage=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Account.AccountResource.prototype.getLatestExchangeStorageTime=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Account.AccountResource.prototype.setLatestExchangeStorageTime=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Account.prototype.getAccountName=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Account.prototype.getAccountName_asB64=function(){return d.Message.bytesAsB64(this.getAccountName())};TronWebProto.Account.prototype.getAccountName_asU8=function(){return d.Message.bytesAsU8(this.getAccountName())};TronWebProto.Account.prototype.setAccountName=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Account.prototype.getType=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Account.prototype.setType=function(n){return d.Message.setProto3EnumField(this,2,n)};TronWebProto.Account.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Account.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Account.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Account.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Account.prototype.getBalance=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Account.prototype.setBalance=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Account.prototype.getVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,5)};TronWebProto.Account.prototype.setVotesList=function(n){return d.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.Account.prototype.addVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.Vote,r)};TronWebProto.Account.prototype.clearVotesList=function(){return this.setVotesList([])};TronWebProto.Account.prototype.getAssetMap=function(n){return d.Message.getMapField(this,6,n,null)};TronWebProto.Account.prototype.clearAssetMap=function(){return this.getAssetMap().clear(),this};TronWebProto.Account.prototype.getAssetv2Map=function(n){return d.Message.getMapField(this,56,n,null)};TronWebProto.Account.prototype.clearAssetv2Map=function(){return this.getAssetv2Map().clear(),this};TronWebProto.Account.prototype.getFrozenList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Account.Frozen,7)};TronWebProto.Account.prototype.setFrozenList=function(n){return d.Message.setRepeatedWrapperField(this,7,n)};TronWebProto.Account.prototype.addFrozen=function(n,r){return d.Message.addToRepeatedWrapperField(this,7,n,TronWebProto.Account.Frozen,r)};TronWebProto.Account.prototype.clearFrozenList=function(){return this.setFrozenList([])};TronWebProto.Account.prototype.getNetUsage=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Account.prototype.setNetUsage=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Account.prototype.getAcquiredDelegatedFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,41,0)};TronWebProto.Account.prototype.setAcquiredDelegatedFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,41,n)};TronWebProto.Account.prototype.getDelegatedFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,42,0)};TronWebProto.Account.prototype.setDelegatedFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,42,n)};TronWebProto.Account.prototype.getOldTronPower=function(){return d.Message.getFieldWithDefault(this,46,0)};TronWebProto.Account.prototype.setOldTronPower=function(n){return d.Message.setProto3IntField(this,46,n)};TronWebProto.Account.prototype.getTronPower=function(){return d.Message.getWrapperField(this,TronWebProto.Account.Frozen,47)};TronWebProto.Account.prototype.setTronPower=function(n){return d.Message.setWrapperField(this,47,n)};TronWebProto.Account.prototype.clearTronPower=function(){return this.setTronPower(void 0)};TronWebProto.Account.prototype.hasTronPower=function(){return d.Message.getField(this,47)!=null};TronWebProto.Account.prototype.getAssetOptimized=function(){return d.Message.getBooleanFieldWithDefault(this,60,!1)};TronWebProto.Account.prototype.setAssetOptimized=function(n){return d.Message.setProto3BooleanField(this,60,n)};TronWebProto.Account.prototype.getCreateTime=function(){return d.Message.getFieldWithDefault(this,9,0)};TronWebProto.Account.prototype.setCreateTime=function(n){return d.Message.setProto3IntField(this,9,n)};TronWebProto.Account.prototype.getLatestOprationTime=function(){return d.Message.getFieldWithDefault(this,10,0)};TronWebProto.Account.prototype.setLatestOprationTime=function(n){return d.Message.setProto3IntField(this,10,n)};TronWebProto.Account.prototype.getAllowance=function(){return d.Message.getFieldWithDefault(this,11,0)};TronWebProto.Account.prototype.setAllowance=function(n){return d.Message.setProto3IntField(this,11,n)};TronWebProto.Account.prototype.getLatestWithdrawTime=function(){return d.Message.getFieldWithDefault(this,12,0)};TronWebProto.Account.prototype.setLatestWithdrawTime=function(n){return d.Message.setProto3IntField(this,12,n)};TronWebProto.Account.prototype.getCode=function(){return d.Message.getFieldWithDefault(this,13,"")};TronWebProto.Account.prototype.getCode_asB64=function(){return d.Message.bytesAsB64(this.getCode())};TronWebProto.Account.prototype.getCode_asU8=function(){return d.Message.bytesAsU8(this.getCode())};TronWebProto.Account.prototype.setCode=function(n){return d.Message.setProto3BytesField(this,13,n)};TronWebProto.Account.prototype.getIsWitness=function(){return d.Message.getBooleanFieldWithDefault(this,14,!1)};TronWebProto.Account.prototype.setIsWitness=function(n){return d.Message.setProto3BooleanField(this,14,n)};TronWebProto.Account.prototype.getIsCommittee=function(){return d.Message.getBooleanFieldWithDefault(this,15,!1)};TronWebProto.Account.prototype.setIsCommittee=function(n){return d.Message.setProto3BooleanField(this,15,n)};TronWebProto.Account.prototype.getFrozenSupplyList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Account.Frozen,16)};TronWebProto.Account.prototype.setFrozenSupplyList=function(n){return d.Message.setRepeatedWrapperField(this,16,n)};TronWebProto.Account.prototype.addFrozenSupply=function(n,r){return d.Message.addToRepeatedWrapperField(this,16,n,TronWebProto.Account.Frozen,r)};TronWebProto.Account.prototype.clearFrozenSupplyList=function(){return this.setFrozenSupplyList([])};TronWebProto.Account.prototype.getAssetIssuedName=function(){return d.Message.getFieldWithDefault(this,17,"")};TronWebProto.Account.prototype.getAssetIssuedName_asB64=function(){return d.Message.bytesAsB64(this.getAssetIssuedName())};TronWebProto.Account.prototype.getAssetIssuedName_asU8=function(){return d.Message.bytesAsU8(this.getAssetIssuedName())};TronWebProto.Account.prototype.setAssetIssuedName=function(n){return d.Message.setProto3BytesField(this,17,n)};TronWebProto.Account.prototype.getAssetIssuedId=function(){return d.Message.getFieldWithDefault(this,57,"")};TronWebProto.Account.prototype.getAssetIssuedId_asB64=function(){return d.Message.bytesAsB64(this.getAssetIssuedId())};TronWebProto.Account.prototype.getAssetIssuedId_asU8=function(){return d.Message.bytesAsU8(this.getAssetIssuedId())};TronWebProto.Account.prototype.setAssetIssuedId=function(n){return d.Message.setProto3BytesField(this,57,n)};TronWebProto.Account.prototype.getLatestAssetOperationTimeMap=function(n){return d.Message.getMapField(this,18,n,null)};TronWebProto.Account.prototype.clearLatestAssetOperationTimeMap=function(){return this.getLatestAssetOperationTimeMap().clear(),this};TronWebProto.Account.prototype.getLatestAssetOperationTimev2Map=function(n){return d.Message.getMapField(this,58,n,null)};TronWebProto.Account.prototype.clearLatestAssetOperationTimev2Map=function(){return this.getLatestAssetOperationTimev2Map().clear(),this};TronWebProto.Account.prototype.getFreeNetUsage=function(){return d.Message.getFieldWithDefault(this,19,0)};TronWebProto.Account.prototype.setFreeNetUsage=function(n){return d.Message.setProto3IntField(this,19,n)};TronWebProto.Account.prototype.getFreeAssetNetUsageMap=function(n){return d.Message.getMapField(this,20,n,null)};TronWebProto.Account.prototype.clearFreeAssetNetUsageMap=function(){return this.getFreeAssetNetUsageMap().clear(),this};TronWebProto.Account.prototype.getFreeAssetNetUsagev2Map=function(n){return d.Message.getMapField(this,59,n,null)};TronWebProto.Account.prototype.clearFreeAssetNetUsagev2Map=function(){return this.getFreeAssetNetUsagev2Map().clear(),this};TronWebProto.Account.prototype.getLatestConsumeTime=function(){return d.Message.getFieldWithDefault(this,21,0)};TronWebProto.Account.prototype.setLatestConsumeTime=function(n){return d.Message.setProto3IntField(this,21,n)};TronWebProto.Account.prototype.getLatestConsumeFreeTime=function(){return d.Message.getFieldWithDefault(this,22,0)};TronWebProto.Account.prototype.setLatestConsumeFreeTime=function(n){return d.Message.setProto3IntField(this,22,n)};TronWebProto.Account.prototype.getAccountId=function(){return d.Message.getFieldWithDefault(this,23,"")};TronWebProto.Account.prototype.getAccountId_asB64=function(){return d.Message.bytesAsB64(this.getAccountId())};TronWebProto.Account.prototype.getAccountId_asU8=function(){return d.Message.bytesAsU8(this.getAccountId())};TronWebProto.Account.prototype.setAccountId=function(n){return d.Message.setProto3BytesField(this,23,n)};TronWebProto.Account.prototype.getAccountResource=function(){return d.Message.getWrapperField(this,TronWebProto.Account.AccountResource,26)};TronWebProto.Account.prototype.setAccountResource=function(n){return d.Message.setWrapperField(this,26,n)};TronWebProto.Account.prototype.clearAccountResource=function(){return this.setAccountResource(void 0)};TronWebProto.Account.prototype.hasAccountResource=function(){return d.Message.getField(this,26)!=null};TronWebProto.Account.prototype.getCodehash=function(){return d.Message.getFieldWithDefault(this,30,"")};TronWebProto.Account.prototype.getCodehash_asB64=function(){return d.Message.bytesAsB64(this.getCodehash())};TronWebProto.Account.prototype.getCodehash_asU8=function(){return d.Message.bytesAsU8(this.getCodehash())};TronWebProto.Account.prototype.setCodehash=function(n){return d.Message.setProto3BytesField(this,30,n)};TronWebProto.Account.prototype.getOwnerPermission=function(){return d.Message.getWrapperField(this,TronWebProto.Permission,31)};TronWebProto.Account.prototype.setOwnerPermission=function(n){return d.Message.setWrapperField(this,31,n)};TronWebProto.Account.prototype.clearOwnerPermission=function(){return this.setOwnerPermission(void 0)};TronWebProto.Account.prototype.hasOwnerPermission=function(){return d.Message.getField(this,31)!=null};TronWebProto.Account.prototype.getWitnessPermission=function(){return d.Message.getWrapperField(this,TronWebProto.Permission,32)};TronWebProto.Account.prototype.setWitnessPermission=function(n){return d.Message.setWrapperField(this,32,n)};TronWebProto.Account.prototype.clearWitnessPermission=function(){return this.setWitnessPermission(void 0)};TronWebProto.Account.prototype.hasWitnessPermission=function(){return d.Message.getField(this,32)!=null};TronWebProto.Account.prototype.getActivePermissionList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Permission,33)};TronWebProto.Account.prototype.setActivePermissionList=function(n){return d.Message.setRepeatedWrapperField(this,33,n)};TronWebProto.Account.prototype.addActivePermission=function(n,r){return d.Message.addToRepeatedWrapperField(this,33,n,TronWebProto.Permission,r)};TronWebProto.Account.prototype.clearActivePermissionList=function(){return this.setActivePermissionList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Key.prototype.toObject=function(n){return TronWebProto.Key.toObject(n,this)},TronWebProto.Key.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),weight:d.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Key.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Key;return TronWebProto.Key.deserializeBinaryFromReader(o,r)};TronWebProto.Key.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=r.readInt64();n.setWeight(s);break;default:r.skipField();break}}return n};TronWebProto.Key.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Key.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Key.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getWeight(),o!==0&&r.writeInt64(2,o)};TronWebProto.Key.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Key.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Key.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Key.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Key.prototype.getWeight=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Key.prototype.setWeight=function(n){return d.Message.setProto3IntField(this,2,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.DelegatedResource.prototype.toObject=function(n){return TronWebProto.DelegatedResource.toObject(n,this)},TronWebProto.DelegatedResource.toObject=function(n,r){var o,s={from:r.getFrom_asB64(),to:r.getTo_asB64(),frozenBalanceForBandwidth:d.Message.getFieldWithDefault(r,3,0),frozenBalanceForEnergy:d.Message.getFieldWithDefault(r,4,0),expireTimeForBandwidth:d.Message.getFieldWithDefault(r,5,0),expireTimeForEnergy:d.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.DelegatedResource.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.DelegatedResource;return TronWebProto.DelegatedResource.deserializeBinaryFromReader(o,r)};TronWebProto.DelegatedResource.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setFrom(s);break;case 2:var s=r.readBytes();n.setTo(s);break;case 3:var s=r.readInt64();n.setFrozenBalanceForBandwidth(s);break;case 4:var s=r.readInt64();n.setFrozenBalanceForEnergy(s);break;case 5:var s=r.readInt64();n.setExpireTimeForBandwidth(s);break;case 6:var s=r.readInt64();n.setExpireTimeForEnergy(s);break;default:r.skipField();break}}return n};TronWebProto.DelegatedResource.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.DelegatedResource.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.DelegatedResource.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrom_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getTo_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFrozenBalanceForBandwidth(),o!==0&&r.writeInt64(3,o),o=n.getFrozenBalanceForEnergy(),o!==0&&r.writeInt64(4,o),o=n.getExpireTimeForBandwidth(),o!==0&&r.writeInt64(5,o),o=n.getExpireTimeForEnergy(),o!==0&&r.writeInt64(6,o)};TronWebProto.DelegatedResource.prototype.getFrom=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.DelegatedResource.prototype.getFrom_asB64=function(){return d.Message.bytesAsB64(this.getFrom())};TronWebProto.DelegatedResource.prototype.getFrom_asU8=function(){return d.Message.bytesAsU8(this.getFrom())};TronWebProto.DelegatedResource.prototype.setFrom=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.DelegatedResource.prototype.getTo=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.DelegatedResource.prototype.getTo_asB64=function(){return d.Message.bytesAsB64(this.getTo())};TronWebProto.DelegatedResource.prototype.getTo_asU8=function(){return d.Message.bytesAsU8(this.getTo())};TronWebProto.DelegatedResource.prototype.setTo=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.DelegatedResource.prototype.getFrozenBalanceForBandwidth=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.DelegatedResource.prototype.setFrozenBalanceForBandwidth=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.DelegatedResource.prototype.getFrozenBalanceForEnergy=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.DelegatedResource.prototype.setFrozenBalanceForEnergy=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.DelegatedResource.prototype.getExpireTimeForBandwidth=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.DelegatedResource.prototype.setExpireTimeForBandwidth=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.DelegatedResource.prototype.getExpireTimeForEnergy=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.DelegatedResource.prototype.setExpireTimeForEnergy=function(n){return d.Message.setProto3IntField(this,6,n)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.authority.prototype.toObject=function(n){return TronWebProto.authority.toObject(n,this)},TronWebProto.authority.toObject=function(n,r){var o,s={account:(o=r.getAccount())&&TronWebProto.AccountId.toObject(n,o),permissionName:r.getPermissionName_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.authority.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.authority;return TronWebProto.authority.deserializeBinaryFromReader(o,r)};TronWebProto.authority.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.AccountId;r.readMessage(s,TronWebProto.AccountId.deserializeBinaryFromReader),n.setAccount(s);break;case 2:var s=r.readBytes();n.setPermissionName(s);break;default:r.skipField();break}}return n};TronWebProto.authority.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.authority.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.authority.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccount(),o!=null&&r.writeMessage(1,o,TronWebProto.AccountId.serializeBinaryToWriter),o=n.getPermissionName_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.authority.prototype.getAccount=function(){return d.Message.getWrapperField(this,TronWebProto.AccountId,1)};TronWebProto.authority.prototype.setAccount=function(n){return d.Message.setWrapperField(this,1,n)};TronWebProto.authority.prototype.clearAccount=function(){return this.setAccount(void 0)};TronWebProto.authority.prototype.hasAccount=function(){return d.Message.getField(this,1)!=null};TronWebProto.authority.prototype.getPermissionName=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.authority.prototype.getPermissionName_asB64=function(){return d.Message.bytesAsB64(this.getPermissionName())};TronWebProto.authority.prototype.getPermissionName_asU8=function(){return d.Message.bytesAsU8(this.getPermissionName())};TronWebProto.authority.prototype.setPermissionName=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.Permission.repeatedFields_=[7];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Permission.prototype.toObject=function(n){return TronWebProto.Permission.toObject(n,this)},TronWebProto.Permission.toObject=function(n,r){var o,s={type:d.Message.getFieldWithDefault(r,1,0),id:d.Message.getFieldWithDefault(r,2,0),permissionName:d.Message.getFieldWithDefault(r,3,""),threshold:d.Message.getFieldWithDefault(r,4,0),parentId:d.Message.getFieldWithDefault(r,5,0),operations:r.getOperations_asB64(),keysList:d.Message.toObjectList(r.getKeysList(),TronWebProto.Key.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Permission.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Permission;return TronWebProto.Permission.deserializeBinaryFromReader(o,r)};TronWebProto.Permission.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readEnum();n.setType(s);break;case 2:var s=r.readInt32();n.setId(s);break;case 3:var s=r.readString();n.setPermissionName(s);break;case 4:var s=r.readInt64();n.setThreshold(s);break;case 5:var s=r.readInt32();n.setParentId(s);break;case 6:var s=r.readBytes();n.setOperations(s);break;case 7:var s=new TronWebProto.Key;r.readMessage(s,TronWebProto.Key.deserializeBinaryFromReader),n.addKeys(s);break;default:r.skipField();break}}return n};TronWebProto.Permission.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Permission.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Permission.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getType(),o!==0&&r.writeEnum(1,o),o=n.getId(),o!==0&&r.writeInt32(2,o),o=n.getPermissionName(),o.length>0&&r.writeString(3,o),o=n.getThreshold(),o!==0&&r.writeInt64(4,o),o=n.getParentId(),o!==0&&r.writeInt32(5,o),o=n.getOperations_asU8(),o.length>0&&r.writeBytes(6,o),o=n.getKeysList(),o.length>0&&r.writeRepeatedMessage(7,o,TronWebProto.Key.serializeBinaryToWriter)};TronWebProto.Permission.PermissionType={OWNER:0,WITNESS:1,ACTIVE:2};TronWebProto.Permission.prototype.getType=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Permission.prototype.setType=function(n){return d.Message.setProto3EnumField(this,1,n)};TronWebProto.Permission.prototype.getId=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Permission.prototype.setId=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Permission.prototype.getPermissionName=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Permission.prototype.setPermissionName=function(n){return d.Message.setProto3StringField(this,3,n)};TronWebProto.Permission.prototype.getThreshold=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.Permission.prototype.setThreshold=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Permission.prototype.getParentId=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Permission.prototype.setParentId=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Permission.prototype.getOperations=function(){return d.Message.getFieldWithDefault(this,6,"")};TronWebProto.Permission.prototype.getOperations_asB64=function(){return d.Message.bytesAsB64(this.getOperations())};TronWebProto.Permission.prototype.getOperations_asU8=function(){return d.Message.bytesAsU8(this.getOperations())};TronWebProto.Permission.prototype.setOperations=function(n){return d.Message.setProto3BytesField(this,6,n)};TronWebProto.Permission.prototype.getKeysList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Key,7)};TronWebProto.Permission.prototype.setKeysList=function(n){return d.Message.setRepeatedWrapperField(this,7,n)};TronWebProto.Permission.prototype.addKeys=function(n,r){return d.Message.addToRepeatedWrapperField(this,7,n,TronWebProto.Key,r)};TronWebProto.Permission.prototype.clearKeysList=function(){return this.setKeysList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Witness.prototype.toObject=function(n){return TronWebProto.Witness.toObject(n,this)},TronWebProto.Witness.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),votecount:d.Message.getFieldWithDefault(r,2,0),pubkey:r.getPubkey_asB64(),url:d.Message.getFieldWithDefault(r,4,""),totalproduced:d.Message.getFieldWithDefault(r,5,0),totalmissed:d.Message.getFieldWithDefault(r,6,0),latestblocknum:d.Message.getFieldWithDefault(r,7,0),latestslotnum:d.Message.getFieldWithDefault(r,8,0),isjobs:d.Message.getBooleanFieldWithDefault(r,9,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Witness.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Witness;return TronWebProto.Witness.deserializeBinaryFromReader(o,r)};TronWebProto.Witness.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=r.readInt64();n.setVotecount(s);break;case 3:var s=r.readBytes();n.setPubkey(s);break;case 4:var s=r.readString();n.setUrl(s);break;case 5:var s=r.readInt64();n.setTotalproduced(s);break;case 6:var s=r.readInt64();n.setTotalmissed(s);break;case 7:var s=r.readInt64();n.setLatestblocknum(s);break;case 8:var s=r.readInt64();n.setLatestslotnum(s);break;case 9:var s=r.readBool();n.setIsjobs(s);break;default:r.skipField();break}}return n};TronWebProto.Witness.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Witness.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Witness.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVotecount(),o!==0&&r.writeInt64(2,o),o=n.getPubkey_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getUrl(),o.length>0&&r.writeString(4,o),o=n.getTotalproduced(),o!==0&&r.writeInt64(5,o),o=n.getTotalmissed(),o!==0&&r.writeInt64(6,o),o=n.getLatestblocknum(),o!==0&&r.writeInt64(7,o),o=n.getLatestslotnum(),o!==0&&r.writeInt64(8,o),o=n.getIsjobs(),o&&r.writeBool(9,o)};TronWebProto.Witness.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Witness.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Witness.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Witness.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Witness.prototype.getVotecount=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Witness.prototype.setVotecount=function(n){return d.Message.setProto3IntField(this,2,n)};TronWebProto.Witness.prototype.getPubkey=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Witness.prototype.getPubkey_asB64=function(){return d.Message.bytesAsB64(this.getPubkey())};TronWebProto.Witness.prototype.getPubkey_asU8=function(){return d.Message.bytesAsU8(this.getPubkey())};TronWebProto.Witness.prototype.setPubkey=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Witness.prototype.getUrl=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Witness.prototype.setUrl=function(n){return d.Message.setProto3StringField(this,4,n)};TronWebProto.Witness.prototype.getTotalproduced=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Witness.prototype.setTotalproduced=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Witness.prototype.getTotalmissed=function(){return d.Message.getFieldWithDefault(this,6,0)};TronWebProto.Witness.prototype.setTotalmissed=function(n){return d.Message.setProto3IntField(this,6,n)};TronWebProto.Witness.prototype.getLatestblocknum=function(){return d.Message.getFieldWithDefault(this,7,0)};TronWebProto.Witness.prototype.setLatestblocknum=function(n){return d.Message.setProto3IntField(this,7,n)};TronWebProto.Witness.prototype.getLatestslotnum=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Witness.prototype.setLatestslotnum=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Witness.prototype.getIsjobs=function(){return d.Message.getBooleanFieldWithDefault(this,9,!1)};TronWebProto.Witness.prototype.setIsjobs=function(n){return d.Message.setProto3BooleanField(this,9,n)};TronWebProto.Votes.repeatedFields_=[2,3];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Votes.prototype.toObject=function(n){return TronWebProto.Votes.toObject(n,this)},TronWebProto.Votes.toObject=function(n,r){var o,s={address:r.getAddress_asB64(),oldVotesList:d.Message.toObjectList(r.getOldVotesList(),TronWebProto.Vote.toObject,n),newVotesList:d.Message.toObjectList(r.getNewVotesList(),TronWebProto.Vote.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Votes.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Votes;return TronWebProto.Votes.deserializeBinaryFromReader(o,r)};TronWebProto.Votes.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;case 2:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addOldVotes(s);break;case 3:var s=new TronWebProto.Vote;r.readMessage(s,TronWebProto.Vote.deserializeBinaryFromReader),n.addNewVotes(s);break;default:r.skipField();break}}return n};TronWebProto.Votes.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Votes.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Votes.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOldVotesList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.Vote.serializeBinaryToWriter),o=n.getNewVotesList(),o.length>0&&r.writeRepeatedMessage(3,o,TronWebProto.Vote.serializeBinaryToWriter)};TronWebProto.Votes.prototype.getAddress=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Votes.prototype.getAddress_asB64=function(){return d.Message.bytesAsB64(this.getAddress())};TronWebProto.Votes.prototype.getAddress_asU8=function(){return d.Message.bytesAsU8(this.getAddress())};TronWebProto.Votes.prototype.setAddress=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Votes.prototype.getOldVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,2)};TronWebProto.Votes.prototype.setOldVotesList=function(n){return d.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.Votes.prototype.addOldVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.Vote,r)};TronWebProto.Votes.prototype.clearOldVotesList=function(){return this.setOldVotesList([])};TronWebProto.Votes.prototype.getNewVotesList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Vote,3)};TronWebProto.Votes.prototype.setNewVotesList=function(n){return d.Message.setRepeatedWrapperField(this,3,n)};TronWebProto.Votes.prototype.addNewVotes=function(n,r){return d.Message.addToRepeatedWrapperField(this,3,n,TronWebProto.Vote,r)};TronWebProto.Votes.prototype.clearNewVotesList=function(){return this.setNewVotesList([])};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.MarketOrderDetail.prototype.toObject=function(n){return TronWebProto.MarketOrderDetail.toObject(n,this)},TronWebProto.MarketOrderDetail.toObject=function(n,r){var o,s={makerorderid:r.getMakerorderid_asB64(),takerorderid:r.getTakerorderid_asB64(),fillsellquantity:d.Message.getFieldWithDefault(r,3,0),fillbuyquantity:d.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.MarketOrderDetail.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.MarketOrderDetail;return TronWebProto.MarketOrderDetail.deserializeBinaryFromReader(o,r)};TronWebProto.MarketOrderDetail.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setMakerorderid(s);break;case 2:var s=r.readBytes();n.setTakerorderid(s);break;case 3:var s=r.readInt64();n.setFillsellquantity(s);break;case 4:var s=r.readInt64();n.setFillbuyquantity(s);break;default:r.skipField();break}}return n};TronWebProto.MarketOrderDetail.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.MarketOrderDetail.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.MarketOrderDetail.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getMakerorderid_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getTakerorderid_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFillsellquantity(),o!==0&&r.writeInt64(3,o),o=n.getFillbuyquantity(),o!==0&&r.writeInt64(4,o)};TronWebProto.MarketOrderDetail.prototype.getMakerorderid=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.MarketOrderDetail.prototype.getMakerorderid_asB64=function(){return d.Message.bytesAsB64(this.getMakerorderid())};TronWebProto.MarketOrderDetail.prototype.getMakerorderid_asU8=function(){return d.Message.bytesAsU8(this.getMakerorderid())};TronWebProto.MarketOrderDetail.prototype.setMakerorderid=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.MarketOrderDetail.prototype.getTakerorderid=function(){return d.Message.getFieldWithDefault(this,2,"")};TronWebProto.MarketOrderDetail.prototype.getTakerorderid_asB64=function(){return d.Message.bytesAsB64(this.getTakerorderid())};TronWebProto.MarketOrderDetail.prototype.getTakerorderid_asU8=function(){return d.Message.bytesAsU8(this.getTakerorderid())};TronWebProto.MarketOrderDetail.prototype.setTakerorderid=function(n){return d.Message.setProto3BytesField(this,2,n)};TronWebProto.MarketOrderDetail.prototype.getFillsellquantity=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.MarketOrderDetail.prototype.setFillsellquantity=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.MarketOrderDetail.prototype.getFillbuyquantity=function(){return d.Message.getFieldWithDefault(this,4,0)};TronWebProto.MarketOrderDetail.prototype.setFillbuyquantity=function(n){return d.Message.setProto3IntField(this,4,n)};TronWebProto.Transaction.repeatedFields_=[2,5];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.prototype.toObject=function(n){return TronWebProto.Transaction.toObject(n,this)},TronWebProto.Transaction.toObject=function(n,r){var o,s={rawData:(o=r.getRawData())&&TronWebProto.Transaction.raw.toObject(n,o),signatureList:r.getSignatureList_asB64(),retList:d.Message.toObjectList(r.getRetList(),TronWebProto.Transaction.Result.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction;return TronWebProto.Transaction.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.Transaction.raw;r.readMessage(s,TronWebProto.Transaction.raw.deserializeBinaryFromReader),n.setRawData(s);break;case 2:var s=r.readBytes();n.addSignature(s);break;case 5:var s=new TronWebProto.Transaction.Result;r.readMessage(s,TronWebProto.Transaction.Result.deserializeBinaryFromReader),n.addRet(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getRawData(),o!=null&&r.writeMessage(1,o,TronWebProto.Transaction.raw.serializeBinaryToWriter),o=n.getSignatureList_asU8(),o.length>0&&r.writeRepeatedBytes(2,o),o=n.getRetList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.Transaction.Result.serializeBinaryToWriter)};d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.Contract.prototype.toObject=function(n){return TronWebProto.Transaction.Contract.toObject(n,this)},TronWebProto.Transaction.Contract.toObject=function(n,r){var o,s={type:d.Message.getFieldWithDefault(r,1,0),parameter:(o=r.getParameter())&&Vo.Any.toObject(n,o),provider:r.getProvider_asB64(),contractname:r.getContractname_asB64(),permissionId:d.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.Contract.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.Contract;return TronWebProto.Transaction.Contract.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readEnum();n.setType(s);break;case 2:var s=new Vo.Any;r.readMessage(s,Vo.Any.deserializeBinaryFromReader),n.setParameter(s);break;case 3:var s=r.readBytes();n.setProvider(s);break;case 4:var s=r.readBytes();n.setContractname(s);break;case 5:var s=r.readInt32();n.setPermissionId(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.Contract.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getType(),o!==0&&r.writeEnum(1,o),o=n.getParameter(),o!=null&&r.writeMessage(2,o,Vo.Any.serializeBinaryToWriter),o=n.getProvider_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getContractname_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getPermissionId(),o!==0&&r.writeInt32(5,o)};TronWebProto.Transaction.Contract.ContractType={ACCOUNTCREATECONTRACT:0,TRANSFERCONTRACT:1,TRANSFERASSETCONTRACT:2,VOTEASSETCONTRACT:3,VOTEWITNESSCONTRACT:4,WITNESSCREATECONTRACT:5,ASSETISSUECONTRACT:6,WITNESSUPDATECONTRACT:8,PARTICIPATEASSETISSUECONTRACT:9,ACCOUNTUPDATECONTRACT:10,FREEZEBALANCECONTRACT:11,UNFREEZEBALANCECONTRACT:12,WITHDRAWBALANCECONTRACT:13,UNFREEZEASSETCONTRACT:14,UPDATEASSETCONTRACT:15,PROPOSALCREATECONTRACT:16,PROPOSALAPPROVECONTRACT:17,PROPOSALDELETECONTRACT:18,SETACCOUNTIDCONTRACT:19,CUSTOMCONTRACT:20,CREATESMARTCONTRACT:30,TRIGGERSMARTCONTRACT:31,GETCONTRACT:32,UPDATESETTINGCONTRACT:33,EXCHANGECREATECONTRACT:41,EXCHANGEINJECTCONTRACT:42,EXCHANGEWITHDRAWCONTRACT:43,EXCHANGETRANSACTIONCONTRACT:44,UPDATEENERGYLIMITCONTRACT:45,ACCOUNTPERMISSIONUPDATECONTRACT:46,CLEARABICONTRACT:48,UPDATEBROKERAGECONTRACT:49,SHIELDEDTRANSFERCONTRACT:51,MARKETSELLASSETCONTRACT:52,MARKETCANCELORDERCONTRACT:53,FREEZEBALANCEV2CONTRACT:54,UNFREEZEBALANCEV2CONTRACT:55,WITHDRAWEXPIREUNFREEZECONTRACT:56,DELEGATERESOURCECONTRACT:57,UNDELEGATERESOURCECONTRACT:58,CANCELALLUNFREEZEV2CONTRACT:59};TronWebProto.Transaction.Contract.prototype.getType=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Transaction.Contract.prototype.setType=function(n){return d.Message.setProto3EnumField(this,1,n)};TronWebProto.Transaction.Contract.prototype.getParameter=function(){return d.Message.getWrapperField(this,Vo.Any,2)};TronWebProto.Transaction.Contract.prototype.setParameter=function(n){return d.Message.setWrapperField(this,2,n)};TronWebProto.Transaction.Contract.prototype.clearParameter=function(){return this.setParameter(void 0)};TronWebProto.Transaction.Contract.prototype.hasParameter=function(){return d.Message.getField(this,2)!=null};TronWebProto.Transaction.Contract.prototype.getProvider=function(){return d.Message.getFieldWithDefault(this,3,"")};TronWebProto.Transaction.Contract.prototype.getProvider_asB64=function(){return d.Message.bytesAsB64(this.getProvider())};TronWebProto.Transaction.Contract.prototype.getProvider_asU8=function(){return d.Message.bytesAsU8(this.getProvider())};TronWebProto.Transaction.Contract.prototype.setProvider=function(n){return d.Message.setProto3BytesField(this,3,n)};TronWebProto.Transaction.Contract.prototype.getContractname=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Transaction.Contract.prototype.getContractname_asB64=function(){return d.Message.bytesAsB64(this.getContractname())};TronWebProto.Transaction.Contract.prototype.getContractname_asU8=function(){return d.Message.bytesAsU8(this.getContractname())};TronWebProto.Transaction.Contract.prototype.setContractname=function(n){return d.Message.setProto3BytesField(this,4,n)};TronWebProto.Transaction.Contract.prototype.getPermissionId=function(){return d.Message.getFieldWithDefault(this,5,0)};TronWebProto.Transaction.Contract.prototype.setPermissionId=function(n){return d.Message.setProto3IntField(this,5,n)};TronWebProto.Transaction.Result.repeatedFields_=[26];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.Result.prototype.toObject=function(n){return TronWebProto.Transaction.Result.toObject(n,this)},TronWebProto.Transaction.Result.toObject=function(n,r){var o,s={fee:d.Message.getFieldWithDefault(r,1,0),ret:d.Message.getFieldWithDefault(r,2,0),contractret:d.Message.getFieldWithDefault(r,3,0),assetissueid:d.Message.getFieldWithDefault(r,14,""),withdrawAmount:d.Message.getFieldWithDefault(r,15,0),unfreezeAmount:d.Message.getFieldWithDefault(r,16,0),exchangeReceivedAmount:d.Message.getFieldWithDefault(r,18,0),exchangeInjectAnotherAmount:d.Message.getFieldWithDefault(r,19,0),exchangeWithdrawAnotherAmount:d.Message.getFieldWithDefault(r,20,0),exchangeId:d.Message.getFieldWithDefault(r,21,0),shieldedTransactionFee:d.Message.getFieldWithDefault(r,22,0),orderid:r.getOrderid_asB64(),orderdetailsList:d.Message.toObjectList(r.getOrderdetailsList(),TronWebProto.MarketOrderDetail.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.Result.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.Result;return TronWebProto.Transaction.Result.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.Result.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFee(s);break;case 2:var s=r.readEnum();n.setRet(s);break;case 3:var s=r.readEnum();n.setContractret(s);break;case 14:var s=r.readString();n.setAssetissueid(s);break;case 15:var s=r.readInt64();n.setWithdrawAmount(s);break;case 16:var s=r.readInt64();n.setUnfreezeAmount(s);break;case 18:var s=r.readInt64();n.setExchangeReceivedAmount(s);break;case 19:var s=r.readInt64();n.setExchangeInjectAnotherAmount(s);break;case 20:var s=r.readInt64();n.setExchangeWithdrawAnotherAmount(s);break;case 21:var s=r.readInt64();n.setExchangeId(s);break;case 22:var s=r.readInt64();n.setShieldedTransactionFee(s);break;case 25:var s=r.readBytes();n.setOrderid(s);break;case 26:var s=new TronWebProto.MarketOrderDetail;r.readMessage(s,TronWebProto.MarketOrderDetail.deserializeBinaryFromReader),n.addOrderdetails(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.Result.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.Result.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.Result.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFee(),o!==0&&r.writeInt64(1,o),o=n.getRet(),o!==0&&r.writeEnum(2,o),o=n.getContractret(),o!==0&&r.writeEnum(3,o),o=n.getAssetissueid(),o.length>0&&r.writeString(14,o),o=n.getWithdrawAmount(),o!==0&&r.writeInt64(15,o),o=n.getUnfreezeAmount(),o!==0&&r.writeInt64(16,o),o=n.getExchangeReceivedAmount(),o!==0&&r.writeInt64(18,o),o=n.getExchangeInjectAnotherAmount(),o!==0&&r.writeInt64(19,o),o=n.getExchangeWithdrawAnotherAmount(),o!==0&&r.writeInt64(20,o),o=n.getExchangeId(),o!==0&&r.writeInt64(21,o),o=n.getShieldedTransactionFee(),o!==0&&r.writeInt64(22,o),o=n.getOrderid_asU8(),o.length>0&&r.writeBytes(25,o),o=n.getOrderdetailsList(),o.length>0&&r.writeRepeatedMessage(26,o,TronWebProto.MarketOrderDetail.serializeBinaryToWriter)};TronWebProto.Transaction.Result.code={SUCESS:0,FAILED:1};TronWebProto.Transaction.Result.contractResult={DEFAULT:0,SUCCESS:1,REVERT:2,BAD_JUMP_DESTINATION:3,OUT_OF_MEMORY:4,PRECOMPILED_CONTRACT:5,STACK_TOO_SMALL:6,STACK_TOO_LARGE:7,ILLEGAL_OPERATION:8,STACK_OVERFLOW:9,OUT_OF_ENERGY:10,OUT_OF_TIME:11,JVM_STACK_OVER_FLOW:12,UNKNOWN:13,TRANSFER_FAILED:14,INVALID_CODE:15};TronWebProto.Transaction.Result.prototype.getFee=function(){return d.Message.getFieldWithDefault(this,1,0)};TronWebProto.Transaction.Result.prototype.setFee=function(n){return d.Message.setProto3IntField(this,1,n)};TronWebProto.Transaction.Result.prototype.getRet=function(){return d.Message.getFieldWithDefault(this,2,0)};TronWebProto.Transaction.Result.prototype.setRet=function(n){return d.Message.setProto3EnumField(this,2,n)};TronWebProto.Transaction.Result.prototype.getContractret=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Transaction.Result.prototype.setContractret=function(n){return d.Message.setProto3EnumField(this,3,n)};TronWebProto.Transaction.Result.prototype.getAssetissueid=function(){return d.Message.getFieldWithDefault(this,14,"")};TronWebProto.Transaction.Result.prototype.setAssetissueid=function(n){return d.Message.setProto3StringField(this,14,n)};TronWebProto.Transaction.Result.prototype.getWithdrawAmount=function(){return d.Message.getFieldWithDefault(this,15,0)};TronWebProto.Transaction.Result.prototype.setWithdrawAmount=function(n){return d.Message.setProto3IntField(this,15,n)};TronWebProto.Transaction.Result.prototype.getUnfreezeAmount=function(){return d.Message.getFieldWithDefault(this,16,0)};TronWebProto.Transaction.Result.prototype.setUnfreezeAmount=function(n){return d.Message.setProto3IntField(this,16,n)};TronWebProto.Transaction.Result.prototype.getExchangeReceivedAmount=function(){return d.Message.getFieldWithDefault(this,18,0)};TronWebProto.Transaction.Result.prototype.setExchangeReceivedAmount=function(n){return d.Message.setProto3IntField(this,18,n)};TronWebProto.Transaction.Result.prototype.getExchangeInjectAnotherAmount=function(){return d.Message.getFieldWithDefault(this,19,0)};TronWebProto.Transaction.Result.prototype.setExchangeInjectAnotherAmount=function(n){return d.Message.setProto3IntField(this,19,n)};TronWebProto.Transaction.Result.prototype.getExchangeWithdrawAnotherAmount=function(){return d.Message.getFieldWithDefault(this,20,0)};TronWebProto.Transaction.Result.prototype.setExchangeWithdrawAnotherAmount=function(n){return d.Message.setProto3IntField(this,20,n)};TronWebProto.Transaction.Result.prototype.getExchangeId=function(){return d.Message.getFieldWithDefault(this,21,0)};TronWebProto.Transaction.Result.prototype.setExchangeId=function(n){return d.Message.setProto3IntField(this,21,n)};TronWebProto.Transaction.Result.prototype.getShieldedTransactionFee=function(){return d.Message.getFieldWithDefault(this,22,0)};TronWebProto.Transaction.Result.prototype.setShieldedTransactionFee=function(n){return d.Message.setProto3IntField(this,22,n)};TronWebProto.Transaction.Result.prototype.getOrderid=function(){return d.Message.getFieldWithDefault(this,25,"")};TronWebProto.Transaction.Result.prototype.getOrderid_asB64=function(){return d.Message.bytesAsB64(this.getOrderid())};TronWebProto.Transaction.Result.prototype.getOrderid_asU8=function(){return d.Message.bytesAsU8(this.getOrderid())};TronWebProto.Transaction.Result.prototype.setOrderid=function(n){return d.Message.setProto3BytesField(this,25,n)};TronWebProto.Transaction.Result.prototype.getOrderdetailsList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.MarketOrderDetail,26)};TronWebProto.Transaction.Result.prototype.setOrderdetailsList=function(n){return d.Message.setRepeatedWrapperField(this,26,n)};TronWebProto.Transaction.Result.prototype.addOrderdetails=function(n,r){return d.Message.addToRepeatedWrapperField(this,26,n,TronWebProto.MarketOrderDetail,r)};TronWebProto.Transaction.Result.prototype.clearOrderdetailsList=function(){return this.setOrderdetailsList([])};TronWebProto.Transaction.raw.repeatedFields_=[9,11];d.Message.GENERATE_TO_OBJECT&&(TronWebProto.Transaction.raw.prototype.toObject=function(n){return TronWebProto.Transaction.raw.toObject(n,this)},TronWebProto.Transaction.raw.toObject=function(n,r){var o,s={refBlockBytes:r.getRefBlockBytes_asB64(),refBlockNum:d.Message.getFieldWithDefault(r,3,0),refBlockHash:r.getRefBlockHash_asB64(),expiration:d.Message.getFieldWithDefault(r,8,0),authsList:d.Message.toObjectList(r.getAuthsList(),TronWebProto.authority.toObject,n),data:r.getData_asB64(),contractList:d.Message.toObjectList(r.getContractList(),TronWebProto.Transaction.Contract.toObject,n),scripts:r.getScripts_asB64(),timestamp:d.Message.getFieldWithDefault(r,14,0),feeLimit:d.Message.getFieldWithDefault(r,18,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.Transaction.raw.deserializeBinary=function(n){var r=new d.BinaryReader(n),o=new TronWebProto.Transaction.raw;return TronWebProto.Transaction.raw.deserializeBinaryFromReader(o,r)};TronWebProto.Transaction.raw.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setRefBlockBytes(s);break;case 3:var s=r.readInt64();n.setRefBlockNum(s);break;case 4:var s=r.readBytes();n.setRefBlockHash(s);break;case 8:var s=r.readInt64();n.setExpiration(s);break;case 9:var s=new TronWebProto.authority;r.readMessage(s,TronWebProto.authority.deserializeBinaryFromReader),n.addAuths(s);break;case 10:var s=r.readBytes();n.setData(s);break;case 11:var s=new TronWebProto.Transaction.Contract;r.readMessage(s,TronWebProto.Transaction.Contract.deserializeBinaryFromReader),n.addContract(s);break;case 12:var s=r.readBytes();n.setScripts(s);break;case 14:var s=r.readInt64();n.setTimestamp(s);break;case 18:var s=r.readInt64();n.setFeeLimit(s);break;default:r.skipField();break}}return n};TronWebProto.Transaction.raw.prototype.serializeBinary=function(){var n=new d.BinaryWriter;return TronWebProto.Transaction.raw.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.Transaction.raw.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getRefBlockBytes_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getRefBlockNum(),o!==0&&r.writeInt64(3,o),o=n.getRefBlockHash_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getExpiration(),o!==0&&r.writeInt64(8,o),o=n.getAuthsList(),o.length>0&&r.writeRepeatedMessage(9,o,TronWebProto.authority.serializeBinaryToWriter),o=n.getData_asU8(),o.length>0&&r.writeBytes(10,o),o=n.getContractList(),o.length>0&&r.writeRepeatedMessage(11,o,TronWebProto.Transaction.Contract.serializeBinaryToWriter),o=n.getScripts_asU8(),o.length>0&&r.writeBytes(12,o),o=n.getTimestamp(),o!==0&&r.writeInt64(14,o),o=n.getFeeLimit(),o!==0&&r.writeInt64(18,o)};TronWebProto.Transaction.raw.prototype.getRefBlockBytes=function(){return d.Message.getFieldWithDefault(this,1,"")};TronWebProto.Transaction.raw.prototype.getRefBlockBytes_asB64=function(){return d.Message.bytesAsB64(this.getRefBlockBytes())};TronWebProto.Transaction.raw.prototype.getRefBlockBytes_asU8=function(){return d.Message.bytesAsU8(this.getRefBlockBytes())};TronWebProto.Transaction.raw.prototype.setRefBlockBytes=function(n){return d.Message.setProto3BytesField(this,1,n)};TronWebProto.Transaction.raw.prototype.getRefBlockNum=function(){return d.Message.getFieldWithDefault(this,3,0)};TronWebProto.Transaction.raw.prototype.setRefBlockNum=function(n){return d.Message.setProto3IntField(this,3,n)};TronWebProto.Transaction.raw.prototype.getRefBlockHash=function(){return d.Message.getFieldWithDefault(this,4,"")};TronWebProto.Transaction.raw.prototype.getRefBlockHash_asB64=function(){return d.Message.bytesAsB64(this.getRefBlockHash())};TronWebProto.Transaction.raw.prototype.getRefBlockHash_asU8=function(){return d.Message.bytesAsU8(this.getRefBlockHash())};TronWebProto.Transaction.raw.prototype.setRefBlockHash=function(n){return d.Message.setProto3BytesField(this,4,n)};TronWebProto.Transaction.raw.prototype.getExpiration=function(){return d.Message.getFieldWithDefault(this,8,0)};TronWebProto.Transaction.raw.prototype.setExpiration=function(n){return d.Message.setProto3IntField(this,8,n)};TronWebProto.Transaction.raw.prototype.getAuthsList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.authority,9)};TronWebProto.Transaction.raw.prototype.setAuthsList=function(n){return d.Message.setRepeatedWrapperField(this,9,n)};TronWebProto.Transaction.raw.prototype.addAuths=function(n,r){return d.Message.addToRepeatedWrapperField(this,9,n,TronWebProto.authority,r)};TronWebProto.Transaction.raw.prototype.clearAuthsList=function(){return this.setAuthsList([])};TronWebProto.Transaction.raw.prototype.getData=function(){return d.Message.getFieldWithDefault(this,10,"")};TronWebProto.Transaction.raw.prototype.getData_asB64=function(){return d.Message.bytesAsB64(this.getData())};TronWebProto.Transaction.raw.prototype.getData_asU8=function(){return d.Message.bytesAsU8(this.getData())};TronWebProto.Transaction.raw.prototype.setData=function(n){return d.Message.setProto3BytesField(this,10,n)};TronWebProto.Transaction.raw.prototype.getContractList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Transaction.Contract,11)};TronWebProto.Transaction.raw.prototype.setContractList=function(n){return d.Message.setRepeatedWrapperField(this,11,n)};TronWebProto.Transaction.raw.prototype.addContract=function(n,r){return d.Message.addToRepeatedWrapperField(this,11,n,TronWebProto.Transaction.Contract,r)};TronWebProto.Transaction.raw.prototype.clearContractList=function(){return this.setContractList([])};TronWebProto.Transaction.raw.prototype.getScripts=function(){return d.Message.getFieldWithDefault(this,12,"")};TronWebProto.Transaction.raw.prototype.getScripts_asB64=function(){return d.Message.bytesAsB64(this.getScripts())};TronWebProto.Transaction.raw.prototype.getScripts_asU8=function(){return d.Message.bytesAsU8(this.getScripts())};TronWebProto.Transaction.raw.prototype.setScripts=function(n){return d.Message.setProto3BytesField(this,12,n)};TronWebProto.Transaction.raw.prototype.getTimestamp=function(){return d.Message.getFieldWithDefault(this,14,0)};TronWebProto.Transaction.raw.prototype.setTimestamp=function(n){return d.Message.setProto3IntField(this,14,n)};TronWebProto.Transaction.raw.prototype.getFeeLimit=function(){return d.Message.getFieldWithDefault(this,18,0)};TronWebProto.Transaction.raw.prototype.setFeeLimit=function(n){return d.Message.setProto3IntField(this,18,n)};TronWebProto.Transaction.prototype.getRawData=function(){return d.Message.getWrapperField(this,TronWebProto.Transaction.raw,1)};TronWebProto.Transaction.prototype.setRawData=function(n){return d.Message.setWrapperField(this,1,n)};TronWebProto.Transaction.prototype.clearRawData=function(){return this.setRawData(void 0)};TronWebProto.Transaction.prototype.hasRawData=function(){return d.Message.getField(this,1)!=null};TronWebProto.Transaction.prototype.getSignatureList=function(){return d.Message.getRepeatedField(this,2)};TronWebProto.Transaction.prototype.getSignatureList_asB64=function(){return d.Message.bytesListAsB64(this.getSignatureList())};TronWebProto.Transaction.prototype.getSignatureList_asU8=function(){return d.Message.bytesListAsU8(this.getSignatureList())};TronWebProto.Transaction.prototype.setSignatureList=function(n){return d.Message.setField(this,2,n||[])};TronWebProto.Transaction.prototype.addSignature=function(n,r){return d.Message.addToRepeatedField(this,2,n,r)};TronWebProto.Transaction.prototype.clearSignatureList=function(){return this.setSignatureList([])};TronWebProto.Transaction.prototype.getRetList=function(){return d.Message.getRepeatedWrapperField(this,TronWebProto.Transaction.Result,5)};TronWebProto.Transaction.prototype.setRetList=function(n){return d.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.Transaction.prototype.addRet=function(n,r){return d.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.Transaction.Result,r)};TronWebProto.Transaction.prototype.clearRetList=function(){return this.setRetList([])};TronWebProto.AccountType={NORMAL:0,ASSETISSUE:1,CONTRACT:2};J.object.extend(Zp,TronWebProto)});var wu=Ot(Hp=>{var lh=mr(),Jp=lh,Pu=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Pu<"u"&&Pu||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();Jp.exportSymbol("TronWebProto.ResourceCode",null,Pu);TronWebProto.ResourceCode={BANDWIDTH:0,ENERGY:1,TRON_POWER:2};Jp.object.extend(Hp,TronWebProto)});var Xp=Ot(Kp=>{var m=mr(),K=m,nt=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof nt<"u"&&nt||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),dh=wu();K.object.extend(proto,dh);K.exportSymbol("TronWebProto.AccountBalanceRequest",null,nt);K.exportSymbol("TronWebProto.AccountBalanceResponse",null,nt);K.exportSymbol("TronWebProto.AccountIdentifier",null,nt);K.exportSymbol("TronWebProto.AccountTrace",null,nt);K.exportSymbol("TronWebProto.BlockBalanceTrace",null,nt);K.exportSymbol("TronWebProto.BlockBalanceTrace.BlockIdentifier",null,nt);K.exportSymbol("TronWebProto.CancelAllUnfreezeV2Contract",null,nt);K.exportSymbol("TronWebProto.DelegateResourceContract",null,nt);K.exportSymbol("TronWebProto.FreezeBalanceContract",null,nt);K.exportSymbol("TronWebProto.FreezeBalanceV2Contract",null,nt);K.exportSymbol("TronWebProto.TransactionBalanceTrace",null,nt);K.exportSymbol("TronWebProto.TransactionBalanceTrace.Operation",null,nt);K.exportSymbol("TronWebProto.TransferContract",null,nt);K.exportSymbol("TronWebProto.UnDelegateResourceContract",null,nt);K.exportSymbol("TronWebProto.UnfreezeBalanceContract",null,nt);K.exportSymbol("TronWebProto.UnfreezeBalanceV2Contract",null,nt);K.exportSymbol("TronWebProto.WithdrawBalanceContract",null,nt);K.exportSymbol("TronWebProto.WithdrawExpireUnfreezeContract",null,nt);TronWebProto.FreezeBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.FreezeBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.FreezeBalanceContract.displayName="TronWebProto.FreezeBalanceContract");TronWebProto.UnfreezeBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnfreezeBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeBalanceContract.displayName="TronWebProto.UnfreezeBalanceContract");TronWebProto.WithdrawBalanceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.WithdrawBalanceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.WithdrawBalanceContract.displayName="TronWebProto.WithdrawBalanceContract");TronWebProto.TransferContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.TransferContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransferContract.displayName="TronWebProto.TransferContract");TronWebProto.TransactionBalanceTrace=function(n){m.Message.initialize(this,n,0,-1,TronWebProto.TransactionBalanceTrace.repeatedFields_,null)};K.inherits(TronWebProto.TransactionBalanceTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransactionBalanceTrace.displayName="TronWebProto.TransactionBalanceTrace");TronWebProto.TransactionBalanceTrace.Operation=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.TransactionBalanceTrace.Operation,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.TransactionBalanceTrace.Operation.displayName="TronWebProto.TransactionBalanceTrace.Operation");TronWebProto.BlockBalanceTrace=function(n){m.Message.initialize(this,n,0,-1,TronWebProto.BlockBalanceTrace.repeatedFields_,null)};K.inherits(TronWebProto.BlockBalanceTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.BlockBalanceTrace.displayName="TronWebProto.BlockBalanceTrace");TronWebProto.BlockBalanceTrace.BlockIdentifier=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.BlockBalanceTrace.BlockIdentifier,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.BlockBalanceTrace.BlockIdentifier.displayName="TronWebProto.BlockBalanceTrace.BlockIdentifier");TronWebProto.AccountTrace=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountTrace,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountTrace.displayName="TronWebProto.AccountTrace");TronWebProto.AccountIdentifier=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountIdentifier,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountIdentifier.displayName="TronWebProto.AccountIdentifier");TronWebProto.AccountBalanceRequest=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountBalanceRequest,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountBalanceRequest.displayName="TronWebProto.AccountBalanceRequest");TronWebProto.AccountBalanceResponse=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.AccountBalanceResponse,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.AccountBalanceResponse.displayName="TronWebProto.AccountBalanceResponse");TronWebProto.FreezeBalanceV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.FreezeBalanceV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.FreezeBalanceV2Contract.displayName="TronWebProto.FreezeBalanceV2Contract");TronWebProto.UnfreezeBalanceV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnfreezeBalanceV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeBalanceV2Contract.displayName="TronWebProto.UnfreezeBalanceV2Contract");TronWebProto.WithdrawExpireUnfreezeContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.WithdrawExpireUnfreezeContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.WithdrawExpireUnfreezeContract.displayName="TronWebProto.WithdrawExpireUnfreezeContract");TronWebProto.DelegateResourceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.DelegateResourceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.DelegateResourceContract.displayName="TronWebProto.DelegateResourceContract");TronWebProto.UnDelegateResourceContract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.UnDelegateResourceContract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.UnDelegateResourceContract.displayName="TronWebProto.UnDelegateResourceContract");TronWebProto.CancelAllUnfreezeV2Contract=function(n){m.Message.initialize(this,n,0,-1,null,null)};K.inherits(TronWebProto.CancelAllUnfreezeV2Contract,m.Message);K.DEBUG&&!COMPILED&&(TronWebProto.CancelAllUnfreezeV2Contract.displayName="TronWebProto.CancelAllUnfreezeV2Contract");m.Message.GENERATE_TO_OBJECT&&(TronWebProto.FreezeBalanceContract.prototype.toObject=function(n){return TronWebProto.FreezeBalanceContract.toObject(n,this)},TronWebProto.FreezeBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),frozenBalance:m.Message.getFieldWithDefault(r,2,0),frozenDuration:m.Message.getFieldWithDefault(r,3,0),resource:m.Message.getFieldWithDefault(r,10,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.FreezeBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.FreezeBalanceContract;return TronWebProto.FreezeBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.FreezeBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setFrozenBalance(s);break;case 3:var s=r.readInt64();n.setFrozenDuration(s);break;case 10:var s=r.readEnum();n.setResource(s);break;case 15:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.FreezeBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.FreezeBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.FreezeBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFrozenBalance(),o!==0&&r.writeInt64(2,o),o=n.getFrozenDuration(),o!==0&&r.writeInt64(3,o),o=n.getResource(),o!==0&&r.writeEnum(10,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(15,o)};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.FreezeBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.FreezeBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.FreezeBalanceContract.prototype.getFrozenBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.FreezeBalanceContract.prototype.setFrozenBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.FreezeBalanceContract.prototype.getFrozenDuration=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.FreezeBalanceContract.prototype.setFrozenDuration=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.FreezeBalanceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,10,0)};TronWebProto.FreezeBalanceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,10,n)};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,15,"")};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.FreezeBalanceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.FreezeBalanceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,15,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeBalanceContract.prototype.toObject=function(n){return TronWebProto.UnfreezeBalanceContract.toObject(n,this)},TronWebProto.UnfreezeBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,10,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnfreezeBalanceContract;return TronWebProto.UnfreezeBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 10:var s=r.readEnum();n.setResource(s);break;case 15:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnfreezeBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(10,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(15,o)};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnfreezeBalanceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,10,0)};TronWebProto.UnfreezeBalanceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,10,n)};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,15,"")};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.UnfreezeBalanceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.UnfreezeBalanceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,15,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.WithdrawBalanceContract.prototype.toObject=function(n){return TronWebProto.WithdrawBalanceContract.toObject(n,this)},TronWebProto.WithdrawBalanceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WithdrawBalanceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.WithdrawBalanceContract;return TronWebProto.WithdrawBalanceContract.deserializeBinaryFromReader(o,r)};TronWebProto.WithdrawBalanceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.WithdrawBalanceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.WithdrawBalanceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WithdrawBalanceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WithdrawBalanceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WithdrawBalanceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransferContract.prototype.toObject=function(n){return TronWebProto.TransferContract.toObject(n,this)},TronWebProto.TransferContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),amount:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransferContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransferContract;return TronWebProto.TransferContract.deserializeBinaryFromReader(o,r)};TronWebProto.TransferContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setToAddress(s);break;case 3:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransferContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransferContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransferContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAmount(),o!==0&&r.writeInt64(3,o)};TronWebProto.TransferContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransferContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TransferContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TransferContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.TransferContract.prototype.getToAddress=function(){return m.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransferContract.prototype.getToAddress_asB64=function(){return m.Message.bytesAsB64(this.getToAddress())};TronWebProto.TransferContract.prototype.getToAddress_asU8=function(){return m.Message.bytesAsU8(this.getToAddress())};TronWebProto.TransferContract.prototype.setToAddress=function(n){return m.Message.setProto3BytesField(this,2,n)};TronWebProto.TransferContract.prototype.getAmount=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.TransferContract.prototype.setAmount=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.TransactionBalanceTrace.repeatedFields_=[2];m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransactionBalanceTrace.prototype.toObject=function(n){return TronWebProto.TransactionBalanceTrace.toObject(n,this)},TronWebProto.TransactionBalanceTrace.toObject=function(n,r){var o,s={transactionIdentifier:r.getTransactionIdentifier_asB64(),operationList:m.Message.toObjectList(r.getOperationList(),TronWebProto.TransactionBalanceTrace.Operation.toObject,n),type:m.Message.getFieldWithDefault(r,3,""),status:m.Message.getFieldWithDefault(r,4,"")};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransactionBalanceTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransactionBalanceTrace;return TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader(o,r)};TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setTransactionIdentifier(s);break;case 2:var s=new TronWebProto.TransactionBalanceTrace.Operation;r.readMessage(s,TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader),n.addOperation(s);break;case 3:var s=r.readString();n.setType(s);break;case 4:var s=r.readString();n.setStatus(s);break;default:r.skipField();break}}return n};TronWebProto.TransactionBalanceTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getTransactionIdentifier_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOperationList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter),o=n.getType(),o.length>0&&r.writeString(3,o),o=n.getStatus(),o.length>0&&r.writeString(4,o)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransactionBalanceTrace.Operation.prototype.toObject=function(n){return TronWebProto.TransactionBalanceTrace.Operation.toObject(n,this)},TronWebProto.TransactionBalanceTrace.Operation.toObject=function(n,r){var o,s={operationIdentifier:m.Message.getFieldWithDefault(r,1,0),address:r.getAddress_asB64(),amount:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransactionBalanceTrace.Operation.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.TransactionBalanceTrace.Operation;return TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader(o,r)};TronWebProto.TransactionBalanceTrace.Operation.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setOperationIdentifier(s);break;case 2:var s=r.readBytes();n.setAddress(s);break;case 3:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransactionBalanceTrace.Operation.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransactionBalanceTrace.Operation.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOperationIdentifier(),o!==0&&r.writeInt64(1,o),o=n.getAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAmount(),o!==0&&r.writeInt64(3,o)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getOperationIdentifier=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.TransactionBalanceTrace.Operation.prototype.setOperationIdentifier=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress=function(){return m.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress_asB64=function(){return m.Message.bytesAsB64(this.getAddress())};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAddress_asU8=function(){return m.Message.bytesAsU8(this.getAddress())};TronWebProto.TransactionBalanceTrace.Operation.prototype.setAddress=function(n){return m.Message.setProto3BytesField(this,2,n)};TronWebProto.TransactionBalanceTrace.Operation.prototype.getAmount=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.TransactionBalanceTrace.Operation.prototype.setAmount=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier_asB64=function(){return m.Message.bytesAsB64(this.getTransactionIdentifier())};TronWebProto.TransactionBalanceTrace.prototype.getTransactionIdentifier_asU8=function(){return m.Message.bytesAsU8(this.getTransactionIdentifier())};TronWebProto.TransactionBalanceTrace.prototype.setTransactionIdentifier=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.TransactionBalanceTrace.prototype.getOperationList=function(){return m.Message.getRepeatedWrapperField(this,TronWebProto.TransactionBalanceTrace.Operation,2)};TronWebProto.TransactionBalanceTrace.prototype.setOperationList=function(n){return m.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.TransactionBalanceTrace.prototype.addOperation=function(n,r){return m.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.TransactionBalanceTrace.Operation,r)};TronWebProto.TransactionBalanceTrace.prototype.clearOperationList=function(){return this.setOperationList([])};TronWebProto.TransactionBalanceTrace.prototype.getType=function(){return m.Message.getFieldWithDefault(this,3,"")};TronWebProto.TransactionBalanceTrace.prototype.setType=function(n){return m.Message.setProto3StringField(this,3,n)};TronWebProto.TransactionBalanceTrace.prototype.getStatus=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.TransactionBalanceTrace.prototype.setStatus=function(n){return m.Message.setProto3StringField(this,4,n)};TronWebProto.BlockBalanceTrace.repeatedFields_=[3];m.Message.GENERATE_TO_OBJECT&&(TronWebProto.BlockBalanceTrace.prototype.toObject=function(n){return TronWebProto.BlockBalanceTrace.toObject(n,this)},TronWebProto.BlockBalanceTrace.toObject=function(n,r){var o,s={blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o),timestamp:m.Message.getFieldWithDefault(r,2,0),transactionBalanceTraceList:m.Message.toObjectList(r.getTransactionBalanceTraceList(),TronWebProto.TransactionBalanceTrace.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BlockBalanceTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.BlockBalanceTrace;return TronWebProto.BlockBalanceTrace.deserializeBinaryFromReader(o,r)};TronWebProto.BlockBalanceTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;case 2:var s=r.readInt64();n.setTimestamp(s);break;case 3:var s=new TronWebProto.TransactionBalanceTrace;r.readMessage(s,TronWebProto.TransactionBalanceTrace.deserializeBinaryFromReader),n.addTransactionBalanceTrace(s);break;default:r.skipField();break}}return n};TronWebProto.BlockBalanceTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.BlockBalanceTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BlockBalanceTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBlockIdentifier(),o!=null&&r.writeMessage(1,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter),o=n.getTimestamp(),o!==0&&r.writeInt64(2,o),o=n.getTransactionBalanceTraceList(),o.length>0&&r.writeRepeatedMessage(3,o,TronWebProto.TransactionBalanceTrace.serializeBinaryToWriter)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.toObject=function(n){return TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,this)},TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject=function(n,r){var o,s={hash:r.getHash_asB64(),number:m.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.BlockBalanceTrace.BlockIdentifier;return TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader(o,r)};TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setHash(s);break;case 2:var s=r.readInt64();n.setNumber(s);break;default:r.skipField();break}}return n};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getHash_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getNumber(),o!==0&&r.writeInt64(2,o)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash_asB64=function(){return m.Message.bytesAsB64(this.getHash())};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getHash_asU8=function(){return m.Message.bytesAsU8(this.getHash())};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.setHash=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.getNumber=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.BlockBalanceTrace.BlockIdentifier.prototype.setNumber=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.BlockBalanceTrace.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,1)};TronWebProto.BlockBalanceTrace.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,1,n)};TronWebProto.BlockBalanceTrace.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.BlockBalanceTrace.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,1)!=null};TronWebProto.BlockBalanceTrace.prototype.getTimestamp=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.BlockBalanceTrace.prototype.setTimestamp=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.BlockBalanceTrace.prototype.getTransactionBalanceTraceList=function(){return m.Message.getRepeatedWrapperField(this,TronWebProto.TransactionBalanceTrace,3)};TronWebProto.BlockBalanceTrace.prototype.setTransactionBalanceTraceList=function(n){return m.Message.setRepeatedWrapperField(this,3,n)};TronWebProto.BlockBalanceTrace.prototype.addTransactionBalanceTrace=function(n,r){return m.Message.addToRepeatedWrapperField(this,3,n,TronWebProto.TransactionBalanceTrace,r)};TronWebProto.BlockBalanceTrace.prototype.clearTransactionBalanceTraceList=function(){return this.setTransactionBalanceTraceList([])};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountTrace.prototype.toObject=function(n){return TronWebProto.AccountTrace.toObject(n,this)},TronWebProto.AccountTrace.toObject=function(n,r){var o,s={balance:m.Message.getFieldWithDefault(r,1,0),placeholder:m.Message.getFieldWithDefault(r,99,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountTrace.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountTrace;return TronWebProto.AccountTrace.deserializeBinaryFromReader(o,r)};TronWebProto.AccountTrace.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setBalance(s);break;case 99:var s=r.readInt64();n.setPlaceholder(s);break;default:r.skipField();break}}return n};TronWebProto.AccountTrace.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountTrace.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountTrace.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBalance(),o!==0&&r.writeInt64(1,o),o=n.getPlaceholder(),o!==0&&r.writeInt64(99,o)};TronWebProto.AccountTrace.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.AccountTrace.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.AccountTrace.prototype.getPlaceholder=function(){return m.Message.getFieldWithDefault(this,99,0)};TronWebProto.AccountTrace.prototype.setPlaceholder=function(n){return m.Message.setProto3IntField(this,99,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountIdentifier.prototype.toObject=function(n){return TronWebProto.AccountIdentifier.toObject(n,this)},TronWebProto.AccountIdentifier.toObject=function(n,r){var o,s={address:r.getAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountIdentifier.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountIdentifier;return TronWebProto.AccountIdentifier.deserializeBinaryFromReader(o,r)};TronWebProto.AccountIdentifier.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountIdentifier.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountIdentifier.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountIdentifier.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.AccountIdentifier.prototype.getAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountIdentifier.prototype.getAddress_asB64=function(){return m.Message.bytesAsB64(this.getAddress())};TronWebProto.AccountIdentifier.prototype.getAddress_asU8=function(){return m.Message.bytesAsU8(this.getAddress())};TronWebProto.AccountIdentifier.prototype.setAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountBalanceRequest.prototype.toObject=function(n){return TronWebProto.AccountBalanceRequest.toObject(n,this)},TronWebProto.AccountBalanceRequest.toObject=function(n,r){var o,s={accountIdentifier:(o=r.getAccountIdentifier())&&TronWebProto.AccountIdentifier.toObject(n,o),blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountBalanceRequest.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountBalanceRequest;return TronWebProto.AccountBalanceRequest.deserializeBinaryFromReader(o,r)};TronWebProto.AccountBalanceRequest.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.AccountIdentifier;r.readMessage(s,TronWebProto.AccountIdentifier.deserializeBinaryFromReader),n.setAccountIdentifier(s);break;case 2:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;default:r.skipField();break}}return n};TronWebProto.AccountBalanceRequest.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountBalanceRequest.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountBalanceRequest.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountIdentifier(),o!=null&&r.writeMessage(1,o,TronWebProto.AccountIdentifier.serializeBinaryToWriter),o=n.getBlockIdentifier(),o!=null&&r.writeMessage(2,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter)};TronWebProto.AccountBalanceRequest.prototype.getAccountIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.AccountIdentifier,1)};TronWebProto.AccountBalanceRequest.prototype.setAccountIdentifier=function(n){return m.Message.setWrapperField(this,1,n)};TronWebProto.AccountBalanceRequest.prototype.clearAccountIdentifier=function(){return this.setAccountIdentifier(void 0)};TronWebProto.AccountBalanceRequest.prototype.hasAccountIdentifier=function(){return m.Message.getField(this,1)!=null};TronWebProto.AccountBalanceRequest.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,2)};TronWebProto.AccountBalanceRequest.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,2,n)};TronWebProto.AccountBalanceRequest.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.AccountBalanceRequest.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,2)!=null};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountBalanceResponse.prototype.toObject=function(n){return TronWebProto.AccountBalanceResponse.toObject(n,this)},TronWebProto.AccountBalanceResponse.toObject=function(n,r){var o,s={balance:m.Message.getFieldWithDefault(r,1,0),blockIdentifier:(o=r.getBlockIdentifier())&&TronWebProto.BlockBalanceTrace.BlockIdentifier.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountBalanceResponse.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.AccountBalanceResponse;return TronWebProto.AccountBalanceResponse.deserializeBinaryFromReader(o,r)};TronWebProto.AccountBalanceResponse.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setBalance(s);break;case 2:var s=new TronWebProto.BlockBalanceTrace.BlockIdentifier;r.readMessage(s,TronWebProto.BlockBalanceTrace.BlockIdentifier.deserializeBinaryFromReader),n.setBlockIdentifier(s);break;default:r.skipField();break}}return n};TronWebProto.AccountBalanceResponse.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.AccountBalanceResponse.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountBalanceResponse.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getBalance(),o!==0&&r.writeInt64(1,o),o=n.getBlockIdentifier(),o!=null&&r.writeMessage(2,o,TronWebProto.BlockBalanceTrace.BlockIdentifier.serializeBinaryToWriter)};TronWebProto.AccountBalanceResponse.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,1,0)};TronWebProto.AccountBalanceResponse.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,1,n)};TronWebProto.AccountBalanceResponse.prototype.getBlockIdentifier=function(){return m.Message.getWrapperField(this,TronWebProto.BlockBalanceTrace.BlockIdentifier,2)};TronWebProto.AccountBalanceResponse.prototype.setBlockIdentifier=function(n){return m.Message.setWrapperField(this,2,n)};TronWebProto.AccountBalanceResponse.prototype.clearBlockIdentifier=function(){return this.setBlockIdentifier(void 0)};TronWebProto.AccountBalanceResponse.prototype.hasBlockIdentifier=function(){return m.Message.getField(this,2)!=null};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.FreezeBalanceV2Contract.prototype.toObject=function(n){return TronWebProto.FreezeBalanceV2Contract.toObject(n,this)},TronWebProto.FreezeBalanceV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),frozenBalance:m.Message.getFieldWithDefault(r,2,0),resource:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.FreezeBalanceV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.FreezeBalanceV2Contract;return TronWebProto.FreezeBalanceV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.FreezeBalanceV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setFrozenBalance(s);break;case 3:var s=r.readEnum();n.setResource(s);break;default:r.skipField();break}}return n};TronWebProto.FreezeBalanceV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.FreezeBalanceV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.FreezeBalanceV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFrozenBalance(),o!==0&&r.writeInt64(2,o),o=n.getResource(),o!==0&&r.writeEnum(3,o)};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.FreezeBalanceV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.FreezeBalanceV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.FreezeBalanceV2Contract.prototype.getFrozenBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.FreezeBalanceV2Contract.prototype.setFrozenBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.FreezeBalanceV2Contract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.FreezeBalanceV2Contract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,3,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeBalanceV2Contract.prototype.toObject=function(n){return TronWebProto.UnfreezeBalanceV2Contract.toObject(n,this)},TronWebProto.UnfreezeBalanceV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),unfreezeBalance:m.Message.getFieldWithDefault(r,2,0),resource:m.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeBalanceV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnfreezeBalanceV2Contract;return TronWebProto.UnfreezeBalanceV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeBalanceV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setUnfreezeBalance(s);break;case 3:var s=r.readEnum();n.setResource(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeBalanceV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnfreezeBalanceV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeBalanceV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUnfreezeBalance(),o!==0&&r.writeInt64(2,o),o=n.getResource(),o!==0&&r.writeEnum(3,o)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeBalanceV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getUnfreezeBalance=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.UnfreezeBalanceV2Contract.prototype.setUnfreezeBalance=function(n){return m.Message.setProto3IntField(this,2,n)};TronWebProto.UnfreezeBalanceV2Contract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.UnfreezeBalanceV2Contract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,3,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.WithdrawExpireUnfreezeContract.prototype.toObject=function(n){return TronWebProto.WithdrawExpireUnfreezeContract.toObject(n,this)},TronWebProto.WithdrawExpireUnfreezeContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.WithdrawExpireUnfreezeContract;return TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinaryFromReader(o,r)};TronWebProto.WithdrawExpireUnfreezeContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.WithdrawExpireUnfreezeContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.WithdrawExpireUnfreezeContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WithdrawExpireUnfreezeContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WithdrawExpireUnfreezeContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WithdrawExpireUnfreezeContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.DelegateResourceContract.prototype.toObject=function(n){return TronWebProto.DelegateResourceContract.toObject(n,this)},TronWebProto.DelegateResourceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,2,0),balance:m.Message.getFieldWithDefault(r,3,0),receiverAddress:r.getReceiverAddress_asB64(),lock:m.Message.getBooleanFieldWithDefault(r,5,!1),lockPeriod:m.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.DelegateResourceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.DelegateResourceContract;return TronWebProto.DelegateResourceContract.deserializeBinaryFromReader(o,r)};TronWebProto.DelegateResourceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readEnum();n.setResource(s);break;case 3:var s=r.readInt64();n.setBalance(s);break;case 4:var s=r.readBytes();n.setReceiverAddress(s);break;case 5:var s=r.readBool();n.setLock(s);break;case 6:var s=r.readInt64();n.setLockPeriod(s);break;default:r.skipField();break}}return n};TronWebProto.DelegateResourceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.DelegateResourceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.DelegateResourceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(2,o),o=n.getBalance(),o!==0&&r.writeInt64(3,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getLock(),o&&r.writeBool(5,o),o=n.getLockPeriod(),o!==0&&r.writeInt64(6,o)};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.DelegateResourceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.DelegateResourceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.DelegateResourceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.DelegateResourceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,2,n)};TronWebProto.DelegateResourceContract.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.DelegateResourceContract.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.DelegateResourceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.DelegateResourceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,4,n)};TronWebProto.DelegateResourceContract.prototype.getLock=function(){return m.Message.getBooleanFieldWithDefault(this,5,!1)};TronWebProto.DelegateResourceContract.prototype.setLock=function(n){return m.Message.setProto3BooleanField(this,5,n)};TronWebProto.DelegateResourceContract.prototype.getLockPeriod=function(){return m.Message.getFieldWithDefault(this,6,0)};TronWebProto.DelegateResourceContract.prototype.setLockPeriod=function(n){return m.Message.setProto3IntField(this,6,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnDelegateResourceContract.prototype.toObject=function(n){return TronWebProto.UnDelegateResourceContract.toObject(n,this)},TronWebProto.UnDelegateResourceContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),resource:m.Message.getFieldWithDefault(r,2,0),balance:m.Message.getFieldWithDefault(r,3,0),receiverAddress:r.getReceiverAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnDelegateResourceContract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.UnDelegateResourceContract;return TronWebProto.UnDelegateResourceContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnDelegateResourceContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readEnum();n.setResource(s);break;case 3:var s=r.readInt64();n.setBalance(s);break;case 4:var s=r.readBytes();n.setReceiverAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnDelegateResourceContract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.UnDelegateResourceContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnDelegateResourceContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getResource(),o!==0&&r.writeEnum(2,o),o=n.getBalance(),o!==0&&r.writeInt64(3,o),o=n.getReceiverAddress_asU8(),o.length>0&&r.writeBytes(4,o)};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnDelegateResourceContract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnDelegateResourceContract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};TronWebProto.UnDelegateResourceContract.prototype.getResource=function(){return m.Message.getFieldWithDefault(this,2,0)};TronWebProto.UnDelegateResourceContract.prototype.setResource=function(n){return m.Message.setProto3EnumField(this,2,n)};TronWebProto.UnDelegateResourceContract.prototype.getBalance=function(){return m.Message.getFieldWithDefault(this,3,0)};TronWebProto.UnDelegateResourceContract.prototype.setBalance=function(n){return m.Message.setProto3IntField(this,3,n)};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress=function(){return m.Message.getFieldWithDefault(this,4,"")};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress_asB64=function(){return m.Message.bytesAsB64(this.getReceiverAddress())};TronWebProto.UnDelegateResourceContract.prototype.getReceiverAddress_asU8=function(){return m.Message.bytesAsU8(this.getReceiverAddress())};TronWebProto.UnDelegateResourceContract.prototype.setReceiverAddress=function(n){return m.Message.setProto3BytesField(this,4,n)};m.Message.GENERATE_TO_OBJECT&&(TronWebProto.CancelAllUnfreezeV2Contract.prototype.toObject=function(n){return TronWebProto.CancelAllUnfreezeV2Contract.toObject(n,this)},TronWebProto.CancelAllUnfreezeV2Contract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinary=function(n){var r=new m.BinaryReader(n),o=new TronWebProto.CancelAllUnfreezeV2Contract;return TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinaryFromReader(o,r)};TronWebProto.CancelAllUnfreezeV2Contract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.CancelAllUnfreezeV2Contract.prototype.serializeBinary=function(){var n=new m.BinaryWriter;return TronWebProto.CancelAllUnfreezeV2Contract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.CancelAllUnfreezeV2Contract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress=function(){return m.Message.getFieldWithDefault(this,1,"")};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress_asB64=function(){return m.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.CancelAllUnfreezeV2Contract.prototype.getOwnerAddress_asU8=function(){return m.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.CancelAllUnfreezeV2Contract.prototype.setOwnerAddress=function(n){return m.Message.setProto3BytesField(this,1,n)};K.object.extend(Kp,TronWebProto)});var qp=Ot(Yp=>{var B=mr(),ut=B,Rn=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Rn<"u"&&Rn||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();ut.exportSymbol("TronWebProto.AssetIssueContract",null,Rn);ut.exportSymbol("TronWebProto.AssetIssueContract.FrozenSupply",null,Rn);ut.exportSymbol("TronWebProto.ParticipateAssetIssueContract",null,Rn);ut.exportSymbol("TronWebProto.TransferAssetContract",null,Rn);ut.exportSymbol("TronWebProto.UnfreezeAssetContract",null,Rn);ut.exportSymbol("TronWebProto.UpdateAssetContract",null,Rn);TronWebProto.AssetIssueContract=function(n){B.Message.initialize(this,n,0,-1,TronWebProto.AssetIssueContract.repeatedFields_,null)};ut.inherits(TronWebProto.AssetIssueContract,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.AssetIssueContract.displayName="TronWebProto.AssetIssueContract");TronWebProto.AssetIssueContract.FrozenSupply=function(n){B.Message.initialize(this,n,0,-1,null,null)};ut.inherits(TronWebProto.AssetIssueContract.FrozenSupply,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.AssetIssueContract.FrozenSupply.displayName="TronWebProto.AssetIssueContract.FrozenSupply");TronWebProto.TransferAssetContract=function(n){B.Message.initialize(this,n,0,-1,null,null)};ut.inherits(TronWebProto.TransferAssetContract,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.TransferAssetContract.displayName="TronWebProto.TransferAssetContract");TronWebProto.UnfreezeAssetContract=function(n){B.Message.initialize(this,n,0,-1,null,null)};ut.inherits(TronWebProto.UnfreezeAssetContract,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.UnfreezeAssetContract.displayName="TronWebProto.UnfreezeAssetContract");TronWebProto.UpdateAssetContract=function(n){B.Message.initialize(this,n,0,-1,null,null)};ut.inherits(TronWebProto.UpdateAssetContract,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.UpdateAssetContract.displayName="TronWebProto.UpdateAssetContract");TronWebProto.ParticipateAssetIssueContract=function(n){B.Message.initialize(this,n,0,-1,null,null)};ut.inherits(TronWebProto.ParticipateAssetIssueContract,B.Message);ut.DEBUG&&!COMPILED&&(TronWebProto.ParticipateAssetIssueContract.displayName="TronWebProto.ParticipateAssetIssueContract");TronWebProto.AssetIssueContract.repeatedFields_=[5];B.Message.GENERATE_TO_OBJECT&&(TronWebProto.AssetIssueContract.prototype.toObject=function(n){return TronWebProto.AssetIssueContract.toObject(n,this)},TronWebProto.AssetIssueContract.toObject=function(n,r){var o,s={id:B.Message.getFieldWithDefault(r,41,""),ownerAddress:r.getOwnerAddress_asB64(),name:r.getName_asB64(),abbr:r.getAbbr_asB64(),totalSupply:B.Message.getFieldWithDefault(r,4,0),frozenSupplyList:B.Message.toObjectList(r.getFrozenSupplyList(),TronWebProto.AssetIssueContract.FrozenSupply.toObject,n),trxNum:B.Message.getFieldWithDefault(r,6,0),precision:B.Message.getFieldWithDefault(r,7,0),num:B.Message.getFieldWithDefault(r,8,0),startTime:B.Message.getFieldWithDefault(r,9,0),endTime:B.Message.getFieldWithDefault(r,10,0),order:B.Message.getFieldWithDefault(r,11,0),voteScore:B.Message.getFieldWithDefault(r,16,0),description:r.getDescription_asB64(),url:r.getUrl_asB64(),freeAssetNetLimit:B.Message.getFieldWithDefault(r,22,0),publicFreeAssetNetLimit:B.Message.getFieldWithDefault(r,23,0),publicFreeAssetNetUsage:B.Message.getFieldWithDefault(r,24,0),publicLatestFreeNetTime:B.Message.getFieldWithDefault(r,25,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AssetIssueContract.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.AssetIssueContract;return TronWebProto.AssetIssueContract.deserializeBinaryFromReader(o,r)};TronWebProto.AssetIssueContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 41:var s=r.readString();n.setId(s);break;case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setName(s);break;case 3:var s=r.readBytes();n.setAbbr(s);break;case 4:var s=r.readInt64();n.setTotalSupply(s);break;case 5:var s=new TronWebProto.AssetIssueContract.FrozenSupply;r.readMessage(s,TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader),n.addFrozenSupply(s);break;case 6:var s=r.readInt32();n.setTrxNum(s);break;case 7:var s=r.readInt32();n.setPrecision(s);break;case 8:var s=r.readInt32();n.setNum(s);break;case 9:var s=r.readInt64();n.setStartTime(s);break;case 10:var s=r.readInt64();n.setEndTime(s);break;case 11:var s=r.readInt64();n.setOrder(s);break;case 16:var s=r.readInt32();n.setVoteScore(s);break;case 20:var s=r.readBytes();n.setDescription(s);break;case 21:var s=r.readBytes();n.setUrl(s);break;case 22:var s=r.readInt64();n.setFreeAssetNetLimit(s);break;case 23:var s=r.readInt64();n.setPublicFreeAssetNetLimit(s);break;case 24:var s=r.readInt64();n.setPublicFreeAssetNetUsage(s);break;case 25:var s=r.readInt64();n.setPublicLatestFreeNetTime(s);break;default:r.skipField();break}}return n};TronWebProto.AssetIssueContract.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.AssetIssueContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AssetIssueContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getId(),o.length>0&&r.writeString(41,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getName_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAbbr_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getTotalSupply(),o!==0&&r.writeInt64(4,o),o=n.getFrozenSupplyList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter),o=n.getTrxNum(),o!==0&&r.writeInt32(6,o),o=n.getPrecision(),o!==0&&r.writeInt32(7,o),o=n.getNum(),o!==0&&r.writeInt32(8,o),o=n.getStartTime(),o!==0&&r.writeInt64(9,o),o=n.getEndTime(),o!==0&&r.writeInt64(10,o),o=n.getOrder(),o!==0&&r.writeInt64(11,o),o=n.getVoteScore(),o!==0&&r.writeInt32(16,o),o=n.getDescription_asU8(),o.length>0&&r.writeBytes(20,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(21,o),o=n.getFreeAssetNetLimit(),o!==0&&r.writeInt64(22,o),o=n.getPublicFreeAssetNetLimit(),o!==0&&r.writeInt64(23,o),o=n.getPublicFreeAssetNetUsage(),o!==0&&r.writeInt64(24,o),o=n.getPublicLatestFreeNetTime(),o!==0&&r.writeInt64(25,o)};B.Message.GENERATE_TO_OBJECT&&(TronWebProto.AssetIssueContract.FrozenSupply.prototype.toObject=function(n){return TronWebProto.AssetIssueContract.FrozenSupply.toObject(n,this)},TronWebProto.AssetIssueContract.FrozenSupply.toObject=function(n,r){var o,s={frozenAmount:B.Message.getFieldWithDefault(r,1,0),frozenDays:B.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.AssetIssueContract.FrozenSupply;return TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader(o,r)};TronWebProto.AssetIssueContract.FrozenSupply.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setFrozenAmount(s);break;case 2:var s=r.readInt64();n.setFrozenDays(s);break;default:r.skipField();break}}return n};TronWebProto.AssetIssueContract.FrozenSupply.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AssetIssueContract.FrozenSupply.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getFrozenAmount(),o!==0&&r.writeInt64(1,o),o=n.getFrozenDays(),o!==0&&r.writeInt64(2,o)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.getFrozenAmount=function(){return B.Message.getFieldWithDefault(this,1,0)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.setFrozenAmount=function(n){return B.Message.setProto3IntField(this,1,n)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.getFrozenDays=function(){return B.Message.getFieldWithDefault(this,2,0)};TronWebProto.AssetIssueContract.FrozenSupply.prototype.setFrozenDays=function(n){return B.Message.setProto3IntField(this,2,n)};TronWebProto.AssetIssueContract.prototype.getId=function(){return B.Message.getFieldWithDefault(this,41,"")};TronWebProto.AssetIssueContract.prototype.setId=function(n){return B.Message.setProto3StringField(this,41,n)};TronWebProto.AssetIssueContract.prototype.getOwnerAddress=function(){return B.Message.getFieldWithDefault(this,1,"")};TronWebProto.AssetIssueContract.prototype.getOwnerAddress_asB64=function(){return B.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AssetIssueContract.prototype.getOwnerAddress_asU8=function(){return B.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AssetIssueContract.prototype.setOwnerAddress=function(n){return B.Message.setProto3BytesField(this,1,n)};TronWebProto.AssetIssueContract.prototype.getName=function(){return B.Message.getFieldWithDefault(this,2,"")};TronWebProto.AssetIssueContract.prototype.getName_asB64=function(){return B.Message.bytesAsB64(this.getName())};TronWebProto.AssetIssueContract.prototype.getName_asU8=function(){return B.Message.bytesAsU8(this.getName())};TronWebProto.AssetIssueContract.prototype.setName=function(n){return B.Message.setProto3BytesField(this,2,n)};TronWebProto.AssetIssueContract.prototype.getAbbr=function(){return B.Message.getFieldWithDefault(this,3,"")};TronWebProto.AssetIssueContract.prototype.getAbbr_asB64=function(){return B.Message.bytesAsB64(this.getAbbr())};TronWebProto.AssetIssueContract.prototype.getAbbr_asU8=function(){return B.Message.bytesAsU8(this.getAbbr())};TronWebProto.AssetIssueContract.prototype.setAbbr=function(n){return B.Message.setProto3BytesField(this,3,n)};TronWebProto.AssetIssueContract.prototype.getTotalSupply=function(){return B.Message.getFieldWithDefault(this,4,0)};TronWebProto.AssetIssueContract.prototype.setTotalSupply=function(n){return B.Message.setProto3IntField(this,4,n)};TronWebProto.AssetIssueContract.prototype.getFrozenSupplyList=function(){return B.Message.getRepeatedWrapperField(this,TronWebProto.AssetIssueContract.FrozenSupply,5)};TronWebProto.AssetIssueContract.prototype.setFrozenSupplyList=function(n){return B.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.AssetIssueContract.prototype.addFrozenSupply=function(n,r){return B.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.AssetIssueContract.FrozenSupply,r)};TronWebProto.AssetIssueContract.prototype.clearFrozenSupplyList=function(){return this.setFrozenSupplyList([])};TronWebProto.AssetIssueContract.prototype.getTrxNum=function(){return B.Message.getFieldWithDefault(this,6,0)};TronWebProto.AssetIssueContract.prototype.setTrxNum=function(n){return B.Message.setProto3IntField(this,6,n)};TronWebProto.AssetIssueContract.prototype.getPrecision=function(){return B.Message.getFieldWithDefault(this,7,0)};TronWebProto.AssetIssueContract.prototype.setPrecision=function(n){return B.Message.setProto3IntField(this,7,n)};TronWebProto.AssetIssueContract.prototype.getNum=function(){return B.Message.getFieldWithDefault(this,8,0)};TronWebProto.AssetIssueContract.prototype.setNum=function(n){return B.Message.setProto3IntField(this,8,n)};TronWebProto.AssetIssueContract.prototype.getStartTime=function(){return B.Message.getFieldWithDefault(this,9,0)};TronWebProto.AssetIssueContract.prototype.setStartTime=function(n){return B.Message.setProto3IntField(this,9,n)};TronWebProto.AssetIssueContract.prototype.getEndTime=function(){return B.Message.getFieldWithDefault(this,10,0)};TronWebProto.AssetIssueContract.prototype.setEndTime=function(n){return B.Message.setProto3IntField(this,10,n)};TronWebProto.AssetIssueContract.prototype.getOrder=function(){return B.Message.getFieldWithDefault(this,11,0)};TronWebProto.AssetIssueContract.prototype.setOrder=function(n){return B.Message.setProto3IntField(this,11,n)};TronWebProto.AssetIssueContract.prototype.getVoteScore=function(){return B.Message.getFieldWithDefault(this,16,0)};TronWebProto.AssetIssueContract.prototype.setVoteScore=function(n){return B.Message.setProto3IntField(this,16,n)};TronWebProto.AssetIssueContract.prototype.getDescription=function(){return B.Message.getFieldWithDefault(this,20,"")};TronWebProto.AssetIssueContract.prototype.getDescription_asB64=function(){return B.Message.bytesAsB64(this.getDescription())};TronWebProto.AssetIssueContract.prototype.getDescription_asU8=function(){return B.Message.bytesAsU8(this.getDescription())};TronWebProto.AssetIssueContract.prototype.setDescription=function(n){return B.Message.setProto3BytesField(this,20,n)};TronWebProto.AssetIssueContract.prototype.getUrl=function(){return B.Message.getFieldWithDefault(this,21,"")};TronWebProto.AssetIssueContract.prototype.getUrl_asB64=function(){return B.Message.bytesAsB64(this.getUrl())};TronWebProto.AssetIssueContract.prototype.getUrl_asU8=function(){return B.Message.bytesAsU8(this.getUrl())};TronWebProto.AssetIssueContract.prototype.setUrl=function(n){return B.Message.setProto3BytesField(this,21,n)};TronWebProto.AssetIssueContract.prototype.getFreeAssetNetLimit=function(){return B.Message.getFieldWithDefault(this,22,0)};TronWebProto.AssetIssueContract.prototype.setFreeAssetNetLimit=function(n){return B.Message.setProto3IntField(this,22,n)};TronWebProto.AssetIssueContract.prototype.getPublicFreeAssetNetLimit=function(){return B.Message.getFieldWithDefault(this,23,0)};TronWebProto.AssetIssueContract.prototype.setPublicFreeAssetNetLimit=function(n){return B.Message.setProto3IntField(this,23,n)};TronWebProto.AssetIssueContract.prototype.getPublicFreeAssetNetUsage=function(){return B.Message.getFieldWithDefault(this,24,0)};TronWebProto.AssetIssueContract.prototype.setPublicFreeAssetNetUsage=function(n){return B.Message.setProto3IntField(this,24,n)};TronWebProto.AssetIssueContract.prototype.getPublicLatestFreeNetTime=function(){return B.Message.getFieldWithDefault(this,25,0)};TronWebProto.AssetIssueContract.prototype.setPublicLatestFreeNetTime=function(n){return B.Message.setProto3IntField(this,25,n)};B.Message.GENERATE_TO_OBJECT&&(TronWebProto.TransferAssetContract.prototype.toObject=function(n){return TronWebProto.TransferAssetContract.toObject(n,this)},TronWebProto.TransferAssetContract.toObject=function(n,r){var o,s={assetName:r.getAssetName_asB64(),ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),amount:B.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TransferAssetContract.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.TransferAssetContract;return TronWebProto.TransferAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.TransferAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAssetName(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;case 3:var s=r.readBytes();n.setToAddress(s);break;case 4:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.TransferAssetContract.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.TransferAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TransferAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAssetName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getAmount(),o!==0&&r.writeInt64(4,o)};TronWebProto.TransferAssetContract.prototype.getAssetName=function(){return B.Message.getFieldWithDefault(this,1,"")};TronWebProto.TransferAssetContract.prototype.getAssetName_asB64=function(){return B.Message.bytesAsB64(this.getAssetName())};TronWebProto.TransferAssetContract.prototype.getAssetName_asU8=function(){return B.Message.bytesAsU8(this.getAssetName())};TronWebProto.TransferAssetContract.prototype.setAssetName=function(n){return B.Message.setProto3BytesField(this,1,n)};TronWebProto.TransferAssetContract.prototype.getOwnerAddress=function(){return B.Message.getFieldWithDefault(this,2,"")};TronWebProto.TransferAssetContract.prototype.getOwnerAddress_asB64=function(){return B.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TransferAssetContract.prototype.getOwnerAddress_asU8=function(){return B.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TransferAssetContract.prototype.setOwnerAddress=function(n){return B.Message.setProto3BytesField(this,2,n)};TronWebProto.TransferAssetContract.prototype.getToAddress=function(){return B.Message.getFieldWithDefault(this,3,"")};TronWebProto.TransferAssetContract.prototype.getToAddress_asB64=function(){return B.Message.bytesAsB64(this.getToAddress())};TronWebProto.TransferAssetContract.prototype.getToAddress_asU8=function(){return B.Message.bytesAsU8(this.getToAddress())};TronWebProto.TransferAssetContract.prototype.setToAddress=function(n){return B.Message.setProto3BytesField(this,3,n)};TronWebProto.TransferAssetContract.prototype.getAmount=function(){return B.Message.getFieldWithDefault(this,4,0)};TronWebProto.TransferAssetContract.prototype.setAmount=function(n){return B.Message.setProto3IntField(this,4,n)};B.Message.GENERATE_TO_OBJECT&&(TronWebProto.UnfreezeAssetContract.prototype.toObject=function(n){return TronWebProto.UnfreezeAssetContract.toObject(n,this)},TronWebProto.UnfreezeAssetContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UnfreezeAssetContract.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.UnfreezeAssetContract;return TronWebProto.UnfreezeAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.UnfreezeAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.UnfreezeAssetContract.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.UnfreezeAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UnfreezeAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o)};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress=function(){return B.Message.getFieldWithDefault(this,1,"")};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress_asB64=function(){return B.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UnfreezeAssetContract.prototype.getOwnerAddress_asU8=function(){return B.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UnfreezeAssetContract.prototype.setOwnerAddress=function(n){return B.Message.setProto3BytesField(this,1,n)};B.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateAssetContract.prototype.toObject=function(n){return TronWebProto.UpdateAssetContract.toObject(n,this)},TronWebProto.UpdateAssetContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),description:r.getDescription_asB64(),url:r.getUrl_asB64(),newLimit:B.Message.getFieldWithDefault(r,4,0),newPublicLimit:B.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateAssetContract.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.UpdateAssetContract;return TronWebProto.UpdateAssetContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateAssetContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setDescription(s);break;case 3:var s=r.readBytes();n.setUrl(s);break;case 4:var s=r.readInt64();n.setNewLimit(s);break;case 5:var s=r.readInt64();n.setNewPublicLimit(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateAssetContract.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.UpdateAssetContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateAssetContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getDescription_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getNewLimit(),o!==0&&r.writeInt64(4,o),o=n.getNewPublicLimit(),o!==0&&r.writeInt64(5,o)};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress=function(){return B.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress_asB64=function(){return B.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateAssetContract.prototype.getOwnerAddress_asU8=function(){return B.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateAssetContract.prototype.setOwnerAddress=function(n){return B.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateAssetContract.prototype.getDescription=function(){return B.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateAssetContract.prototype.getDescription_asB64=function(){return B.Message.bytesAsB64(this.getDescription())};TronWebProto.UpdateAssetContract.prototype.getDescription_asU8=function(){return B.Message.bytesAsU8(this.getDescription())};TronWebProto.UpdateAssetContract.prototype.setDescription=function(n){return B.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateAssetContract.prototype.getUrl=function(){return B.Message.getFieldWithDefault(this,3,"")};TronWebProto.UpdateAssetContract.prototype.getUrl_asB64=function(){return B.Message.bytesAsB64(this.getUrl())};TronWebProto.UpdateAssetContract.prototype.getUrl_asU8=function(){return B.Message.bytesAsU8(this.getUrl())};TronWebProto.UpdateAssetContract.prototype.setUrl=function(n){return B.Message.setProto3BytesField(this,3,n)};TronWebProto.UpdateAssetContract.prototype.getNewLimit=function(){return B.Message.getFieldWithDefault(this,4,0)};TronWebProto.UpdateAssetContract.prototype.setNewLimit=function(n){return B.Message.setProto3IntField(this,4,n)};TronWebProto.UpdateAssetContract.prototype.getNewPublicLimit=function(){return B.Message.getFieldWithDefault(this,5,0)};TronWebProto.UpdateAssetContract.prototype.setNewPublicLimit=function(n){return B.Message.setProto3IntField(this,5,n)};B.Message.GENERATE_TO_OBJECT&&(TronWebProto.ParticipateAssetIssueContract.prototype.toObject=function(n){return TronWebProto.ParticipateAssetIssueContract.toObject(n,this)},TronWebProto.ParticipateAssetIssueContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),toAddress:r.getToAddress_asB64(),assetName:r.getAssetName_asB64(),amount:B.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ParticipateAssetIssueContract.deserializeBinary=function(n){var r=new B.BinaryReader(n),o=new TronWebProto.ParticipateAssetIssueContract;return TronWebProto.ParticipateAssetIssueContract.deserializeBinaryFromReader(o,r)};TronWebProto.ParticipateAssetIssueContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setToAddress(s);break;case 3:var s=r.readBytes();n.setAssetName(s);break;case 4:var s=r.readInt64();n.setAmount(s);break;default:r.skipField();break}}return n};TronWebProto.ParticipateAssetIssueContract.prototype.serializeBinary=function(){var n=new B.BinaryWriter;return TronWebProto.ParticipateAssetIssueContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ParticipateAssetIssueContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getToAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAssetName_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getAmount(),o!==0&&r.writeInt64(4,o)};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress=function(){return B.Message.getFieldWithDefault(this,1,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress_asB64=function(){return B.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.getOwnerAddress_asU8=function(){return B.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.setOwnerAddress=function(n){return B.Message.setProto3BytesField(this,1,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress=function(){return B.Message.getFieldWithDefault(this,2,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress_asB64=function(){return B.Message.bytesAsB64(this.getToAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.getToAddress_asU8=function(){return B.Message.bytesAsU8(this.getToAddress())};TronWebProto.ParticipateAssetIssueContract.prototype.setToAddress=function(n){return B.Message.setProto3BytesField(this,2,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName=function(){return B.Message.getFieldWithDefault(this,3,"")};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName_asB64=function(){return B.Message.bytesAsB64(this.getAssetName())};TronWebProto.ParticipateAssetIssueContract.prototype.getAssetName_asU8=function(){return B.Message.bytesAsU8(this.getAssetName())};TronWebProto.ParticipateAssetIssueContract.prototype.setAssetName=function(n){return B.Message.setProto3BytesField(this,3,n)};TronWebProto.ParticipateAssetIssueContract.prototype.getAmount=function(){return B.Message.getFieldWithDefault(this,4,0)};TronWebProto.ParticipateAssetIssueContract.prototype.setAmount=function(n){return B.Message.setProto3IntField(this,4,n)};ut.object.extend(Yp,TronWebProto)});var eA=Ot(Qp=>{var y=mr(),fe=y,Nt=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Nt<"u"&&Nt||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),ph=oa();fe.object.extend(proto,ph);fe.exportSymbol("TronWebProto.ClearABIContract",null,Nt);fe.exportSymbol("TronWebProto.ContractState",null,Nt);fe.exportSymbol("TronWebProto.CreateSmartContract",null,Nt);fe.exportSymbol("TronWebProto.SmartContract",null,Nt);fe.exportSymbol("TronWebProto.SmartContract.ABI",null,Nt);fe.exportSymbol("TronWebProto.SmartContract.ABI.Entry",null,Nt);fe.exportSymbol("TronWebProto.SmartContract.ABI.Entry.EntryType",null,Nt);fe.exportSymbol("TronWebProto.SmartContract.ABI.Entry.Param",null,Nt);fe.exportSymbol("TronWebProto.SmartContract.ABI.Entry.StateMutabilityType",null,Nt);fe.exportSymbol("TronWebProto.SmartContractDataWrapper",null,Nt);fe.exportSymbol("TronWebProto.TriggerSmartContract",null,Nt);fe.exportSymbol("TronWebProto.UpdateEnergyLimitContract",null,Nt);fe.exportSymbol("TronWebProto.UpdateSettingContract",null,Nt);TronWebProto.SmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.SmartContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.displayName="TronWebProto.SmartContract");TronWebProto.SmartContract.ABI=function(n){y.Message.initialize(this,n,0,-1,TronWebProto.SmartContract.ABI.repeatedFields_,null)};fe.inherits(TronWebProto.SmartContract.ABI,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.displayName="TronWebProto.SmartContract.ABI");TronWebProto.SmartContract.ABI.Entry=function(n){y.Message.initialize(this,n,0,-1,TronWebProto.SmartContract.ABI.Entry.repeatedFields_,null)};fe.inherits(TronWebProto.SmartContract.ABI.Entry,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.Entry.displayName="TronWebProto.SmartContract.ABI.Entry");TronWebProto.SmartContract.ABI.Entry.Param=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.SmartContract.ABI.Entry.Param,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.SmartContract.ABI.Entry.Param.displayName="TronWebProto.SmartContract.ABI.Entry.Param");TronWebProto.ContractState=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.ContractState,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.ContractState.displayName="TronWebProto.ContractState");TronWebProto.CreateSmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.CreateSmartContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.CreateSmartContract.displayName="TronWebProto.CreateSmartContract");TronWebProto.TriggerSmartContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.TriggerSmartContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.TriggerSmartContract.displayName="TronWebProto.TriggerSmartContract");TronWebProto.ClearABIContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.ClearABIContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.ClearABIContract.displayName="TronWebProto.ClearABIContract");TronWebProto.UpdateSettingContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.UpdateSettingContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.UpdateSettingContract.displayName="TronWebProto.UpdateSettingContract");TronWebProto.UpdateEnergyLimitContract=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.UpdateEnergyLimitContract,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.UpdateEnergyLimitContract.displayName="TronWebProto.UpdateEnergyLimitContract");TronWebProto.SmartContractDataWrapper=function(n){y.Message.initialize(this,n,0,-1,null,null)};fe.inherits(TronWebProto.SmartContractDataWrapper,y.Message);fe.DEBUG&&!COMPILED&&(TronWebProto.SmartContractDataWrapper.displayName="TronWebProto.SmartContractDataWrapper");y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.prototype.toObject=function(n){return TronWebProto.SmartContract.toObject(n,this)},TronWebProto.SmartContract.toObject=function(n,r){var o,s={originAddress:r.getOriginAddress_asB64(),contractAddress:r.getContractAddress_asB64(),abi:(o=r.getAbi())&&TronWebProto.SmartContract.ABI.toObject(n,o),bytecode:r.getBytecode_asB64(),callValue:y.Message.getFieldWithDefault(r,5,0),consumeUserResourcePercent:y.Message.getFieldWithDefault(r,6,0),name:y.Message.getFieldWithDefault(r,7,""),originEnergyLimit:y.Message.getFieldWithDefault(r,8,0),codeHash:r.getCodeHash_asB64(),trxHash:r.getTrxHash_asB64(),version:y.Message.getFieldWithDefault(r,11,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract;return TronWebProto.SmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOriginAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=new TronWebProto.SmartContract.ABI;r.readMessage(s,TronWebProto.SmartContract.ABI.deserializeBinaryFromReader),n.setAbi(s);break;case 4:var s=r.readBytes();n.setBytecode(s);break;case 5:var s=r.readInt64();n.setCallValue(s);break;case 6:var s=r.readInt64();n.setConsumeUserResourcePercent(s);break;case 7:var s=r.readString();n.setName(s);break;case 8:var s=r.readInt64();n.setOriginEnergyLimit(s);break;case 9:var s=r.readBytes();n.setCodeHash(s);break;case 10:var s=r.readBytes();n.setTrxHash(s);break;case 11:var s=r.readInt32();n.setVersion(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOriginAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getAbi(),o!=null&&r.writeMessage(3,o,TronWebProto.SmartContract.ABI.serializeBinaryToWriter),o=n.getBytecode_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getCallValue(),o!==0&&r.writeInt64(5,o),o=n.getConsumeUserResourcePercent(),o!==0&&r.writeInt64(6,o),o=n.getName(),o.length>0&&r.writeString(7,o),o=n.getOriginEnergyLimit(),o!==0&&r.writeInt64(8,o),o=n.getCodeHash_asU8(),o.length>0&&r.writeBytes(9,o),o=n.getTrxHash_asU8(),o.length>0&&r.writeBytes(10,o),o=n.getVersion(),o!==0&&r.writeInt32(11,o)};TronWebProto.SmartContract.ABI.repeatedFields_=[1];y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.toObject(n,this)},TronWebProto.SmartContract.ABI.toObject=function(n,r){var o,s={entrysList:y.Message.toObjectList(r.getEntrysList(),TronWebProto.SmartContract.ABI.Entry.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI;return TronWebProto.SmartContract.ABI.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.SmartContract.ABI.Entry;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader),n.addEntrys(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEntrysList(),o.length>0&&r.writeRepeatedMessage(1,o,TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter)};TronWebProto.SmartContract.ABI.Entry.repeatedFields_=[4,5];y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.Entry.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.Entry.toObject(n,this)},TronWebProto.SmartContract.ABI.Entry.toObject=function(n,r){var o,s={anonymous:y.Message.getBooleanFieldWithDefault(r,1,!1),constant:y.Message.getBooleanFieldWithDefault(r,2,!1),name:y.Message.getFieldWithDefault(r,3,""),inputsList:y.Message.toObjectList(r.getInputsList(),TronWebProto.SmartContract.ABI.Entry.Param.toObject,n),outputsList:y.Message.toObjectList(r.getOutputsList(),TronWebProto.SmartContract.ABI.Entry.Param.toObject,n),type:y.Message.getFieldWithDefault(r,6,0),payable:y.Message.getBooleanFieldWithDefault(r,7,!1),statemutability:y.Message.getFieldWithDefault(r,8,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.Entry.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI.Entry;return TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.Entry.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBool();n.setAnonymous(s);break;case 2:var s=r.readBool();n.setConstant(s);break;case 3:var s=r.readString();n.setName(s);break;case 4:var s=new TronWebProto.SmartContract.ABI.Entry.Param;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader),n.addInputs(s);break;case 5:var s=new TronWebProto.SmartContract.ABI.Entry.Param;r.readMessage(s,TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader),n.addOutputs(s);break;case 6:var s=r.readEnum();n.setType(s);break;case 7:var s=r.readBool();n.setPayable(s);break;case 8:var s=r.readEnum();n.setStatemutability(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.Entry.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.Entry.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAnonymous(),o&&r.writeBool(1,o),o=n.getConstant(),o&&r.writeBool(2,o),o=n.getName(),o.length>0&&r.writeString(3,o),o=n.getInputsList(),o.length>0&&r.writeRepeatedMessage(4,o,TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter),o=n.getOutputsList(),o.length>0&&r.writeRepeatedMessage(5,o,TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter),o=n.getType(),o!==0&&r.writeEnum(6,o),o=n.getPayable(),o&&r.writeBool(7,o),o=n.getStatemutability(),o!==0&&r.writeEnum(8,o)};TronWebProto.SmartContract.ABI.Entry.EntryType={UNKNOWNENTRYTYPE:0,CONSTRUCTOR:1,FUNCTION:2,EVENT:3,FALLBACK:4,RECEIVE:5,ERROR:6};TronWebProto.SmartContract.ABI.Entry.StateMutabilityType={UNKNOWNMUTABILITYTYPE:0,PURE:1,VIEW:2,NONPAYABLE:3,PAYABLE:4};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContract.ABI.Entry.Param.prototype.toObject=function(n){return TronWebProto.SmartContract.ABI.Entry.Param.toObject(n,this)},TronWebProto.SmartContract.ABI.Entry.Param.toObject=function(n,r){var o,s={indexed:y.Message.getBooleanFieldWithDefault(r,1,!1),name:y.Message.getFieldWithDefault(r,2,""),type:y.Message.getFieldWithDefault(r,3,"")};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContract.ABI.Entry.Param;return TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContract.ABI.Entry.Param.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBool();n.setIndexed(s);break;case 2:var s=r.readString();n.setName(s);break;case 3:var s=r.readString();n.setType(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContract.ABI.Entry.Param.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContract.ABI.Entry.Param.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getIndexed(),o&&r.writeBool(1,o),o=n.getName(),o.length>0&&r.writeString(2,o),o=n.getType(),o.length>0&&r.writeString(3,o)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getIndexed=function(){return y.Message.getBooleanFieldWithDefault(this,1,!1)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setIndexed=function(n){return y.Message.setProto3BooleanField(this,1,n)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getName=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setName=function(n){return y.Message.setProto3StringField(this,2,n)};TronWebProto.SmartContract.ABI.Entry.Param.prototype.getType=function(){return y.Message.getFieldWithDefault(this,3,"")};TronWebProto.SmartContract.ABI.Entry.Param.prototype.setType=function(n){return y.Message.setProto3StringField(this,3,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getAnonymous=function(){return y.Message.getBooleanFieldWithDefault(this,1,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setAnonymous=function(n){return y.Message.setProto3BooleanField(this,1,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getConstant=function(){return y.Message.getBooleanFieldWithDefault(this,2,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setConstant=function(n){return y.Message.setProto3BooleanField(this,2,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getName=function(){return y.Message.getFieldWithDefault(this,3,"")};TronWebProto.SmartContract.ABI.Entry.prototype.setName=function(n){return y.Message.setProto3StringField(this,3,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getInputsList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry.Param,4)};TronWebProto.SmartContract.ABI.Entry.prototype.setInputsList=function(n){return y.Message.setRepeatedWrapperField(this,4,n)};TronWebProto.SmartContract.ABI.Entry.prototype.addInputs=function(n,r){return y.Message.addToRepeatedWrapperField(this,4,n,TronWebProto.SmartContract.ABI.Entry.Param,r)};TronWebProto.SmartContract.ABI.Entry.prototype.clearInputsList=function(){return this.setInputsList([])};TronWebProto.SmartContract.ABI.Entry.prototype.getOutputsList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry.Param,5)};TronWebProto.SmartContract.ABI.Entry.prototype.setOutputsList=function(n){return y.Message.setRepeatedWrapperField(this,5,n)};TronWebProto.SmartContract.ABI.Entry.prototype.addOutputs=function(n,r){return y.Message.addToRepeatedWrapperField(this,5,n,TronWebProto.SmartContract.ABI.Entry.Param,r)};TronWebProto.SmartContract.ABI.Entry.prototype.clearOutputsList=function(){return this.setOutputsList([])};TronWebProto.SmartContract.ABI.Entry.prototype.getType=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.SmartContract.ABI.Entry.prototype.setType=function(n){return y.Message.setProto3EnumField(this,6,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getPayable=function(){return y.Message.getBooleanFieldWithDefault(this,7,!1)};TronWebProto.SmartContract.ABI.Entry.prototype.setPayable=function(n){return y.Message.setProto3BooleanField(this,7,n)};TronWebProto.SmartContract.ABI.Entry.prototype.getStatemutability=function(){return y.Message.getFieldWithDefault(this,8,0)};TronWebProto.SmartContract.ABI.Entry.prototype.setStatemutability=function(n){return y.Message.setProto3EnumField(this,8,n)};TronWebProto.SmartContract.ABI.prototype.getEntrysList=function(){return y.Message.getRepeatedWrapperField(this,TronWebProto.SmartContract.ABI.Entry,1)};TronWebProto.SmartContract.ABI.prototype.setEntrysList=function(n){return y.Message.setRepeatedWrapperField(this,1,n)};TronWebProto.SmartContract.ABI.prototype.addEntrys=function(n,r){return y.Message.addToRepeatedWrapperField(this,1,n,TronWebProto.SmartContract.ABI.Entry,r)};TronWebProto.SmartContract.ABI.prototype.clearEntrysList=function(){return this.setEntrysList([])};TronWebProto.SmartContract.prototype.getOriginAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.SmartContract.prototype.getOriginAddress_asB64=function(){return y.Message.bytesAsB64(this.getOriginAddress())};TronWebProto.SmartContract.prototype.getOriginAddress_asU8=function(){return y.Message.bytesAsU8(this.getOriginAddress())};TronWebProto.SmartContract.prototype.setOriginAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.SmartContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.SmartContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.SmartContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.SmartContract.prototype.getAbi=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract.ABI,3)};TronWebProto.SmartContract.prototype.setAbi=function(n){return y.Message.setWrapperField(this,3,n)};TronWebProto.SmartContract.prototype.clearAbi=function(){return this.setAbi(void 0)};TronWebProto.SmartContract.prototype.hasAbi=function(){return y.Message.getField(this,3)!=null};TronWebProto.SmartContract.prototype.getBytecode=function(){return y.Message.getFieldWithDefault(this,4,"")};TronWebProto.SmartContract.prototype.getBytecode_asB64=function(){return y.Message.bytesAsB64(this.getBytecode())};TronWebProto.SmartContract.prototype.getBytecode_asU8=function(){return y.Message.bytesAsU8(this.getBytecode())};TronWebProto.SmartContract.prototype.setBytecode=function(n){return y.Message.setProto3BytesField(this,4,n)};TronWebProto.SmartContract.prototype.getCallValue=function(){return y.Message.getFieldWithDefault(this,5,0)};TronWebProto.SmartContract.prototype.setCallValue=function(n){return y.Message.setProto3IntField(this,5,n)};TronWebProto.SmartContract.prototype.getConsumeUserResourcePercent=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.SmartContract.prototype.setConsumeUserResourcePercent=function(n){return y.Message.setProto3IntField(this,6,n)};TronWebProto.SmartContract.prototype.getName=function(){return y.Message.getFieldWithDefault(this,7,"")};TronWebProto.SmartContract.prototype.setName=function(n){return y.Message.setProto3StringField(this,7,n)};TronWebProto.SmartContract.prototype.getOriginEnergyLimit=function(){return y.Message.getFieldWithDefault(this,8,0)};TronWebProto.SmartContract.prototype.setOriginEnergyLimit=function(n){return y.Message.setProto3IntField(this,8,n)};TronWebProto.SmartContract.prototype.getCodeHash=function(){return y.Message.getFieldWithDefault(this,9,"")};TronWebProto.SmartContract.prototype.getCodeHash_asB64=function(){return y.Message.bytesAsB64(this.getCodeHash())};TronWebProto.SmartContract.prototype.getCodeHash_asU8=function(){return y.Message.bytesAsU8(this.getCodeHash())};TronWebProto.SmartContract.prototype.setCodeHash=function(n){return y.Message.setProto3BytesField(this,9,n)};TronWebProto.SmartContract.prototype.getTrxHash=function(){return y.Message.getFieldWithDefault(this,10,"")};TronWebProto.SmartContract.prototype.getTrxHash_asB64=function(){return y.Message.bytesAsB64(this.getTrxHash())};TronWebProto.SmartContract.prototype.getTrxHash_asU8=function(){return y.Message.bytesAsU8(this.getTrxHash())};TronWebProto.SmartContract.prototype.setTrxHash=function(n){return y.Message.setProto3BytesField(this,10,n)};TronWebProto.SmartContract.prototype.getVersion=function(){return y.Message.getFieldWithDefault(this,11,0)};TronWebProto.SmartContract.prototype.setVersion=function(n){return y.Message.setProto3IntField(this,11,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.ContractState.prototype.toObject=function(n){return TronWebProto.ContractState.toObject(n,this)},TronWebProto.ContractState.toObject=function(n,r){var o,s={energyUsage:y.Message.getFieldWithDefault(r,1,0),energyFactor:y.Message.getFieldWithDefault(r,2,0),updateCycle:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ContractState.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.ContractState;return TronWebProto.ContractState.deserializeBinaryFromReader(o,r)};TronWebProto.ContractState.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readInt64();n.setEnergyUsage(s);break;case 2:var s=r.readInt64();n.setEnergyFactor(s);break;case 3:var s=r.readInt64();n.setUpdateCycle(s);break;default:r.skipField();break}}return n};TronWebProto.ContractState.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.ContractState.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ContractState.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getEnergyUsage(),o!==0&&r.writeInt64(1,o),o=n.getEnergyFactor(),o!==0&&r.writeInt64(2,o),o=n.getUpdateCycle(),o!==0&&r.writeInt64(3,o)};TronWebProto.ContractState.prototype.getEnergyUsage=function(){return y.Message.getFieldWithDefault(this,1,0)};TronWebProto.ContractState.prototype.setEnergyUsage=function(n){return y.Message.setProto3IntField(this,1,n)};TronWebProto.ContractState.prototype.getEnergyFactor=function(){return y.Message.getFieldWithDefault(this,2,0)};TronWebProto.ContractState.prototype.setEnergyFactor=function(n){return y.Message.setProto3IntField(this,2,n)};TronWebProto.ContractState.prototype.getUpdateCycle=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.ContractState.prototype.setUpdateCycle=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.CreateSmartContract.prototype.toObject=function(n){return TronWebProto.CreateSmartContract.toObject(n,this)},TronWebProto.CreateSmartContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),newContract:(o=r.getNewContract())&&TronWebProto.SmartContract.toObject(n,o),callTokenValue:y.Message.getFieldWithDefault(r,3,0),tokenId:y.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.CreateSmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.CreateSmartContract;return TronWebProto.CreateSmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.CreateSmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new TronWebProto.SmartContract;r.readMessage(s,TronWebProto.SmartContract.deserializeBinaryFromReader),n.setNewContract(s);break;case 3:var s=r.readInt64();n.setCallTokenValue(s);break;case 4:var s=r.readInt64();n.setTokenId(s);break;default:r.skipField();break}}return n};TronWebProto.CreateSmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.CreateSmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.CreateSmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getNewContract(),o!=null&&r.writeMessage(2,o,TronWebProto.SmartContract.serializeBinaryToWriter),o=n.getCallTokenValue(),o!==0&&r.writeInt64(3,o),o=n.getTokenId(),o!==0&&r.writeInt64(4,o)};TronWebProto.CreateSmartContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.CreateSmartContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.CreateSmartContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.CreateSmartContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.CreateSmartContract.prototype.getNewContract=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract,2)};TronWebProto.CreateSmartContract.prototype.setNewContract=function(n){return y.Message.setWrapperField(this,2,n)};TronWebProto.CreateSmartContract.prototype.clearNewContract=function(){return this.setNewContract(void 0)};TronWebProto.CreateSmartContract.prototype.hasNewContract=function(){return y.Message.getField(this,2)!=null};TronWebProto.CreateSmartContract.prototype.getCallTokenValue=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.CreateSmartContract.prototype.setCallTokenValue=function(n){return y.Message.setProto3IntField(this,3,n)};TronWebProto.CreateSmartContract.prototype.getTokenId=function(){return y.Message.getFieldWithDefault(this,4,0)};TronWebProto.CreateSmartContract.prototype.setTokenId=function(n){return y.Message.setProto3IntField(this,4,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.TriggerSmartContract.prototype.toObject=function(n){return TronWebProto.TriggerSmartContract.toObject(n,this)},TronWebProto.TriggerSmartContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),callValue:y.Message.getFieldWithDefault(r,3,0),data:r.getData_asB64(),callTokenValue:y.Message.getFieldWithDefault(r,5,0),tokenId:y.Message.getFieldWithDefault(r,6,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.TriggerSmartContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.TriggerSmartContract;return TronWebProto.TriggerSmartContract.deserializeBinaryFromReader(o,r)};TronWebProto.TriggerSmartContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setCallValue(s);break;case 4:var s=r.readBytes();n.setData(s);break;case 5:var s=r.readInt64();n.setCallTokenValue(s);break;case 6:var s=r.readInt64();n.setTokenId(s);break;default:r.skipField();break}}return n};TronWebProto.TriggerSmartContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.TriggerSmartContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.TriggerSmartContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getCallValue(),o!==0&&r.writeInt64(3,o),o=n.getData_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getCallTokenValue(),o!==0&&r.writeInt64(5,o),o=n.getTokenId(),o!==0&&r.writeInt64(6,o)};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.TriggerSmartContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.TriggerSmartContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.TriggerSmartContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.TriggerSmartContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.TriggerSmartContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.TriggerSmartContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.TriggerSmartContract.prototype.getCallValue=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.TriggerSmartContract.prototype.setCallValue=function(n){return y.Message.setProto3IntField(this,3,n)};TronWebProto.TriggerSmartContract.prototype.getData=function(){return y.Message.getFieldWithDefault(this,4,"")};TronWebProto.TriggerSmartContract.prototype.getData_asB64=function(){return y.Message.bytesAsB64(this.getData())};TronWebProto.TriggerSmartContract.prototype.getData_asU8=function(){return y.Message.bytesAsU8(this.getData())};TronWebProto.TriggerSmartContract.prototype.setData=function(n){return y.Message.setProto3BytesField(this,4,n)};TronWebProto.TriggerSmartContract.prototype.getCallTokenValue=function(){return y.Message.getFieldWithDefault(this,5,0)};TronWebProto.TriggerSmartContract.prototype.setCallTokenValue=function(n){return y.Message.setProto3IntField(this,5,n)};TronWebProto.TriggerSmartContract.prototype.getTokenId=function(){return y.Message.getFieldWithDefault(this,6,0)};TronWebProto.TriggerSmartContract.prototype.setTokenId=function(n){return y.Message.setProto3IntField(this,6,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.ClearABIContract.prototype.toObject=function(n){return TronWebProto.ClearABIContract.toObject(n,this)},TronWebProto.ClearABIContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ClearABIContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.ClearABIContract;return TronWebProto.ClearABIContract.deserializeBinaryFromReader(o,r)};TronWebProto.ClearABIContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;default:r.skipField();break}}return n};TronWebProto.ClearABIContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.ClearABIContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ClearABIContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.ClearABIContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.ClearABIContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ClearABIContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ClearABIContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.ClearABIContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.ClearABIContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.ClearABIContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.ClearABIContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateSettingContract.prototype.toObject=function(n){return TronWebProto.UpdateSettingContract.toObject(n,this)},TronWebProto.UpdateSettingContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),consumeUserResourcePercent:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateSettingContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.UpdateSettingContract;return TronWebProto.UpdateSettingContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateSettingContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setConsumeUserResourcePercent(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateSettingContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.UpdateSettingContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateSettingContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getConsumeUserResourcePercent(),o!==0&&r.writeInt64(3,o)};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateSettingContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateSettingContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateSettingContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateSettingContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.UpdateSettingContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.UpdateSettingContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateSettingContract.prototype.getConsumeUserResourcePercent=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.UpdateSettingContract.prototype.setConsumeUserResourcePercent=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateEnergyLimitContract.prototype.toObject=function(n){return TronWebProto.UpdateEnergyLimitContract.toObject(n,this)},TronWebProto.UpdateEnergyLimitContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),contractAddress:r.getContractAddress_asB64(),originEnergyLimit:y.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateEnergyLimitContract.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.UpdateEnergyLimitContract;return TronWebProto.UpdateEnergyLimitContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateEnergyLimitContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setContractAddress(s);break;case 3:var s=r.readInt64();n.setOriginEnergyLimit(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateEnergyLimitContract.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.UpdateEnergyLimitContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateEnergyLimitContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getContractAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getOriginEnergyLimit(),o!==0&&r.writeInt64(3,o)};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress=function(){return y.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress_asB64=function(){return y.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.getOwnerAddress_asU8=function(){return y.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.setOwnerAddress=function(n){return y.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress_asB64=function(){return y.Message.bytesAsB64(this.getContractAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.getContractAddress_asU8=function(){return y.Message.bytesAsU8(this.getContractAddress())};TronWebProto.UpdateEnergyLimitContract.prototype.setContractAddress=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.UpdateEnergyLimitContract.prototype.getOriginEnergyLimit=function(){return y.Message.getFieldWithDefault(this,3,0)};TronWebProto.UpdateEnergyLimitContract.prototype.setOriginEnergyLimit=function(n){return y.Message.setProto3IntField(this,3,n)};y.Message.GENERATE_TO_OBJECT&&(TronWebProto.SmartContractDataWrapper.prototype.toObject=function(n){return TronWebProto.SmartContractDataWrapper.toObject(n,this)},TronWebProto.SmartContractDataWrapper.toObject=function(n,r){var o,s={smartContract:(o=r.getSmartContract())&&TronWebProto.SmartContract.toObject(n,o),runtimecode:r.getRuntimecode_asB64(),contractState:(o=r.getContractState())&&TronWebProto.ContractState.toObject(n,o)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SmartContractDataWrapper.deserializeBinary=function(n){var r=new y.BinaryReader(n),o=new TronWebProto.SmartContractDataWrapper;return TronWebProto.SmartContractDataWrapper.deserializeBinaryFromReader(o,r)};TronWebProto.SmartContractDataWrapper.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=new TronWebProto.SmartContract;r.readMessage(s,TronWebProto.SmartContract.deserializeBinaryFromReader),n.setSmartContract(s);break;case 2:var s=r.readBytes();n.setRuntimecode(s);break;case 3:var s=new TronWebProto.ContractState;r.readMessage(s,TronWebProto.ContractState.deserializeBinaryFromReader),n.setContractState(s);break;default:r.skipField();break}}return n};TronWebProto.SmartContractDataWrapper.prototype.serializeBinary=function(){var n=new y.BinaryWriter;return TronWebProto.SmartContractDataWrapper.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SmartContractDataWrapper.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getSmartContract(),o!=null&&r.writeMessage(1,o,TronWebProto.SmartContract.serializeBinaryToWriter),o=n.getRuntimecode_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getContractState(),o!=null&&r.writeMessage(3,o,TronWebProto.ContractState.serializeBinaryToWriter)};TronWebProto.SmartContractDataWrapper.prototype.getSmartContract=function(){return y.Message.getWrapperField(this,TronWebProto.SmartContract,1)};TronWebProto.SmartContractDataWrapper.prototype.setSmartContract=function(n){return y.Message.setWrapperField(this,1,n)};TronWebProto.SmartContractDataWrapper.prototype.clearSmartContract=function(){return this.setSmartContract(void 0)};TronWebProto.SmartContractDataWrapper.prototype.hasSmartContract=function(){return y.Message.getField(this,1)!=null};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode=function(){return y.Message.getFieldWithDefault(this,2,"")};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode_asB64=function(){return y.Message.bytesAsB64(this.getRuntimecode())};TronWebProto.SmartContractDataWrapper.prototype.getRuntimecode_asU8=function(){return y.Message.bytesAsU8(this.getRuntimecode())};TronWebProto.SmartContractDataWrapper.prototype.setRuntimecode=function(n){return y.Message.setProto3BytesField(this,2,n)};TronWebProto.SmartContractDataWrapper.prototype.getContractState=function(){return y.Message.getWrapperField(this,TronWebProto.ContractState,3)};TronWebProto.SmartContractDataWrapper.prototype.setContractState=function(n){return y.Message.setWrapperField(this,3,n)};TronWebProto.SmartContractDataWrapper.prototype.clearContractState=function(){return this.setContractState(void 0)};TronWebProto.SmartContractDataWrapper.prototype.hasContractState=function(){return y.Message.getField(this,3)!=null};fe.object.extend(Qp,TronWebProto)});var rA=Ot(tA=>{var X=mr(),rr=X,Go=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Go<"u"&&Go||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();rr.exportSymbol("TronWebProto.VoteWitnessContract",null,Go);rr.exportSymbol("TronWebProto.VoteWitnessContract.Vote",null,Go);rr.exportSymbol("TronWebProto.WitnessCreateContract",null,Go);rr.exportSymbol("TronWebProto.WitnessUpdateContract",null,Go);TronWebProto.WitnessCreateContract=function(n){X.Message.initialize(this,n,0,-1,null,null)};rr.inherits(TronWebProto.WitnessCreateContract,X.Message);rr.DEBUG&&!COMPILED&&(TronWebProto.WitnessCreateContract.displayName="TronWebProto.WitnessCreateContract");TronWebProto.WitnessUpdateContract=function(n){X.Message.initialize(this,n,0,-1,null,null)};rr.inherits(TronWebProto.WitnessUpdateContract,X.Message);rr.DEBUG&&!COMPILED&&(TronWebProto.WitnessUpdateContract.displayName="TronWebProto.WitnessUpdateContract");TronWebProto.VoteWitnessContract=function(n){X.Message.initialize(this,n,0,-1,TronWebProto.VoteWitnessContract.repeatedFields_,null)};rr.inherits(TronWebProto.VoteWitnessContract,X.Message);rr.DEBUG&&!COMPILED&&(TronWebProto.VoteWitnessContract.displayName="TronWebProto.VoteWitnessContract");TronWebProto.VoteWitnessContract.Vote=function(n){X.Message.initialize(this,n,0,-1,null,null)};rr.inherits(TronWebProto.VoteWitnessContract.Vote,X.Message);rr.DEBUG&&!COMPILED&&(TronWebProto.VoteWitnessContract.Vote.displayName="TronWebProto.VoteWitnessContract.Vote");X.Message.GENERATE_TO_OBJECT&&(TronWebProto.WitnessCreateContract.prototype.toObject=function(n){return TronWebProto.WitnessCreateContract.toObject(n,this)},TronWebProto.WitnessCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),url:r.getUrl_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WitnessCreateContract.deserializeBinary=function(n){var r=new X.BinaryReader(n),o=new TronWebProto.WitnessCreateContract;return TronWebProto.WitnessCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.WitnessCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setUrl(s);break;default:r.skipField();break}}return n};TronWebProto.WitnessCreateContract.prototype.serializeBinary=function(){var n=new X.BinaryWriter;return TronWebProto.WitnessCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WitnessCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUrl_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress=function(){return X.Message.getFieldWithDefault(this,1,"")};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress_asB64=function(){return X.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WitnessCreateContract.prototype.getOwnerAddress_asU8=function(){return X.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WitnessCreateContract.prototype.setOwnerAddress=function(n){return X.Message.setProto3BytesField(this,1,n)};TronWebProto.WitnessCreateContract.prototype.getUrl=function(){return X.Message.getFieldWithDefault(this,2,"")};TronWebProto.WitnessCreateContract.prototype.getUrl_asB64=function(){return X.Message.bytesAsB64(this.getUrl())};TronWebProto.WitnessCreateContract.prototype.getUrl_asU8=function(){return X.Message.bytesAsU8(this.getUrl())};TronWebProto.WitnessCreateContract.prototype.setUrl=function(n){return X.Message.setProto3BytesField(this,2,n)};X.Message.GENERATE_TO_OBJECT&&(TronWebProto.WitnessUpdateContract.prototype.toObject=function(n){return TronWebProto.WitnessUpdateContract.toObject(n,this)},TronWebProto.WitnessUpdateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),updateUrl:r.getUpdateUrl_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.WitnessUpdateContract.deserializeBinary=function(n){var r=new X.BinaryReader(n),o=new TronWebProto.WitnessUpdateContract;return TronWebProto.WitnessUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.WitnessUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 12:var s=r.readBytes();n.setUpdateUrl(s);break;default:r.skipField();break}}return n};TronWebProto.WitnessUpdateContract.prototype.serializeBinary=function(){var n=new X.BinaryWriter;return TronWebProto.WitnessUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.WitnessUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getUpdateUrl_asU8(),o.length>0&&r.writeBytes(12,o)};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress=function(){return X.Message.getFieldWithDefault(this,1,"")};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress_asB64=function(){return X.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.WitnessUpdateContract.prototype.getOwnerAddress_asU8=function(){return X.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.WitnessUpdateContract.prototype.setOwnerAddress=function(n){return X.Message.setProto3BytesField(this,1,n)};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl=function(){return X.Message.getFieldWithDefault(this,12,"")};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl_asB64=function(){return X.Message.bytesAsB64(this.getUpdateUrl())};TronWebProto.WitnessUpdateContract.prototype.getUpdateUrl_asU8=function(){return X.Message.bytesAsU8(this.getUpdateUrl())};TronWebProto.WitnessUpdateContract.prototype.setUpdateUrl=function(n){return X.Message.setProto3BytesField(this,12,n)};TronWebProto.VoteWitnessContract.repeatedFields_=[2];X.Message.GENERATE_TO_OBJECT&&(TronWebProto.VoteWitnessContract.prototype.toObject=function(n){return TronWebProto.VoteWitnessContract.toObject(n,this)},TronWebProto.VoteWitnessContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),votesList:X.Message.toObjectList(r.getVotesList(),TronWebProto.VoteWitnessContract.Vote.toObject,n),support:X.Message.getBooleanFieldWithDefault(r,3,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.VoteWitnessContract.deserializeBinary=function(n){var r=new X.BinaryReader(n),o=new TronWebProto.VoteWitnessContract;return TronWebProto.VoteWitnessContract.deserializeBinaryFromReader(o,r)};TronWebProto.VoteWitnessContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new TronWebProto.VoteWitnessContract.Vote;r.readMessage(s,TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader),n.addVotes(s);break;case 3:var s=r.readBool();n.setSupport(s);break;default:r.skipField();break}}return n};TronWebProto.VoteWitnessContract.prototype.serializeBinary=function(){var n=new X.BinaryWriter;return TronWebProto.VoteWitnessContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.VoteWitnessContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVotesList(),o.length>0&&r.writeRepeatedMessage(2,o,TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter),o=n.getSupport(),o&&r.writeBool(3,o)};X.Message.GENERATE_TO_OBJECT&&(TronWebProto.VoteWitnessContract.Vote.prototype.toObject=function(n){return TronWebProto.VoteWitnessContract.Vote.toObject(n,this)},TronWebProto.VoteWitnessContract.Vote.toObject=function(n,r){var o,s={voteAddress:r.getVoteAddress_asB64(),voteCount:X.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.VoteWitnessContract.Vote.deserializeBinary=function(n){var r=new X.BinaryReader(n),o=new TronWebProto.VoteWitnessContract.Vote;return TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader(o,r)};TronWebProto.VoteWitnessContract.Vote.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setVoteAddress(s);break;case 2:var s=r.readInt64();n.setVoteCount(s);break;default:r.skipField();break}}return n};TronWebProto.VoteWitnessContract.Vote.prototype.serializeBinary=function(){var n=new X.BinaryWriter;return TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.VoteWitnessContract.Vote.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getVoteAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getVoteCount(),o!==0&&r.writeInt64(2,o)};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress=function(){return X.Message.getFieldWithDefault(this,1,"")};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress_asB64=function(){return X.Message.bytesAsB64(this.getVoteAddress())};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteAddress_asU8=function(){return X.Message.bytesAsU8(this.getVoteAddress())};TronWebProto.VoteWitnessContract.Vote.prototype.setVoteAddress=function(n){return X.Message.setProto3BytesField(this,1,n)};TronWebProto.VoteWitnessContract.Vote.prototype.getVoteCount=function(){return X.Message.getFieldWithDefault(this,2,0)};TronWebProto.VoteWitnessContract.Vote.prototype.setVoteCount=function(n){return X.Message.setProto3IntField(this,2,n)};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress=function(){return X.Message.getFieldWithDefault(this,1,"")};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress_asB64=function(){return X.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.VoteWitnessContract.prototype.getOwnerAddress_asU8=function(){return X.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.VoteWitnessContract.prototype.setOwnerAddress=function(n){return X.Message.setProto3BytesField(this,1,n)};TronWebProto.VoteWitnessContract.prototype.getVotesList=function(){return X.Message.getRepeatedWrapperField(this,TronWebProto.VoteWitnessContract.Vote,2)};TronWebProto.VoteWitnessContract.prototype.setVotesList=function(n){return X.Message.setRepeatedWrapperField(this,2,n)};TronWebProto.VoteWitnessContract.prototype.addVotes=function(n,r){return X.Message.addToRepeatedWrapperField(this,2,n,TronWebProto.VoteWitnessContract.Vote,r)};TronWebProto.VoteWitnessContract.prototype.clearVotesList=function(){return this.setVotesList([])};TronWebProto.VoteWitnessContract.prototype.getSupport=function(){return X.Message.getBooleanFieldWithDefault(this,3,!1)};TronWebProto.VoteWitnessContract.prototype.setSupport=function(n){return X.Message.setProto3BooleanField(this,3,n)};rr.object.extend(tA,TronWebProto)});var oA=Ot(nA=>{var te=mr(),nr=te,Lo=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Lo<"u"&&Lo||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();nr.exportSymbol("TronWebProto.BuyStorageBytesContract",null,Lo);nr.exportSymbol("TronWebProto.BuyStorageContract",null,Lo);nr.exportSymbol("TronWebProto.SellStorageContract",null,Lo);nr.exportSymbol("TronWebProto.UpdateBrokerageContract",null,Lo);TronWebProto.BuyStorageBytesContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.BuyStorageBytesContract,te.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.BuyStorageBytesContract.displayName="TronWebProto.BuyStorageBytesContract");TronWebProto.BuyStorageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.BuyStorageContract,te.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.BuyStorageContract.displayName="TronWebProto.BuyStorageContract");TronWebProto.SellStorageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.SellStorageContract,te.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.SellStorageContract.displayName="TronWebProto.SellStorageContract");TronWebProto.UpdateBrokerageContract=function(n){te.Message.initialize(this,n,0,-1,null,null)};nr.inherits(TronWebProto.UpdateBrokerageContract,te.Message);nr.DEBUG&&!COMPILED&&(TronWebProto.UpdateBrokerageContract.displayName="TronWebProto.UpdateBrokerageContract");te.Message.GENERATE_TO_OBJECT&&(TronWebProto.BuyStorageBytesContract.prototype.toObject=function(n){return TronWebProto.BuyStorageBytesContract.toObject(n,this)},TronWebProto.BuyStorageBytesContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),bytes:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BuyStorageBytesContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.BuyStorageBytesContract;return TronWebProto.BuyStorageBytesContract.deserializeBinaryFromReader(o,r)};TronWebProto.BuyStorageBytesContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setBytes(s);break;default:r.skipField();break}}return n};TronWebProto.BuyStorageBytesContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.BuyStorageBytesContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BuyStorageBytesContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getBytes(),o!==0&&r.writeInt64(2,o)};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.BuyStorageBytesContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.BuyStorageBytesContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.BuyStorageBytesContract.prototype.getBytes=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.BuyStorageBytesContract.prototype.setBytes=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.BuyStorageContract.prototype.toObject=function(n){return TronWebProto.BuyStorageContract.toObject(n,this)},TronWebProto.BuyStorageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),quant:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.BuyStorageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.BuyStorageContract;return TronWebProto.BuyStorageContract.deserializeBinaryFromReader(o,r)};TronWebProto.BuyStorageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.BuyStorageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.BuyStorageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.BuyStorageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getQuant(),o!==0&&r.writeInt64(2,o)};TronWebProto.BuyStorageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.BuyStorageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.BuyStorageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.BuyStorageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.BuyStorageContract.prototype.getQuant=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.BuyStorageContract.prototype.setQuant=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.SellStorageContract.prototype.toObject=function(n){return TronWebProto.SellStorageContract.toObject(n,this)},TronWebProto.SellStorageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),storageBytes:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SellStorageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.SellStorageContract;return TronWebProto.SellStorageContract.deserializeBinaryFromReader(o,r)};TronWebProto.SellStorageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setStorageBytes(s);break;default:r.skipField();break}}return n};TronWebProto.SellStorageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.SellStorageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SellStorageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getStorageBytes(),o!==0&&r.writeInt64(2,o)};TronWebProto.SellStorageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.SellStorageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.SellStorageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.SellStorageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.SellStorageContract.prototype.getStorageBytes=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.SellStorageContract.prototype.setStorageBytes=function(n){return te.Message.setProto3IntField(this,2,n)};te.Message.GENERATE_TO_OBJECT&&(TronWebProto.UpdateBrokerageContract.prototype.toObject=function(n){return TronWebProto.UpdateBrokerageContract.toObject(n,this)},TronWebProto.UpdateBrokerageContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),brokerage:te.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.UpdateBrokerageContract.deserializeBinary=function(n){var r=new te.BinaryReader(n),o=new TronWebProto.UpdateBrokerageContract;return TronWebProto.UpdateBrokerageContract.deserializeBinaryFromReader(o,r)};TronWebProto.UpdateBrokerageContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt32();n.setBrokerage(s);break;default:r.skipField();break}}return n};TronWebProto.UpdateBrokerageContract.prototype.serializeBinary=function(){var n=new te.BinaryWriter;return TronWebProto.UpdateBrokerageContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.UpdateBrokerageContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getBrokerage(),o!==0&&r.writeInt32(2,o)};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress=function(){return te.Message.getFieldWithDefault(this,1,"")};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress_asB64=function(){return te.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.UpdateBrokerageContract.prototype.getOwnerAddress_asU8=function(){return te.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.UpdateBrokerageContract.prototype.setOwnerAddress=function(n){return te.Message.setProto3BytesField(this,1,n)};TronWebProto.UpdateBrokerageContract.prototype.getBrokerage=function(){return te.Message.getFieldWithDefault(this,2,0)};TronWebProto.UpdateBrokerageContract.prototype.setBrokerage=function(n){return te.Message.setProto3IntField(this,2,n)};nr.object.extend(nA,TronWebProto)});var iA=Ot(sA=>{var H=mr(),$t=H,$o=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof $o<"u"&&$o||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")(),St=oa();$t.object.extend(proto,St);$t.exportSymbol("TronWebProto.AccountCreateContract",null,$o);$t.exportSymbol("TronWebProto.AccountPermissionUpdateContract",null,$o);$t.exportSymbol("TronWebProto.AccountUpdateContract",null,$o);$t.exportSymbol("TronWebProto.SetAccountIdContract",null,$o);TronWebProto.AccountCreateContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};$t.inherits(TronWebProto.AccountCreateContract,H.Message);$t.DEBUG&&!COMPILED&&(TronWebProto.AccountCreateContract.displayName="TronWebProto.AccountCreateContract");TronWebProto.AccountUpdateContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};$t.inherits(TronWebProto.AccountUpdateContract,H.Message);$t.DEBUG&&!COMPILED&&(TronWebProto.AccountUpdateContract.displayName="TronWebProto.AccountUpdateContract");TronWebProto.SetAccountIdContract=function(n){H.Message.initialize(this,n,0,-1,null,null)};$t.inherits(TronWebProto.SetAccountIdContract,H.Message);$t.DEBUG&&!COMPILED&&(TronWebProto.SetAccountIdContract.displayName="TronWebProto.SetAccountIdContract");TronWebProto.AccountPermissionUpdateContract=function(n){H.Message.initialize(this,n,0,-1,TronWebProto.AccountPermissionUpdateContract.repeatedFields_,null)};$t.inherits(TronWebProto.AccountPermissionUpdateContract,H.Message);$t.DEBUG&&!COMPILED&&(TronWebProto.AccountPermissionUpdateContract.displayName="TronWebProto.AccountPermissionUpdateContract");H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountCreateContract.prototype.toObject=function(n){return TronWebProto.AccountCreateContract.toObject(n,this)},TronWebProto.AccountCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),accountAddress:r.getAccountAddress_asB64(),type:H.Message.getFieldWithDefault(r,3,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountCreateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountCreateContract;return TronWebProto.AccountCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setAccountAddress(s);break;case 3:var s=r.readEnum();n.setType(s);break;default:r.skipField();break}}return n};TronWebProto.AccountCreateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getAccountAddress_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getType(),o!==0&&r.writeEnum(3,o)};TronWebProto.AccountCreateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountCreateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountCreateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountCreateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountCreateContract.prototype.getAccountAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountCreateContract.prototype.getAccountAddress_asB64=function(){return H.Message.bytesAsB64(this.getAccountAddress())};TronWebProto.AccountCreateContract.prototype.getAccountAddress_asU8=function(){return H.Message.bytesAsU8(this.getAccountAddress())};TronWebProto.AccountCreateContract.prototype.setAccountAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};TronWebProto.AccountCreateContract.prototype.getType=function(){return H.Message.getFieldWithDefault(this,3,0)};TronWebProto.AccountCreateContract.prototype.setType=function(n){return H.Message.setProto3EnumField(this,3,n)};H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountUpdateContract.prototype.toObject=function(n){return TronWebProto.AccountUpdateContract.toObject(n,this)},TronWebProto.AccountUpdateContract.toObject=function(n,r){var o,s={accountName:r.getAccountName_asB64(),ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountUpdateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountUpdateContract;return TronWebProto.AccountUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountName(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.AccountUpdateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountName_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.AccountUpdateContract.prototype.getAccountName=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountUpdateContract.prototype.getAccountName_asB64=function(){return H.Message.bytesAsB64(this.getAccountName())};TronWebProto.AccountUpdateContract.prototype.getAccountName_asU8=function(){return H.Message.bytesAsU8(this.getAccountName())};TronWebProto.AccountUpdateContract.prototype.setAccountName=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountUpdateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountUpdateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};H.Message.GENERATE_TO_OBJECT&&(TronWebProto.SetAccountIdContract.prototype.toObject=function(n){return TronWebProto.SetAccountIdContract.toObject(n,this)},TronWebProto.SetAccountIdContract.toObject=function(n,r){var o,s={accountId:r.getAccountId_asB64(),ownerAddress:r.getOwnerAddress_asB64()};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.SetAccountIdContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.SetAccountIdContract;return TronWebProto.SetAccountIdContract.deserializeBinaryFromReader(o,r)};TronWebProto.SetAccountIdContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setAccountId(s);break;case 2:var s=r.readBytes();n.setOwnerAddress(s);break;default:r.skipField();break}}return n};TronWebProto.SetAccountIdContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.SetAccountIdContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.SetAccountIdContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getAccountId_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(2,o)};TronWebProto.SetAccountIdContract.prototype.getAccountId=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.SetAccountIdContract.prototype.getAccountId_asB64=function(){return H.Message.bytesAsB64(this.getAccountId())};TronWebProto.SetAccountIdContract.prototype.getAccountId_asU8=function(){return H.Message.bytesAsU8(this.getAccountId())};TronWebProto.SetAccountIdContract.prototype.setAccountId=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,2,"")};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.SetAccountIdContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.SetAccountIdContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,2,n)};TronWebProto.AccountPermissionUpdateContract.repeatedFields_=[4];H.Message.GENERATE_TO_OBJECT&&(TronWebProto.AccountPermissionUpdateContract.prototype.toObject=function(n){return TronWebProto.AccountPermissionUpdateContract.toObject(n,this)},TronWebProto.AccountPermissionUpdateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),owner:(o=r.getOwner())&&St.Permission.toObject(n,o),witness:(o=r.getWitness())&&St.Permission.toObject(n,o),activesList:H.Message.toObjectList(r.getActivesList(),St.Permission.toObject,n)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.AccountPermissionUpdateContract.deserializeBinary=function(n){var r=new H.BinaryReader(n),o=new TronWebProto.AccountPermissionUpdateContract;return TronWebProto.AccountPermissionUpdateContract.deserializeBinaryFromReader(o,r)};TronWebProto.AccountPermissionUpdateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=new St.Permission;r.readMessage(s,St.Permission.deserializeBinaryFromReader),n.setOwner(s);break;case 3:var s=new St.Permission;r.readMessage(s,St.Permission.deserializeBinaryFromReader),n.setWitness(s);break;case 4:var s=new St.Permission;r.readMessage(s,St.Permission.deserializeBinaryFromReader),n.addActives(s);break;default:r.skipField();break}}return n};TronWebProto.AccountPermissionUpdateContract.prototype.serializeBinary=function(){var n=new H.BinaryWriter;return TronWebProto.AccountPermissionUpdateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.AccountPermissionUpdateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getOwner(),o!=null&&r.writeMessage(2,o,St.Permission.serializeBinaryToWriter),o=n.getWitness(),o!=null&&r.writeMessage(3,o,St.Permission.serializeBinaryToWriter),o=n.getActivesList(),o.length>0&&r.writeRepeatedMessage(4,o,St.Permission.serializeBinaryToWriter)};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress=function(){return H.Message.getFieldWithDefault(this,1,"")};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress_asB64=function(){return H.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.AccountPermissionUpdateContract.prototype.getOwnerAddress_asU8=function(){return H.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.AccountPermissionUpdateContract.prototype.setOwnerAddress=function(n){return H.Message.setProto3BytesField(this,1,n)};TronWebProto.AccountPermissionUpdateContract.prototype.getOwner=function(){return H.Message.getWrapperField(this,St.Permission,2)};TronWebProto.AccountPermissionUpdateContract.prototype.setOwner=function(n){return H.Message.setWrapperField(this,2,n)};TronWebProto.AccountPermissionUpdateContract.prototype.clearOwner=function(){return this.setOwner(void 0)};TronWebProto.AccountPermissionUpdateContract.prototype.hasOwner=function(){return H.Message.getField(this,2)!=null};TronWebProto.AccountPermissionUpdateContract.prototype.getWitness=function(){return H.Message.getWrapperField(this,St.Permission,3)};TronWebProto.AccountPermissionUpdateContract.prototype.setWitness=function(n){return H.Message.setWrapperField(this,3,n)};TronWebProto.AccountPermissionUpdateContract.prototype.clearWitness=function(){return this.setWitness(void 0)};TronWebProto.AccountPermissionUpdateContract.prototype.hasWitness=function(){return H.Message.getField(this,3)!=null};TronWebProto.AccountPermissionUpdateContract.prototype.getActivesList=function(){return H.Message.getRepeatedWrapperField(this,St.Permission,4)};TronWebProto.AccountPermissionUpdateContract.prototype.setActivesList=function(n){return H.Message.setRepeatedWrapperField(this,4,n)};TronWebProto.AccountPermissionUpdateContract.prototype.addActives=function(n,r){return H.Message.addToRepeatedWrapperField(this,4,n,TronWebProto.Permission,r)};TronWebProto.AccountPermissionUpdateContract.prototype.clearActivesList=function(){return this.setActivesList([])};$t.object.extend(sA,TronWebProto)});var cA=Ot(aA=>{var ae=mr(),Kr=ae,Gs=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Gs<"u"&&Gs||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();Kr.exportSymbol("TronWebProto.ProposalApproveContract",null,Gs);Kr.exportSymbol("TronWebProto.ProposalCreateContract",null,Gs);Kr.exportSymbol("TronWebProto.ProposalDeleteContract",null,Gs);TronWebProto.ProposalApproveContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalApproveContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalApproveContract.displayName="TronWebProto.ProposalApproveContract");TronWebProto.ProposalCreateContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalCreateContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalCreateContract.displayName="TronWebProto.ProposalCreateContract");TronWebProto.ProposalDeleteContract=function(n){ae.Message.initialize(this,n,0,-1,null,null)};Kr.inherits(TronWebProto.ProposalDeleteContract,ae.Message);Kr.DEBUG&&!COMPILED&&(TronWebProto.ProposalDeleteContract.displayName="TronWebProto.ProposalDeleteContract");ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalApproveContract.prototype.toObject=function(n){return TronWebProto.ProposalApproveContract.toObject(n,this)},TronWebProto.ProposalApproveContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),proposalId:ae.Message.getFieldWithDefault(r,2,0),isAddApproval:ae.Message.getBooleanFieldWithDefault(r,3,!1)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalApproveContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalApproveContract;return TronWebProto.ProposalApproveContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalApproveContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setProposalId(s);break;case 3:var s=r.readBool();n.setIsAddApproval(s);break;default:r.skipField();break}}return n};TronWebProto.ProposalApproveContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalApproveContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalApproveContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getProposalId(),o!==0&&r.writeInt64(2,o),o=n.getIsAddApproval(),o&&r.writeBool(3,o)};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalApproveContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalApproveContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalApproveContract.prototype.getProposalId=function(){return ae.Message.getFieldWithDefault(this,2,0)};TronWebProto.ProposalApproveContract.prototype.setProposalId=function(n){return ae.Message.setProto3IntField(this,2,n)};TronWebProto.ProposalApproveContract.prototype.getIsAddApproval=function(){return ae.Message.getBooleanFieldWithDefault(this,3,!1)};TronWebProto.ProposalApproveContract.prototype.setIsAddApproval=function(n){return ae.Message.setProto3BooleanField(this,3,n)};ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalCreateContract.prototype.toObject=function(n){return TronWebProto.ProposalCreateContract.toObject(n,this)},TronWebProto.ProposalCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),parametersMap:(o=r.getParametersMap())?o.toObject(n,void 0):[]};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalCreateContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalCreateContract;return TronWebProto.ProposalCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=n.getParametersMap();r.readMessage(s,function(i,a){ae.Map.deserializeBinary(i,a,ae.BinaryReader.prototype.readInt64,ae.BinaryReader.prototype.readInt64,null,0,0)});break;default:r.skipField();break}}return n};TronWebProto.ProposalCreateContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getParametersMap(!0),o&&o.getLength()>0&&o.serializeBinary(2,r,ae.BinaryWriter.prototype.writeInt64,ae.BinaryWriter.prototype.writeInt64)};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalCreateContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalCreateContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalCreateContract.prototype.getParametersMap=function(n){return ae.Message.getMapField(this,2,n,null)};TronWebProto.ProposalCreateContract.prototype.clearParametersMap=function(){return this.getParametersMap().clear(),this};ae.Message.GENERATE_TO_OBJECT&&(TronWebProto.ProposalDeleteContract.prototype.toObject=function(n){return TronWebProto.ProposalDeleteContract.toObject(n,this)},TronWebProto.ProposalDeleteContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),proposalId:ae.Message.getFieldWithDefault(r,2,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ProposalDeleteContract.deserializeBinary=function(n){var r=new ae.BinaryReader(n),o=new TronWebProto.ProposalDeleteContract;return TronWebProto.ProposalDeleteContract.deserializeBinaryFromReader(o,r)};TronWebProto.ProposalDeleteContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setProposalId(s);break;default:r.skipField();break}}return n};TronWebProto.ProposalDeleteContract.prototype.serializeBinary=function(){var n=new ae.BinaryWriter;return TronWebProto.ProposalDeleteContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ProposalDeleteContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getProposalId(),o!==0&&r.writeInt64(2,o)};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress=function(){return ae.Message.getFieldWithDefault(this,1,"")};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress_asB64=function(){return ae.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ProposalDeleteContract.prototype.getOwnerAddress_asU8=function(){return ae.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ProposalDeleteContract.prototype.setOwnerAddress=function(n){return ae.Message.setProto3BytesField(this,1,n)};TronWebProto.ProposalDeleteContract.prototype.getProposalId=function(){return ae.Message.getFieldWithDefault(this,2,0)};TronWebProto.ProposalDeleteContract.prototype.setProposalId=function(n){return ae.Message.setProto3IntField(this,2,n)};Kr.object.extend(aA,TronWebProto)});var lA=Ot(uA=>{var x=mr(),or=x,Zo=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof Zo<"u"&&Zo||typeof self<"u"&&self||function(){return this}.call(null)||Function("return this")();or.exportSymbol("TronWebProto.ExchangeCreateContract",null,Zo);or.exportSymbol("TronWebProto.ExchangeInjectContract",null,Zo);or.exportSymbol("TronWebProto.ExchangeTransactionContract",null,Zo);or.exportSymbol("TronWebProto.ExchangeWithdrawContract",null,Zo);TronWebProto.ExchangeCreateContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.ExchangeCreateContract,x.Message);or.DEBUG&&!COMPILED&&(TronWebProto.ExchangeCreateContract.displayName="TronWebProto.ExchangeCreateContract");TronWebProto.ExchangeInjectContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.ExchangeInjectContract,x.Message);or.DEBUG&&!COMPILED&&(TronWebProto.ExchangeInjectContract.displayName="TronWebProto.ExchangeInjectContract");TronWebProto.ExchangeWithdrawContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.ExchangeWithdrawContract,x.Message);or.DEBUG&&!COMPILED&&(TronWebProto.ExchangeWithdrawContract.displayName="TronWebProto.ExchangeWithdrawContract");TronWebProto.ExchangeTransactionContract=function(n){x.Message.initialize(this,n,0,-1,null,null)};or.inherits(TronWebProto.ExchangeTransactionContract,x.Message);or.DEBUG&&!COMPILED&&(TronWebProto.ExchangeTransactionContract.displayName="TronWebProto.ExchangeTransactionContract");x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeCreateContract.prototype.toObject=function(n){return TronWebProto.ExchangeCreateContract.toObject(n,this)},TronWebProto.ExchangeCreateContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),firstTokenId:r.getFirstTokenId_asB64(),firstTokenBalance:x.Message.getFieldWithDefault(r,3,0),secondTokenId:r.getSecondTokenId_asB64(),secondTokenBalance:x.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeCreateContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeCreateContract;return TronWebProto.ExchangeCreateContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeCreateContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readBytes();n.setFirstTokenId(s);break;case 3:var s=r.readInt64();n.setFirstTokenBalance(s);break;case 4:var s=r.readBytes();n.setSecondTokenId(s);break;case 5:var s=r.readInt64();n.setSecondTokenBalance(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeCreateContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeCreateContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeCreateContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getFirstTokenId_asU8(),o.length>0&&r.writeBytes(2,o),o=n.getFirstTokenBalance(),o!==0&&r.writeInt64(3,o),o=n.getSecondTokenId_asU8(),o.length>0&&r.writeBytes(4,o),o=n.getSecondTokenBalance(),o!==0&&r.writeInt64(5,o)};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeCreateContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeCreateContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId=function(){return x.Message.getFieldWithDefault(this,2,"")};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId_asB64=function(){return x.Message.bytesAsB64(this.getFirstTokenId())};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenId_asU8=function(){return x.Message.bytesAsU8(this.getFirstTokenId())};TronWebProto.ExchangeCreateContract.prototype.setFirstTokenId=function(n){return x.Message.setProto3BytesField(this,2,n)};TronWebProto.ExchangeCreateContract.prototype.getFirstTokenBalance=function(){return x.Message.getFieldWithDefault(this,3,0)};TronWebProto.ExchangeCreateContract.prototype.setFirstTokenBalance=function(n){return x.Message.setProto3IntField(this,3,n)};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId=function(){return x.Message.getFieldWithDefault(this,4,"")};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId_asB64=function(){return x.Message.bytesAsB64(this.getSecondTokenId())};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenId_asU8=function(){return x.Message.bytesAsU8(this.getSecondTokenId())};TronWebProto.ExchangeCreateContract.prototype.setSecondTokenId=function(n){return x.Message.setProto3BytesField(this,4,n)};TronWebProto.ExchangeCreateContract.prototype.getSecondTokenBalance=function(){return x.Message.getFieldWithDefault(this,5,0)};TronWebProto.ExchangeCreateContract.prototype.setSecondTokenBalance=function(n){return x.Message.setProto3IntField(this,5,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeInjectContract.prototype.toObject=function(n){return TronWebProto.ExchangeInjectContract.toObject(n,this)},TronWebProto.ExchangeInjectContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeInjectContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeInjectContract;return TronWebProto.ExchangeInjectContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeInjectContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeInjectContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeInjectContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeInjectContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o)};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeInjectContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeInjectContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeInjectContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeInjectContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeInjectContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeInjectContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeInjectContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeInjectContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeInjectContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeInjectContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeWithdrawContract.prototype.toObject=function(n){return TronWebProto.ExchangeWithdrawContract.toObject(n,this)},TronWebProto.ExchangeWithdrawContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeWithdrawContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeWithdrawContract;return TronWebProto.ExchangeWithdrawContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeWithdrawContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeWithdrawContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeWithdrawContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeWithdrawContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o)};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeWithdrawContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeWithdrawContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeWithdrawContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeWithdrawContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeWithdrawContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeWithdrawContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeWithdrawContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeWithdrawContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};x.Message.GENERATE_TO_OBJECT&&(TronWebProto.ExchangeTransactionContract.prototype.toObject=function(n){return TronWebProto.ExchangeTransactionContract.toObject(n,this)},TronWebProto.ExchangeTransactionContract.toObject=function(n,r){var o,s={ownerAddress:r.getOwnerAddress_asB64(),exchangeId:x.Message.getFieldWithDefault(r,2,0),tokenId:r.getTokenId_asB64(),quant:x.Message.getFieldWithDefault(r,4,0),expected:x.Message.getFieldWithDefault(r,5,0)};return n&&(s.$jspbMessageInstance=r),s});TronWebProto.ExchangeTransactionContract.deserializeBinary=function(n){var r=new x.BinaryReader(n),o=new TronWebProto.ExchangeTransactionContract;return TronWebProto.ExchangeTransactionContract.deserializeBinaryFromReader(o,r)};TronWebProto.ExchangeTransactionContract.deserializeBinaryFromReader=function(n,r){for(;r.nextField()&&!r.isEndGroup();){var o=r.getFieldNumber();switch(o){case 1:var s=r.readBytes();n.setOwnerAddress(s);break;case 2:var s=r.readInt64();n.setExchangeId(s);break;case 3:var s=r.readBytes();n.setTokenId(s);break;case 4:var s=r.readInt64();n.setQuant(s);break;case 5:var s=r.readInt64();n.setExpected(s);break;default:r.skipField();break}}return n};TronWebProto.ExchangeTransactionContract.prototype.serializeBinary=function(){var n=new x.BinaryWriter;return TronWebProto.ExchangeTransactionContract.serializeBinaryToWriter(this,n),n.getResultBuffer()};TronWebProto.ExchangeTransactionContract.serializeBinaryToWriter=function(n,r){var o=void 0;o=n.getOwnerAddress_asU8(),o.length>0&&r.writeBytes(1,o),o=n.getExchangeId(),o!==0&&r.writeInt64(2,o),o=n.getTokenId_asU8(),o.length>0&&r.writeBytes(3,o),o=n.getQuant(),o!==0&&r.writeInt64(4,o),o=n.getExpected(),o!==0&&r.writeInt64(5,o)};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress=function(){return x.Message.getFieldWithDefault(this,1,"")};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress_asB64=function(){return x.Message.bytesAsB64(this.getOwnerAddress())};TronWebProto.ExchangeTransactionContract.prototype.getOwnerAddress_asU8=function(){return x.Message.bytesAsU8(this.getOwnerAddress())};TronWebProto.ExchangeTransactionContract.prototype.setOwnerAddress=function(n){return x.Message.setProto3BytesField(this,1,n)};TronWebProto.ExchangeTransactionContract.prototype.getExchangeId=function(){return x.Message.getFieldWithDefault(this,2,0)};TronWebProto.ExchangeTransactionContract.prototype.setExchangeId=function(n){return x.Message.setProto3IntField(this,2,n)};TronWebProto.ExchangeTransactionContract.prototype.getTokenId=function(){return x.Message.getFieldWithDefault(this,3,"")};TronWebProto.ExchangeTransactionContract.prototype.getTokenId_asB64=function(){return x.Message.bytesAsB64(this.getTokenId())};TronWebProto.ExchangeTransactionContract.prototype.getTokenId_asU8=function(){return x.Message.bytesAsU8(this.getTokenId())};TronWebProto.ExchangeTransactionContract.prototype.setTokenId=function(n){return x.Message.setProto3BytesField(this,3,n)};TronWebProto.ExchangeTransactionContract.prototype.getQuant=function(){return x.Message.getFieldWithDefault(this,4,0)};TronWebProto.ExchangeTransactionContract.prototype.setQuant=function(n){return x.Message.setProto3IntField(this,4,n)};TronWebProto.ExchangeTransactionContract.prototype.getExpected=function(){return x.Message.getFieldWithDefault(this,5,0)};TronWebProto.ExchangeTransactionContract.prototype.setExpected=function(n){return x.Message.setProto3IntField(this,5,n)};or.object.extend(uA,TronWebProto)});var Wu={};Gt(Wu,{DeserializeTransaction:()=>Iy,txCheck:()=>Ls,txCheckWithArgs:()=>ia,txJsonToPb:()=>sa,txJsonToPbWithArgs:()=>wA,txPbToRawDataHex:()=>Cu,txPbToTxID:()=>Bu});var AA,Vw,Gw,Lw,$w,Zw,Jw,Hw,Kw,Xw,Yw,me,Ah,fh,mh,gh,hh,yh,fA,mA,gA,hA,yA,bA,bh,Th,dA,Ph,TA,wh,Ch,Bh,Wh,Jo,Ho,Sh,pA,vh,Ih,Mh,Rh,Fh,kh,Oh,Eh,xh,Dh,Nh,Uh,re,rt,so,_h,Be,jh,zh,Vh,Gh,Lh,$h,Zh,Jh,Hh,Kh,Xh,Yh,qh,Qh,ey,ty,ry,ny,oy,sy,iy,ay,cy,uy,ly,dy,py,Ay,fy,my,gy,hy,yy,PA,sa,wA,CA,Cu,Ls,ia,Bu,by,Ty,io,Py,aa,wy,Cy,By,Wy,Sy,vy,Iy,$s=se(()=>{AA=be(require("google-protobuf/google/protobuf/any_pb.js"),1),Vw=be(oa(),1),Gw=be(Xp(),1),Lw=be(qp(),1),$w=be(eA(),1),Zw=be(wu(),1),Jw=be(rA(),1),Hw=be(oA(),1),Kw=be(iA(),1),Xw=be(cA(),1),Yw=be(lA(),1);Jn();Hn();Qt();Cr();an();({Transaction:me,Permission:Ah,Key:fh}=globalThis.TronWebProto),{TransferContract:mh,FreezeBalanceContract:gh,UnfreezeBalanceContract:hh,WithdrawBalanceContract:yh,FreezeBalanceV2Contract:fA,UnfreezeBalanceV2Contract:mA,CancelAllUnfreezeV2Contract:gA,WithdrawExpireUnfreezeContract:hA,DelegateResourceContract:yA,UnDelegateResourceContract:bA}=globalThis.TronWebProto,{TransferAssetContract:bh,ParticipateAssetIssueContract:Th,AssetIssueContract:dA,UpdateAssetContract:Ph}=globalThis.TronWebProto,{TriggerSmartContract:TA,ClearABIContract:wh,UpdateEnergyLimitContract:Ch,UpdateSettingContract:Bh,CreateSmartContract:Wh,SmartContract:Jo}=globalThis.TronWebProto,{ResourceCode:Ho}=globalThis.TronWebProto,{WitnessCreateContract:Sh,VoteWitnessContract:pA}=globalThis.TronWebProto,{UpdateBrokerageContract:vh}=globalThis.TronWebProto,{AccountCreateContract:Ih,AccountUpdateContract:Mh,SetAccountIdContract:Rh,AccountPermissionUpdateContract:Fh}=globalThis.TronWebProto,{ProposalCreateContract:kh,ProposalDeleteContract:Oh,ProposalApproveContract:Eh}=globalThis.TronWebProto,{ExchangeCreateContract:xh,ExchangeInjectContract:Dh,ExchangeWithdrawContract:Nh,ExchangeTransactionContract:Uh}=globalThis.TronWebProto,re=n=>!n||n.length===0?new Uint8Array([]):new Uint8Array(ca.address.toHex(n).match(/.{1,2}/g).map(r=>parseInt(r,16))),rt=n=>!n||n.length===0?new Uint8Array([]):new Uint8Array((Jr(n)?n:ca.toHex(n)).replace(/^0x/,"").match(/.{1,2}/g).map(r=>parseInt(r,16))),so=(n,r)=>rt(r?ca.fromUtf8(n).replace(/^0x/,""):n.replace(/^0x/,"")),_h=(n,r=!0)=>(r?"0x":"")+(0,k.keccak256)(Buffer.from(n,"utf-8")).toString().substring(2),Be=(n,r,o,s)=>{let i=new AA.default.Any;i.pack(n.serializeBinary(),"protocol."+o);let a=new me.Contract;a.setType(r),a.setParameter(i),s&&a.setPermissionId(s);let c=new me.raw;c.addContract(a);let u=new me;return u.setRawData(c),u},jh=(n,r)=>{let{to_address:o,owner_address:s,amount:i}=n,a=new mh;return a.setToAddress(re(o)),a.setOwnerAddress(re(s)),a.setAmount(i),Be(a,me.Contract.ContractType.TRANSFERCONTRACT,"TransferContract",r.Permission_id)},zh=(n,r)=>{let{to_address:o,owner_address:s,amount:i,asset_name:a}=n,c=new bh;return c.setToAddress(re(o)),c.setOwnerAddress(re(s)),c.setAssetName(so(a,r.visible)),c.setAmount(i),Be(c,me.Contract.ContractType.TRANSFERASSETCONTRACT,"TransferAssetContract",r.Permission_id)},Vh=(n,r)=>{let o=new Th;return o.setToAddress(re(n.to_address)),o.setOwnerAddress(re(n.owner_address)),o.setAssetName(so(n.asset_name,r.visible)),o.setAmount(n.amount),Be(o,me.Contract.ContractType.PARTICIPATEASSETISSUECONTRACT,"ParticipateAssetIssueContract",r.Permission_id)},Gh=(n,r)=>{let o=new TA,{owner_address:s,contract_address:i,parameter:a="",function_selector:c,call_value:u,call_token_value:l,token_id:p,data:A}=n;if(o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setCallValue(u),A)o.setData(rt(A));else if(c){let g=_h(c).substring(2,10)+a;o.setData(rt(g))}return p&&o.setTokenId(p),l&&o.setCallTokenValue(l),Be(o,me.Contract.ContractType.TRIGGERSMARTCONTRACT,"TriggerSmartContract",r.Permission_id)},Lh=(n,r)=>{let o=new gh,{owner_address:s,frozen_balance:i,frozen_duration:a,resource:c,receiver_address:u}=n;return o.setOwnerAddress(re(s)),o.setFrozenBalance(i),o.setFrozenDuration(a),c&&o.setResource(Ho[c]),u&&o.setReceiverAddress(re(u)),Be(o,me.Contract.ContractType.FREEZEBALANCECONTRACT,"FreezeBalanceContract",r.Permission_id)},$h=(n,r)=>{let o=new hh,{owner_address:s,resource:i,receiver_address:a}=n;return o.setOwnerAddress(re(s)),i&&o.setResource(Ho[i]),a&&o.setReceiverAddress(re(a)),Be(o,me.Contract.ContractType.UNFREEZEBALANCECONTRACT,"UnfreezeBalanceContract",r.Permission_id)},Zh=(n,r)=>{let o=new yh,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Be(o,me.Contract.ContractType.WITHDRAWBALANCECONTRACT,"WithdrawBalanceContract",r.Permission_id)},Jh=(n,r)=>{let o=new fA,{owner_address:s,frozen_balance:i,resource:a}=n;return o.setOwnerAddress(re(s)),o.setFrozenBalance(i),o.setResource(Ho[a]),Be(o,me.Contract.ContractType.FREEZEBALANCEV2CONTRACT,"FreezeBalanceV2Contract",r.Permission_id)},Hh=(n,r)=>{let o=new gA,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Be(o,me.Contract.ContractType.CANCELALLUNFREEZEV2CONTRACT,"CancelAllUnfreezeV2Contract",r.Permission_id)},Kh=(n,r)=>{let o=new mA,{owner_address:s,unfreeze_balance:i,resource:a}=n;return o.setOwnerAddress(re(s)),o.setUnfreezeBalance(i),o.setResource(Ho[a]),Be(o,me.Contract.ContractType.UNFREEZEBALANCEV2CONTRACT,"UnfreezeBalanceV2Contract",r.Permission_id)},Xh=(n,r)=>{let o=new yA,{owner_address:s,receiver_address:i,balance:a,resource:c,lock:u=!1,lock_period:l}=n;return o.setOwnerAddress(re(s)),o.setBalance(a),o.setResource(Ho[c]),o.setLock(u),o.setLockPeriod(l),o.setReceiverAddress(re(i)),Be(o,me.Contract.ContractType.DELEGATERESOURCECONTRACT,"DelegateResourceContract",r.Permission_id)},Yh=(n,r)=>{let o=new bA,{owner_address:s,receiver_address:i,balance:a,resource:c}=n;return o.setOwnerAddress(re(s)),o.setBalance(a),o.setResource(Ho[c]),o.setReceiverAddress(re(i)),Be(o,me.Contract.ContractType.UNDELEGATERESOURCECONTRACT,"UnDelegateResourceContract",r.Permission_id)},qh=(n,r)=>{let o=new hA,{owner_address:s}=n;return o.setOwnerAddress(re(s)),Be(o,me.Contract.ContractType.WITHDRAWEXPIREUNFREEZECONTRACT,"WithdrawExpireUnfreezeContract",r.Permission_id)},Qh=(n,r)=>{let o=new Sh,{owner_address:s,url:i}=n;return o.setOwnerAddress(re(s)),o.setUrl(rt(i.replace(/^0x/,""))),Be(o,me.Contract.ContractType.WITNESSCREATECONTRACT,"WitnessCreateContract",r.Permission_id)},ey=(n,r)=>{let o=new pA,{owner_address:s,votes:i}=n;return o.setOwnerAddress(re(s)),i.forEach(a=>{let c=new pA.Vote,{vote_address:u,vote_count:l}=a;c.setVoteAddress(re(u));let p=parseInt(l);c.setVoteCount(p),o.addVotes(c)}),Be(o,me.Contract.ContractType.VOTEWITNESSCONTRACT,"VoteWitnessContract",r.Permission_id)},ty=(n,r)=>{let o=n?.new_contract?{owner_address:n.owner_address,call_token_value:n.call_token_value,token_id:n.token_id,...n.new_contract}:n,{owner_address:s,consume_user_resource_percent:i,origin_energy_limit:a,abi:c,bytecode:u="",parameter:l="",call_value:p,call_token_value:A,token_id:g,name:P}=o,{origin_address:b}=o,S=new Wh;S.setOwnerAddress(re(s)),g&&S.setTokenId(g),A&&S.setCallTokenValue(A);let I=new Jo;if(c){let F;typeof c=="string"?F=JSON.parse(c):F=c?.entrys||[];let j=new Jo.ABI,G=q=>{let de=new Jo.ABI.Entry.Param,{indexed:oe,name:ot,type:De}=q;return oe===!0&&de.setIndexed(!0),de.setName(ot),de.setType(De),de},$=F.map(q=>{let{anonymous:de,constant:oe,name:ot,inputs:De,outputs:Ge,type:pt,payable:zt,stateMutability:At}=q,Me=new Jo.ABI.Entry;return Me.setAnonymous(de),Me.setConstant(oe),Me.setName(ot),De&&Me.setInputsList(De.map(Ne=>G(Ne))),Ge&&Me.setOutputsList(Ge.map(Ne=>G(Ne))),pt&&Me.setType(Jo.ABI.Entry.EntryType[pt.toUpperCase()]),Me.setPayable(zt),At&&Me.setStatemutability(Jo.ABI.Entry.StateMutabilityType[At.toUpperCase()]),Me});j.setEntrysList($),I.setAbi(j)}if(p&&I.setCallValue(p),I.setConsumeUserResourcePercent(i),I.setOriginEnergyLimit(a),b||(b=s),I.setOriginAddress(re(b)),u){let F=u.replace(/^0x/,"")+l.replace(/^0x/,"");I.setBytecode(rt(F))}return I.setName(P),S.setNewContract(I),Be(S,me.Contract.ContractType.CREATESMARTCONTRACT,"CreateSmartContract",r.Permission_id)},ry=(n,r)=>{let{contract_address:o,owner_address:s}=n,i=new wh;return i.setOwnerAddress(re(s)),i.setContractAddress(re(o)),Be(i,me.Contract.ContractType.CLEARABICONTRACT,"ClearABIContract",r.Permission_id)},ny=(n,r)=>{let{brokerage:o,owner_address:s}=n,i=new vh;return i.setOwnerAddress(re(s)),i.setBrokerage(o),Be(i,me.Contract.ContractType.UPDATEBROKERAGECONTRACT,"UpdateBrokerageContract",r.Permission_id)},oy=(n,r)=>{let{owner_address:o,name:s,abbr:i,description:a,url:c,total_supply:u,trx_num:l,num:p,start_time:A,end_time:g,precision:P,free_asset_net_limit:b,public_free_asset_net_limit:S,public_free_asset_net_usage:I=0,public_latest_free_net_time:F=0,vote_score:j=0,frozen_supply:G}=n,$=new dA;if($.setOwnerAddress(re(o)),s&&$.setName(rt(s.replace(/^0x/,""))),i&&$.setAbbr(rt(i.replace(/^0x/,""))),$.setTotalSupply(u),$.setNum(p),$.setEndTime(g),$.setStartTime(A),$.setTrxNum(l),$.setVoteScore(j),P&&$.setPrecision(P),F&&$.setPublicLatestFreeNetTime(F),a&&$.setDescription(rt(a.replace(/^0x/,""))),c&&$.setUrl(rt(c.replace(/^0x/,""))),$.setPublicFreeAssetNetUsage(I),$.setFreeAssetNetLimit(b),$.setPublicFreeAssetNetLimit(S),G){let q=new dA.FrozenSupply;q.setFrozenAmount(G.length?G[0].frozen_amount:G.frozen_amount),q.setFrozenDays(G.length?G[0].frozen_days:G.frozen_days),$.addFrozenSupply(q)}return Be($,me.Contract.ContractType.ASSETISSUECONTRACT,"AssetIssueContract",r.Permission_id)},sy=(n,r)=>{let o=new Ih,{account_address:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountAddress(re(s.replace(/^0x/,""))),Be(o,me.Contract.ContractType.ACCOUNTCREATECONTRACT,"AccountCreateContract",r.Permission_id)},iy=(n,r)=>{let o=new Mh,{account_name:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountName(rt(s.replace(/^0x/,""))),Be(o,me.Contract.ContractType.ACCOUNTUPDATECONTRACT,"AccountUpdateContract",r.Permission_id)},ay=(n,r)=>{let o=new Rh,{account_id:s,owner_address:i}=n;return o.setOwnerAddress(re(i)),o.setAccountId(rt(s.replace(/^0x/,""))),Be(o,me.Contract.ContractType.SETACCOUNTIDCONTRACT,"SetAccountIdContract",r.Permission_id)},cy=(n,r)=>{let o=new kh,{owner_address:s,parameters:i}=n;return o.setOwnerAddress(re(s)),i.forEach(a=>{o.getParametersMap().set(a.key,a.value)}),Be(o,me.Contract.ContractType.PROPOSALCREATECONTRACT,"ProposalCreateContract",r.Permission_id)},uy=(n,r)=>{let o=new Oh,{owner_address:s,proposal_id:i}=n;return o.setOwnerAddress(re(s)),o.setProposalId(i),Be(o,me.Contract.ContractType.PROPOSALDELETECONTRACT,"ProposalDeleteContract",r.Permission_id)},ly=(n,r)=>{let o=new Eh,{owner_address:s,proposal_id:i,is_add_approval:a}=n;return o.setOwnerAddress(re(s)),o.setProposalId(i),o.setIsAddApproval(a),Be(o,me.Contract.ContractType.PROPOSALAPPROVECONTRACT,"ProposalApproveContract",r.Permission_id)},dy=(n,r)=>{let o=new xh,{owner_address:s,first_token_id:i,first_token_balance:a,second_token_id:c,second_token_balance:u}=n;return o.setOwnerAddress(re(s)),o.setFirstTokenId(so(i,r.visible)),o.setFirstTokenBalance(a),o.setSecondTokenId(so(c,r.visible)),o.setSecondTokenBalance(u),Be(o,me.Contract.ContractType.EXCHANGECREATECONTRACT,"ExchangeCreateContract",r.Permission_id)},py=(n,r)=>{let o=new Dh,{owner_address:s,exchange_id:i,token_id:a,quant:c}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(so(a,r.visible)),o.setQuant(c),Be(o,me.Contract.ContractType.EXCHANGEINJECTCONTRACT,"ExchangeInjectContract",r.Permission_id)},Ay=(n,r)=>{let o=new Nh,{owner_address:s,exchange_id:i,token_id:a,quant:c}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(so(a,r.visible)),o.setQuant(c),Be(o,me.Contract.ContractType.EXCHANGEWITHDRAWCONTRACT,"ExchangeWithdrawContract",r.Permission_id)},fy=(n,r)=>{let o=new Uh,{owner_address:s,exchange_id:i,token_id:a,quant:c,expected:u}=n;return o.setOwnerAddress(re(s)),o.setExchangeId(i),o.setTokenId(so(a,r.visible)),o.setQuant(c),o.setExpected(u),Be(o,me.Contract.ContractType.EXCHANGETRANSACTIONCONTRACT,"ExchangeTransactionContract",r.Permission_id)},my=(n,r)=>{let o=new Bh,{owner_address:s,contract_address:i,consume_user_resource_percent:a}=n;return o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setConsumeUserResourcePercent(a),Be(o,me.Contract.ContractType.UPDATESETTINGCONTRACT,"UpdateSettingContract",r.Permission_id)},gy=(n,r)=>{let o=new Ch,{owner_address:s,contract_address:i,origin_energy_limit:a}=n;return o.setOwnerAddress(re(s)),o.setContractAddress(re(i)),o.setOriginEnergyLimit(a),Be(o,me.Contract.ContractType.UPDATEENERGYLIMITCONTRACT,"UpdateEnergyLimitContract",r.Permission_id)},hy=(n,r)=>{let o=new Fh,{owner_address:s,owner:i,witness:a,actives:c}=n;o.setOwnerAddress(re(s));let u=p=>isNaN(p)?p==="Active"?2:p==="Witness"?1:0:p,l=p=>{let A=new Ah,{type:g,id:P,permission_name:b,threshold:S,parentId:I,operations:F,keys:j}=p;return A.setType(u(g)),A.setId(P),A.setPermissionName(b),A.setThreshold(S),I&&A.setParentId(I),F&&A.setOperations(rt(F)),j&&A.setKeysList(j.map(G=>{let $=new fh;return $.setAddress(re(G.address)),$.setWeight(G.weight),$})),A};return i&&o.setOwner(l(i)),a&&o.setWitness(l(a)),c&&(Array.isArray(c)?o.setActivesList(c.map(p=>l(p))):o.setActivesList([l(c)])),Be(o,me.Contract.ContractType.ACCOUNTPERMISSIONUPDATECONTRACT,"AccountPermissionUpdateContract",r.Permission_id)},yy=(n,r)=>{let o=new Ph,{owner_address:s,description:i,url:a,new_limit:c,new_public_limit:u}=n;return o.setOwnerAddress(re(s)),i&&o.setDescription(rt(i.replace(/^0x/,""))),a&&o.setUrl(rt(a.replace(/^0x/,""))),c&&o.setNewLimit(c),u&&o.setNewPublicLimit(u),Be(o,me.Contract.ContractType.UPDATEASSETCONTRACT,"UpdateAssetContract",r.Permission_id)},PA=(n,r,o)=>{switch(n.type){case"TransferContract":return jh(r,o);case"TransferAssetContract":return zh(r,o);case"ParticipateAssetIssueContract":return Vh(r,o);case"TriggerSmartContract":return Gh(r,o);case"FreezeBalanceContract":return Lh(r,o);case"UnfreezeBalanceContract":return $h(r,o);case"WithdrawBalanceContract":return Zh(r,o);case"FreezeBalanceV2Contract":return Jh(r,o);case"CancelAllUnfreezeV2Contract":return Hh(r,o);case"UnfreezeBalanceV2Contract":return Kh(r,o);case"DelegateResourceContract":return Xh(r,o);case"UnDelegateResourceContract":return Yh(r,o);case"WithdrawExpireUnfreezeContract":return qh(r,o);case"WitnessCreateContract":return Qh(r,o);case"VoteWitnessContract":return ey(r,o);case"CreateSmartContract":return ty(r,o);case"ClearABIContract":return ry(r,o);case"UpdateBrokerageContract":return ny(r,o);case"AssetIssueContract":return oy(r,o);case"AccountCreateContract":return sy(r,o);case"AccountUpdateContract":return iy(r,o);case"SetAccountIdContract":return ay(r,o);case"ProposalCreateContract":return cy(r,o);case"ProposalDeleteContract":return uy(r,o);case"ProposalApproveContract":return ly(r,o);case"ExchangeCreateContract":return dy(r,o);case"ExchangeInjectContract":return py(r,o);case"ExchangeWithdrawContract":return Ay(r,o);case"ExchangeTransactionContract":return fy(r,o);case"UpdateSettingContract":return my(r,o);case"UpdateEnergyLimitContract":return gy(r,o);case"AccountPermissionUpdateContract":return hy(r,o);case"UpdateAssetContract":return yy(r,o)}},sa=n=>{let r=n.raw_data,o=r.contract[0],s=o.parameter.value,i={Permission_id:o.Permission_id,visible:n.visible},a=PA(o,s,i),c=a.getRawData();return c.setRefBlockBytes(rt(r.ref_block_bytes)),c.setRefBlockHash(rt(r.ref_block_hash)),r.data&&c.setData(rt(r.data)),r.fee_limit&&c.setFeeLimit(r.fee_limit),r.expiration&&c.setExpiration(r.expiration),r.timestamp&&c.setTimestamp(r.timestamp),a.setRawData(c),a},wA=(n,r={},o={})=>{let s=n.raw_data,i=s.contract[0],a=PA(i,r,{Permission_id:r?.Permission_id}),c=a.getRawData();return c.setRefBlockBytes(rt(s.ref_block_bytes)),c.setRefBlockHash(rt(s.ref_block_hash)),o.data&&c.setData(rt(o.data.replace(/^0x/,""))),(o.fee_limit||r.fee_limit)&&c.setFeeLimit(o.fee_limit||r.fee_limit),s.expiration&&c.setExpiration(s.expiration),s.timestamp&&c.setTimestamp(s.timestamp),a.setRawData(c),a},CA=(n,r)=>{let o=r.getRawData().serializeBinary(),s=Ae(o),i=(0,k.sha256)(o);return s.toLowerCase()===n.raw_data_hex.toLowerCase()&&i.replace(/^0x/,"").toLowerCase()===n.txID.replace(/^0x/,"").toLowerCase()},Cu=n=>Ae(n.getRawData().serializeBinary()),Ls=n=>{let r=sa(n);return CA(n,r)},ia=(n,r,o)=>{let s=wA(n,r,o);return CA(n,s)},Bu=n=>{let r=n.getRawData().serializeBinary();return(0,k.sha256)(r)},by={0:"AccountCreateContract",1:"TransferContract",2:"TransferAssetContract",4:"VoteWitnessContract",5:"WitnessCreateContract",6:"AssetIssueContract",9:"ParticipateAssetIssueContract",10:"AccountUpdateContract",11:"FreezeBalanceContract",12:"UnfreezeBalanceContract",13:"WithdrawBalanceContract",15:"UpdateAssetContract",16:"ProposalCreateContract",17:"ProposalApproveContract",18:"ProposalDeleteContract",19:"SetAccountIdContract",30:"CreateSmartContract",31:"TriggerSmartContract",33:"UpdateSettingContract",41:"ExchangeCreateContract",42:"ExchangeInjectContract",43:"ExchangeWithdrawContract",44:"ExchangeTransactionContract",45:"UpdateEnergyLimitContract",46:"AccountPermissionUpdateContract",48:"ClearABIContract",49:"UpdateBrokerageContract",54:"FreezeBalanceV2Contract",55:"UnfreezeBalanceV2Contract",56:"WithdrawExpireUnfreezeContract",57:"DelegateResourceContract",58:"UnDelegateResourceContract",59:"CancelAllUnfreezeV2Contract"},Ty=n=>n.getAuthsList().map(o=>{let s=Ae(o.getPermissionName_asU8()),i=o.getAccount(),a={name:Ae(i.getName_asU8()),address:Ae(i.getAddress_asU8())};return{permission_name:s,account:a}}),io=(n,r)=>{let o=me.raw.deserializeBinary(it(r)),s=o.getContractList()[0],i=s.getParameter().getValue(),a=by[s.getType()];if(n!==a)throw new Error(`type ${n} dismatches with rawDataHex type ${a}`);return[{contract:[{parameter:{value:{},type_url:s.getParameter().getTypeUrl()},type:n,Permission_id:s.getPermissionId()}],data:Ae(o.getData()),fee_limit:o.getFeeLimit(),ref_block_bytes:Ae(o.getRefBlockBytes_asU8()),ref_block_hash:Ae(o.getRefBlockHash_asU8()),expiration:o.getExpiration(),timestamp:o.getTimestamp(),scripts:Ae(o.getScripts_asU8()),auths:Ty(o)},i]},Py=(n,r)=>{let[o,s]=io(n,r),i=TA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8()),contract_address:Ae(i.getContractAddress_asU8()),call_value:i.getCallValue(),data:Ae(i.getData_asU8()),call_token_value:i.getCallTokenValue(),token_id:i.getTokenId()},o},aa=n=>{switch(n){case 0:return"BANDWIDTH";case 1:return"ENERGY";default:return"BANDWIDTH"}},wy=(n,r)=>{let[o,s]=io(n,r),i=fA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8()),frozen_balance:i.getFrozenBalance(),resource:aa(i.getResource())},o},Cy=(n,r)=>{let[o,s]=io(n,r),i=mA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8()),unfreeze_balance:i.getUnfreezeBalance(),resource:aa(i.getResource())},o},By=(n,r)=>{let[o,s]=io(n,r),i=gA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8())},o},Wy=(n,r)=>{let[o,s]=io(n,r),i=yA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8()),balance:i.getBalance(),lock:i.getLock(),lock_period:i.getLockPeriod(),receiver_address:Ae(i.getReceiverAddress_asU8()),resource:aa(i.getResource())},o},Sy=(n,r)=>{let[o,s]=io(n,r),i=bA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8()),balance:i.getBalance(),receiver_address:Ae(i.getReceiverAddress_asU8()),resource:aa(i.getResource())},o},vy=(n,r)=>{let[o,s]=io(n,r),i=hA.deserializeBinary(s);return o.contract[0].parameter.value={owner_address:Ae(i.getOwnerAddress_asU8())},o},Iy=(n,r)=>{if(!r)throw new Error("rawDataHex cannot be empty");if(!Jr(r))throw new Error("rawDataHex is not a valid hex string");switch(n){case"TriggerSmartContract":return Py(n,r);case"FreezeBalanceV2Contract":return wy(n,r);case"UnfreezeBalanceV2Contract":return Cy(n,r);case"CancelAllUnfreezeV2Contract":return By(n,r);case"DelegateResourceContract":return Wy(n,r);case"UnDelegateResourceContract":return Sy(n,r);case"WithdrawExpireUnfreezeContract":return vy(n,r);default:throw new Error(`trasaction ${n} not supported`)}}});function vt(n){return ie.fromUtf8(n).replace(/^0x/,"")}function ua(n){return JSON.parse(JSON.stringify(n))}function BA(n,r,o){if(n.Error)throw new Error(n.Error);if(n.result&&n.result.message)throw new Error(ie.toUtf8(n.result.message));if(ia(n,r,o))return n;throw new Error("Invalid transaction")}function WA(n,r,o){if(n.Error)throw new Error(n.Error);if(n.result&&n.result.message)throw new Error(ie.toUtf8(n.result.message));if(!(o._isConstant||o.estimateEnergy)){if(ia(n.transaction,r,o))return n;throw new Error("Invalid transaction")}return n}function SA(n,r){return"41"+(0,k.keccak256)(Buffer.from(r+n,"hex")).toString().substring(2).slice(24)}function My(n){return n.request("wallet/getblock",{detail:!1},"post").then(r=>({ref_block_bytes:r.block_header.raw_data.number.toString(16).slice(-4).padStart(4,"0"),ref_block_hash:r.blockID.slice(16,32),expiration:r.block_header.raw_data.timestamp+60*1e3,timestamp:r.block_header.raw_data.timestamp}))}function vA(n={}){if(typeof n.ref_block_bytes>"u"&&typeof n.ref_block_hash>"u"&&typeof n.expiration>"u"&&typeof n.timestamp>"u")return!1;if(typeof n.ref_block_bytes!="string")throw new Error("Invalid ref_block_bytes provided.");if(typeof n.ref_block_hash!="string")throw new Error("Invalid ref_block_hash provided.");if(typeof n.expiration!="number")throw new Error("Invalid expiration provided.");if(typeof n.timestamp!="number")throw new Error("Invalid timestamp provided.");return!0}async function ge(n,r,o,s,i={}){let a={visible:!1,txID:"",raw_data_hex:"",raw_data:{contract:[{parameter:{value:o,type_url:`type.googleapis.com/protocol.${r}`},type:r}],...vA(i)?{}:await My(n.fullNode),...i}};s&&(a.raw_data.contract[0].Permission_id=s);let c=sa(a);return a.txID=Bu(c).replace(/^0x/,""),a.raw_data_hex=Cu(c).toLowerCase(),a}function Te(n={}){let r={};return vA(n.blockHeader)&&(r.ref_block_bytes=n.blockHeader.ref_block_bytes,r.ref_block_hash=n.blockHeader.ref_block_hash,r.expiration=n.blockHeader.expiration,r.timestamp=n.blockHeader.timestamp),r}var IA=se(()=>{Cr();$s();Qt()});var ao,Su=se(()=>{Cr();Qt();qt();Rs();iu();an();uu();IA();ao=class{tronWeb;validator;constructor(r){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.validator=new No}async sendTrx(r,o=0,s=this.tronWeb.defaultAddress.hex,i={}){o=parseInt(o),this.validator.notValid([{name:"recipient",type:"address",value:r},{name:"origin",type:"address",value:s},{names:["recipient","origin"],type:"notEqual",msg:"Cannot transfer TRX to the same account"},{name:"amount",type:"integer",gt:0,value:o}]);let a={to_address:L(r),owner_address:L(s),amount:o},c=Te(i);return ge(this.tronWeb,pe.TransferContract,a,i?.permissionId,c)}async sendToken(r,o=0,s,i=this.tronWeb.defaultAddress.hex,a={}){o=parseInt(o),this.validator.notValid([{name:"recipient",type:"address",value:r},{name:"origin",type:"address",value:i},{names:["recipient","origin"],type:"notEqual",msg:"Cannot transfer tokens to the same account"},{name:"amount",type:"integer",gt:0,value:o},{name:"token ID",type:"tokenId",value:s}]);let c={to_address:L(r),owner_address:L(i),asset_name:vt(s),amount:o},u=Te(a);return ge(this.tronWeb,pe.TransferAssetContract,c,a?.permissionId,u)}async purchaseToken(r,o,s=0,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"buyer",type:"address",value:i},{name:"issuer",type:"address",value:r},{names:["buyer","issuer"],type:"notEqual",msg:"Cannot purchase tokens from same account"},{name:"amount",type:"integer",gt:0,value:s},{name:"token ID",type:"tokenId",value:o}]);let c={to_address:L(r),owner_address:L(i),asset_name:vt(o),amount:parseInt(s)},u=Te(a);return ge(this.tronWeb,pe.ParticipateAssetIssueContract,c,a?.permissionId,u)}async freezeBalance(r=0,o=3,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a,c={}){this.validator.notValid([{name:"origin",type:"address",value:i},{name:"receiver",type:"address",value:a,optional:!0},{name:"amount",type:"integer",gt:0,value:r},{name:"duration",type:"integer",gte:3,value:o},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let u={owner_address:L(i),frozen_balance:parseInt(r),frozen_duration:parseInt(String(o))};s!=="BANDWIDTH"&&(u.resource=s),yt(a)&&L(a)!==L(i)&&(u.receiver_address=L(a));let l=Te(c);return ge(this.tronWeb,pe.FreezeBalanceContract,u,c?.permissionId,l)}async unfreezeBalance(r="BANDWIDTH",o=this.tronWeb.defaultAddress.hex,s,i={}){this.validator.notValid([{name:"origin",type:"address",value:o},{name:"receiver",type:"address",value:s,optional:!0},{name:"resource",type:"resource",value:r,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:L(o)};r!=="BANDWIDTH"&&(a.resource=r),yt(s)&&L(s)!==L(o)&&(a.receiver_address=L(s));let c=Te(i);return ge(this.tronWeb,pe.UnfreezeBalanceContract,a,i?.permissionId,c)}async freezeBalanceV2(r=0,o="BANDWIDTH",s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"origin",type:"address",value:s},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:L(s),frozen_balance:parseInt(r)};o!=="BANDWIDTH"&&(a.resource=o);let c=Te(i);return ge(this.tronWeb,pe.FreezeBalanceV2Contract,a,i?.permissionId,c)}async unfreezeBalanceV2(r=0,o="BANDWIDTH",s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"origin",type:"address",value:s},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]);let a={owner_address:L(s),unfreeze_balance:parseInt(r)};o!=="BANDWIDTH"&&(a.resource=o);let c=Te(i);return ge(this.tronWeb,pe.UnfreezeBalanceV2Contract,a,i?.permissionId,c)}async cancelUnfreezeBalanceV2(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:L(r)},i=Te(o);return ge(this.tronWeb,pe.CancelAllUnfreezeV2Contract,s,o?.permissionId,i)}async delegateResource(r=0,o,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a=!1,c,u={}){if(this.validator.notValid([{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'},{name:"receiver",type:"address",value:o},{name:"origin",type:"address",value:i},{name:"lock",type:"boolean",value:a},{name:"lock period",type:"integer",gte:0,value:c,optional:!0}]),L(o)===L(i))throw new Error("Receiver address must not be the same as owner address");let l={owner_address:L(i),receiver_address:L(o),balance:parseInt(r)};s!=="BANDWIDTH"&&(l.resource=s),a&&(l.lock=a,yt(c)&&(l.lock_period=c));let p=Te(u);return ge(this.tronWeb,pe.DelegateResourceContract,l,u?.permissionId,p)}async undelegateResource(r=0,o,s="BANDWIDTH",i=this.tronWeb.defaultAddress.hex,a={}){if(this.validator.notValid([{name:"origin",type:"address",value:i},{name:"receiver",type:"address",value:o},{name:"amount",type:"integer",gt:0,value:r},{name:"resource",type:"resource",value:s,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]),L(o)===L(i))throw new Error("Receiver address must not be the same as owner address");let c={owner_address:L(i),receiver_address:L(o),balance:parseInt(r)};s!=="BANDWIDTH"&&(c.resource=s);let u=Te(a);return ge(this.tronWeb,pe.UnDelegateResourceContract,c,a?.permissionId,u)}async withdrawExpireUnfreeze(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:L(r)},i=Te(o);return ge(this.tronWeb,pe.WithdrawExpireUnfreezeContract,s,o?.permissionId,i)}async withdrawBlockRewards(r=this.tronWeb.defaultAddress.hex,o={}){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={owner_address:L(r)},i=Te(o);return ge(this.tronWeb,pe.WithdrawBalanceContract,s,o?.permissionId,i)}async applyForSR(r=this.tronWeb.defaultAddress.hex,o="",s={}){this.validator.notValid([{name:"origin",type:"address",value:r},{name:"url",type:"url",value:o,msg:"Invalid url provided"},{name:"url",type:"string",value:o,lte:256,msg:"Invalid url provided"}]);let i={owner_address:L(r),url:vt(o)},a=Te(s);return ge(this.tronWeb,pe.WitnessCreateContract,i,s?.permissionId,a)}async vote(r={},o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"voter",type:"address",value:o},{name:"votes",type:"notEmptyObject",value:r}]);let i=Object.entries(r);for(let[l,p]of i)this.validator.notValid([{name:"SR",type:"address",value:l},{name:"vote count",type:"integer",gt:0,value:p,msg:"Invalid vote count provided for SR: "+l}]);let a=i.map(([l,p])=>({vote_address:L(l),vote_count:parseInt(p)})),c={owner_address:L(o),votes:a},u=Te(s);return ge(this.tronWeb,pe.VoteWitnessContract,c,s?.permissionId,u)}async createSmartContract(r={},o=this.tronWeb.defaultAddress.hex){let s=r.feeLimit||this.tronWeb.feeLimit,i=r.userFeePercentage;typeof i!="number"&&!i&&(i=100);let a=r.originEnergyLimit||1e7,c=r.callValue||0,u=r.tokenValue,l=r.tokenId||r.token_id,{abi:p}=r,{parameters:A=[]}=r,g="",{bytecode:P=!1,name:b=""}=r;if(p&&at(p))try{p=JSON.parse(p)}catch{throw new Error("Invalid options.abi provided")}let S=p,I=S;if(S.entrys&&(I=S.entrys),!Kn(I))throw new Error("Invalid options.abi provided");let F=I.some(Ge=>Ge.type==="constructor"&&Ge.stateMutability.toLowerCase()==="payable");if(this.validator.notValid([{name:"bytecode",type:"hex",value:P},{name:"feeLimit",type:"integer",value:s,gt:0},{name:"callValue",type:"integer",value:c,gte:0},{name:"userFeePercentage",type:"integer",value:i,gte:0,lte:100},{name:"originEnergyLimit",type:"integer",value:a,gte:0,lte:1e7},{name:"parameters",type:"array",value:A},{name:"issuer",type:"address",value:o},{name:"tokenValue",type:"integer",value:u,gte:0,optional:!0},{name:"tokenId",type:"integer",value:l,gte:0,optional:!0}]),!F&&(c>0||u>0))throw new Error("When contract is not payable, options.callValue and options.tokenValue must be 0");let{rawParameter:j,funcABIV2:G,parametersV2:$}=r;if(j&&at(j))g=j.replace(/^(0x)/,"");else if(G)g=Do(G,$).replace(/^(0x)/,"");else{let Ge=I.find(pt=>pt.type==="constructor");if(typeof Ge<"u"&&Ge){let pt=new k.AbiCoder,zt=[],At=[];if(Ge=Ge.inputs,A.length!=Ge.length)throw new Error(`constructor needs ${Ge.length} but ${A.length} provided`);for(let Me=0;Me<A.length;Me++){let Ne=Ge[Me].type,ft=A[Me];if(!Ne||!at(Ne)||!Ne.length)throw new Error("Invalid parameter type provided: "+Ne);let mt=Vt=>Kn(Vt)?Vt.map(pr=>mt(pr)):L(Vt).replace(ln,"0x");Ne==="address"||Ne.match(/^([^\x5b]*)(\x5b|$)/)?.[0]==="address["?ft=mt(ft):/trcToken/.test(Ne)&&(Ne=Ne.replace(/trcToken/,"uint256")),zt.push(Ne),At.push(ft)}try{g=pt.encode(zt,At).replace(/^(0x)/,"")}catch(Me){throw new Error(Me)}}else g=""}let q={owner_address:L(o),fee_limit:parseInt(s),call_value:parseInt(c),consume_user_resource_percent:i,origin_energy_limit:a,abi:JSON.stringify(I),bytecode:P,parameter:g,name:b};yt(u)&&(q.call_token_value=parseInt(u)),yt(l)&&(q.token_id=parseInt(l));let de={};de.owner_address=q.owner_address,yt(q.call_token_value)&&(de.call_token_value=q.call_token_value),yt(q.token_id)&&(de.token_id=q.token_id);let oe=de.new_contract={};q.abi?oe.abi={entrys:JSON.parse(q.abi)}:oe.abi={},q.call_value&&(oe.call_value=q.call_value),oe.consume_user_resource_percent=q.consume_user_resource_percent,oe.origin_energy_limit=q.origin_energy_limit,oe.origin_address=q.origin_address??q.owner_address,q.bytecode+q.parameter&&(oe.bytecode=(q.bytecode+q.parameter).replace(/^0x/,"")),yt(q.name)&&(oe.name=q.name);let ot=Te(r),De=await ge(this.tronWeb,pe.CreateSmartContract,de,r?.permissionId,{...ot,fee_limit:q.fee_limit});return De.contract_address=SA(q.owner_address,De.txID),De}async triggerSmartContract(r,o,s,i,a){let c=[r,o,s,i,a];return typeof c[2]!="object"&&(c[2]={feeLimit:c[2],callValue:c[3]},c.splice(3,1)),c[2]?.txLocal?this._triggerSmartContractLocal(...c):this._triggerSmartContract(...c)}async triggerConstantContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s._isConstant=!0,this._triggerSmartContract(r,o,s,i,a)}async triggerConfirmedConstantContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s._isConstant=!0,s.confirmed=!0,this._triggerSmartContract(r,o,s,i,a)}async estimateEnergy(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){return s.estimateEnergy=!0,await this._triggerSmartContract(r,o,s,i,a)}async deployConstantContract(r={input:"",ownerAddress:""}){let{input:o,ownerAddress:s,tokenId:i,tokenValue:a,callValue:c=0}=r;this.validator.notValid([{name:"input",type:"not-empty-string",value:o},{name:"callValue",type:"integer",value:c,gte:0},{name:"owner",type:"address",value:s},{name:"tokenValue",type:"integer",value:a,gte:0,optional:!0},{name:"tokenId",type:"integer",value:i,gte:0,optional:!0}]);let u={data:o,owner_address:L(s),call_value:c};i&&(u.token_id=i),a&&(u.call_token_value=a);let l=`wallet${r.confirmed?"solidity":""}/estimateenergy`,p=await this.tronWeb[r.confirmed?"solidityNode":"fullNode"].request(l,u,"post");if(p.Error)throw new Error(p.Error);if(p.result&&p.result.message)throw new Error(this.tronWeb.toUtf8(p.result.message));return p}_getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p){let A={contract_address:L(r),owner_address:L(a)};if(o&&at(o)){o=o.replace(/\s*/g,"");let g;if(i.length){let P=new k.AbiCoder,b=[],S=[];for(let I=0;I<i.length;I++){let{value:F}=i[I],{type:j}=i[I];if(!j||!at(j)||!j.length)throw new Error("Invalid parameter type provided: "+j);let G=$=>Kn($)?$.map(q=>G(q)):L($).replace(ln,"0x");(j==="address"||j.match(/^([^\x5b]*)(\x5b|$)/)?.[0]==="address[")&&(F=G(F)),b.push(j),S.push(F)}try{b=b.map(I=>(/trcToken/.test(I)&&(I=I.replace(/trcToken/,"uint256")),I)),g=P.encode(b,S).replace(/^(0x)/,"")}catch(I){throw new Error(I)}}else g="";s.funcABIV2&&(g=Do(s.funcABIV2,s.parametersV2).replace(/^(0x)/,"")),s.shieldedParameter&&at(s.shieldedParameter)&&(g=s.shieldedParameter.replace(/^(0x)/,"")),s.rawParameter&&at(s.rawParameter)&&(g=s.rawParameter.replace(/^(0x)/,"")),A.function_selector=o,A.parameter=g}else s.input&&(A.data=s.input);return A.call_value=parseInt(l),yt(c)&&(A.call_token_value=parseInt(c)),yt(u)&&(A.token_id=parseInt(u)),s._isConstant||s.estimateEnergy||(A.fee_limit=parseInt(p)),s.permissionId&&(A.Permission_id=s.permissionId),A}async _triggerSmartContractLocal(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){let{tokenValue:c,tokenId:u,callValue:l,feeLimit:p}=Object.assign({callValue:0,feeLimit:this.tronWeb.feeLimit},s);this.validator.notValid([{name:"feeLimit",type:"integer",value:p,gt:0},{name:"callValue",type:"integer",value:l,gte:0},{name:"parameters",type:"array",value:i},{name:"contract",type:"address",value:r},{name:"issuer",type:"address",value:a,optional:!0},{name:"tokenValue",type:"integer",value:c,gte:0,optional:!0},{name:"tokenId",type:"integer",value:u,gte:0,optional:!0}]);let A=this._getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p);A.function_selector&&(A.data=(0,k.keccak256)(Buffer.from(A.function_selector,"utf-8")).toString().substring(2,10)+A.parameter);let g={data:A.data,owner_address:A.owner_address,contract_address:A.contract_address};A.call_value&&(g.call_value=A.call_value),A.call_token_value&&(g.call_token_value=A.call_token_value),A.token_id&&(g.token_id=A.token_id);let P=Te(s),b=await ge(this.tronWeb,pe.TriggerSmartContract,g,s.permissionId,{...P,fee_limit:A.fee_limit});return{result:{result:!0},transaction:b}}async _triggerSmartContract(r,o,s={},i=[],a=this.tronWeb.defaultAddress.hex){let{tokenValue:c,tokenId:u,callValue:l,feeLimit:p}=Object.assign({callValue:0,feeLimit:this.tronWeb.feeLimit},s);this.validator.notValid([{name:"feeLimit",type:"integer",value:p,gt:0},{name:"callValue",type:"integer",value:l,gte:0},{name:"parameters",type:"array",value:i},{name:"contract",type:"address",value:r},{name:"issuer",type:"address",value:a,optional:!0},{name:"tokenValue",type:"integer",value:c,gte:0,optional:!0},{name:"tokenId",type:"integer",value:u,gte:0,optional:!0}]);let A=this._getTriggerSmartContractArgs(r,o,s,i,a,c,u,l,p),g="triggersmartcontract";s._isConstant?g="triggerconstantcontract":s.estimateEnergy&&(g="estimateenergy"),g=`wallet${s.confirmed?"solidity":""}/${g}`;let P=await this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(g,A,"post");return WA(P,A,s)}async clearABI(r,o=this.tronWeb.defaultAddress.hex,s={}){if(!ie.isAddress(r))throw new Error("Invalid contract address provided");if(!ie.isAddress(o))throw new Error("Invalid owner address provided");let i={contract_address:L(r),owner_address:L(o)};this.tronWeb.trx.cache.contracts[r]&&delete this.tronWeb.trx.cache.contracts[r];let a=Te(s);return ge(this.tronWeb,pe.ClearABIContract,i,s?.permissionId,a)}async updateBrokerage(r,o=this.tronWeb.defaultAddress.hex,s={}){if(!yt(r))throw new Error("Invalid brokerage provided");if(!Hr(r)||r<0||r>100)throw new Error("Brokerage must be an integer between 0 and 100");if(!ie.isAddress(o))throw new Error("Invalid owner address provided");let i={brokerage:parseInt(r),owner_address:L(o)},a=Te(s);return ge(this.tronWeb,pe.UpdateBrokerageContract,i,s?.permissionId,a)}async createToken(r={},o=this.tronWeb.defaultAddress.hex){let{name:s=!1,abbreviation:i=!1,description:a="",url:c=!1,totalSupply:u=0,trxRatio:l=1,tokenRatio:p=1,saleStart:A=Date.now(),saleEnd:g=!1,freeBandwidth:P=0,freeBandwidthLimit:b=0,frozenAmount:S=0,frozenDuration:I=0,voteScore:F,precision:j}=r;if(this.validator.notValid([{name:"Supply amount",type:"positive-integer",value:u},{name:"TRX ratio",type:"positive-integer",value:l},{name:"Token ratio",type:"positive-integer",value:p},{name:"token abbreviation",type:"string",value:i,lte:32,gt:0},{name:"token name",type:"not-empty-string",value:s},{name:"token description",type:"string",value:a,lte:200},{name:"token url",type:"url",value:c},{name:"token url",type:"string",value:c,lte:256},{name:"issuer",type:"address",value:o},{name:"sale start timestamp",type:"integer",value:A,gte:Date.now()},{name:"sale end timestamp",type:"integer",value:g,gt:A},{name:"Frozen supply",type:"integer",value:S,gte:0},{name:"Frozen duration",type:"integer",value:I,gte:0}]),yt(F)&&(!Hr(F)||F<=0))throw new Error("voteScore must be a positive integer greater than 0");if(yt(j)&&(!Hr(j)||j<0||j>6))throw new Error("precision must be a positive integer >= 0 and <= 6");let G={owner_address:L(o),name:vt(s),abbr:vt(i),description:vt(a),url:vt(c),total_supply:parseInt(u),trx_num:parseInt(l),num:parseInt(p),start_time:parseInt(A),end_time:parseInt(g),frozen_supply:[{frozen_amount:parseInt(S),frozen_days:parseInt(I)}]};["name","abbr","description","url"].forEach(q=>{G[q]||delete G[q]}),parseInt(S)>0||delete G.frozen_supply,P&&!isNaN(parseInt(P))&&parseInt(P)>=0&&(G.free_asset_net_limit=parseInt(P)),b&&!isNaN(parseInt(b))&&parseInt(b)>=0&&(G.public_free_asset_net_limit=parseInt(b)),j&&!isNaN(parseInt(j))&&(G.precision=parseInt(j)),F&&!isNaN(parseInt(F))&&(G.vote_score=parseInt(F));let $=Te(r);return ge(this.tronWeb,pe.AssetIssueContract,G,r?.permissionId,$)}async createAccount(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"account",type:"address",value:r},{name:"origin",type:"address",value:o}]);let i={owner_address:L(o),account_address:L(r)},a=Te(s);return ge(this.tronWeb,pe.AccountCreateContract,i,s?.permissionId,a)}async updateAccount(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"Name",type:"string",lte:200,gt:0,value:r,msg:"Invalid accountName"},{name:"origin",type:"address",value:o}]);let i={account_name:vt(r),owner_address:L(o)},a=Te(s);return ge(this.tronWeb,pe.AccountUpdateContract,i,s?.permissionId,a)}async setAccountId(r,o=this.tronWeb.defaultAddress.hex,s={}){r&&at(r)&&r.startsWith("0x")&&(r=r.slice(2)),this.validator.notValid([{name:"accountId",type:"hex",value:r},{name:"accountId",type:"string",lte:32,gte:8,value:r},{name:"origin",type:"address",value:o}]);let i={account_id:r,owner_address:L(o)},a=Te(s);return ge(this.tronWeb,pe.SetAccountIdContract,i,s?.permissionId,a)}async updateToken(r={},o=this.tronWeb.defaultAddress.hex){let{description:s="",url:i=!1,freeBandwidth:a=0,freeBandwidthLimit:c=0}=r;this.validator.notValid([{name:"token description",type:"string",value:s,lte:200},{name:"token url",type:"url",value:i},{name:"token url",type:"string",value:i,lte:256},{name:"issuer",type:"address",value:o}]);let u={owner_address:L(o),description:vt(s),url:vt(i)};a&&!isNaN(parseInt(a))&&parseInt(a)>=0&&(u.new_limit=parseInt(a)),c&&!isNaN(parseInt(c))&&parseInt(c)>=0&&(u.new_public_limit=parseInt(c));let l=Te(r);return ge(this.tronWeb,pe.UpdateAssetContract,u,r?.permissionId,l)}async sendAsset(r,o=0,s,i=this.tronWeb.defaultAddress.hex,a={}){return this.sendToken(r,o,s,i,a)}async purchaseAsset(r,o,s=0,i=this.tronWeb.defaultAddress.hex,a={}){return this.purchaseToken(r,o,s,i,a)}async createAsset(r,o){return this.createToken(r,o)}async updateAsset(r={},o=this.tronWeb.defaultAddress.hex){return this.updateToken(r,o)}async createProposal(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"issuer",type:"address",value:o}]);let i="Invalid proposal parameters provided";if(!r)throw new Error(i);let a=Kn(r)?r:[r];for(let l of a)if(!Wn(l))throw new Error(i);let c={owner_address:L(o),parameters:a},u=Te(s);return ge(this.tronWeb,pe.ProposalCreateContract,c,s?.permissionId,u)}async deleteProposal(r,o=this.tronWeb.defaultAddress.hex,s={}){this.validator.notValid([{name:"issuer",type:"address",value:o},{name:"proposalID",type:"integer",value:r,gte:0}]);let i={owner_address:L(o),proposal_id:parseInt(r)},a=Te(s);return ge(this.tronWeb,pe.ProposalDeleteContract,i,s?.permissionId,a)}async voteProposal(r,o=!1,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"voter",type:"address",value:s},{name:"proposalID",type:"integer",value:r,gte:0},{name:"has approval",type:"boolean",value:o}]);let a={owner_address:L(s),proposal_id:parseInt(r),is_add_approval:o},c=Te(i);return ge(this.tronWeb,pe.ProposalApproveContract,a,i?.permissionId,c)}async createTRXExchange(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:r},{name:"token balance",type:"positive-integer",value:o},{name:"trx balance",type:"positive-integer",value:s}]);let c={owner_address:L(i),first_token_id:vt(r),first_token_balance:o,second_token_id:"5f",second_token_balance:s},u=Te(a);return ge(this.tronWeb,pe.ExchangeCreateContract,c,a?.permissionId,u)}async createTokenExchange(r,o,s,i,a=this.tronWeb.defaultAddress.hex,c={}){this.validator.notValid([{name:"owner",type:"address",value:a},{name:"first token name",type:"not-empty-string",value:r},{name:"second token name",type:"not-empty-string",value:s},{name:"first token balance",type:"positive-integer",value:o},{name:"second token balance",type:"positive-integer",value:i}]);let u={owner_address:L(a),first_token_id:vt(r),first_token_balance:o,second_token_id:vt(s),second_token_balance:i},l=Te(c);return ge(this.tronWeb,pe.ExchangeCreateContract,u,c?.permissionId,l)}async injectExchangeTokens(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:o},{name:"token amount",type:"integer",value:s,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let c={owner_address:L(i),exchange_id:parseInt(r),token_id:vt(o),quant:parseInt(s)},u=Te(a);return ge(this.tronWeb,pe.ExchangeInjectContract,c,a?.permissionId,u)}async withdrawExchangeTokens(r,o,s,i=this.tronWeb.defaultAddress.hex,a={}){this.validator.notValid([{name:"owner",type:"address",value:i},{name:"token name",type:"not-empty-string",value:o},{name:"token amount",type:"integer",value:s,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let c={owner_address:L(i),exchange_id:parseInt(r),token_id:vt(o),quant:parseInt(s)},u=Te(a);return ge(this.tronWeb,pe.ExchangeWithdrawContract,c,a?.permissionId,u)}async tradeExchangeTokens(r,o,s,i,a=this.tronWeb.defaultAddress.hex,c={}){this.validator.notValid([{name:"owner",type:"address",value:a},{name:"token name",type:"not-empty-string",value:o},{name:"tokenAmountSold",type:"integer",value:s,gte:1},{name:"tokenAmountExpected",type:"integer",value:i,gte:1},{name:"exchangeID",type:"integer",value:r,gte:0}]);let u={owner_address:L(a),exchange_id:parseInt(r),token_id:ie.fromAscii(o).replace(/^0x/,""),quant:parseInt(s),expected:parseInt(i)},l=Te(c);return ge(this.tronWeb,pe.ExchangeTransactionContract,u,c?.permissionId,l)}async updateSetting(r,o,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"owner",type:"address",value:s},{name:"contract",type:"address",value:r},{name:"userFeePercentage",type:"integer",value:o,gte:0,lte:100}]);let a={owner_address:L(s),contract_address:L(r),consume_user_resource_percent:o},c=Te(i);return ge(this.tronWeb,pe.UpdateSettingContract,a,i?.permissionId,c)}async updateEnergyLimit(r,o=0,s=this.tronWeb.defaultAddress.hex,i={}){this.validator.notValid([{name:"owner",type:"address",value:s},{name:"contract",type:"address",value:r},{name:"originEnergyLimit",type:"integer",value:o,gte:0,lte:1e7}]);let a={owner_address:L(s),contract_address:L(r),origin_energy_limit:o},c=Te(i);return ge(this.tronWeb,pe.UpdateEnergyLimitContract,a,i?.permissionId,c)}checkPermissions(r,o){if(r){if(r.type!==o||!r.permission_name||!at(r.permission_name)||!Hr(r.threshold)||r.threshold<1||!r.keys)return!1;for(let s of r.keys)if(!ie.isAddress(s.address)||!Hr(s.weight)||s.weight>r.threshold||s.weight<1||o===2&&!r.operations)return!1}return!0}async updateAccountPermissions(r=this.tronWeb.defaultAddress.hex,o,s,i,a={}){if(!ie.isAddress(r))throw new Error("Invalid ownerAddress provided");if(!this.checkPermissions(o,0))throw new Error("Invalid ownerPermissions provided");if(!this.checkPermissions(s,1))throw new Error("Invalid witnessPermissions provided");Array.isArray(i)||(i=[i]);for(let l of i)if(!this.checkPermissions(l,2))throw new Error("Invalid activesPermissions provided");let c={owner_address:L(r)};if(o){let l=ua(o);"type"in l&&delete l.type,l.keys=l.keys?.map(({address:p,weight:A})=>({address:this.tronWeb.address.toHex(p),weight:A})),c.owner=l}if(s){let l=ua(s);l.type="Witness",l.keys=l.keys.map(({address:p,weight:A})=>({address:this.tronWeb.address.toHex(p),weight:A})),c.witness=l}if(i){let l=ua(i);l.forEach(p=>{p.type="Active"}),l.forEach(p=>{p.keys=p.keys.map(({address:A,weight:g})=>({address:this.tronWeb.address.toHex(A),weight:g}))}),c.actives=l}let u=Te(a);return ge(this.tronWeb,pe.AccountPermissionUpdateContract,c,a?.permissionId,u)}async newTxID(r,o={}){if(o?.txLocal){let s=r.raw_data.contract[0];try{let i=await ge(this.tronWeb,s.type,s.parameter.value,s.Permission_id,{fee_limit:r.raw_data.fee_limit,data:r.raw_data.data,ref_block_bytes:r.raw_data.ref_block_bytes,ref_block_hash:r.raw_data.ref_block_hash,expiration:r.raw_data.expiration,timestamp:r.raw_data.timestamp});return i.signature=r.signature,i.visible=r.visible,i}catch{throw new Error("Error generating a new transaction id.")}}try{let s=await this.tronWeb.fullNode.request("wallet/getsignweight",r,"post");return typeof r.visible=="boolean"&&(s.transaction.transaction.visible=r.visible),BA(s.transaction.transaction,{...r.raw_data.contract[0].parameter.value,Permission_id:r.raw_data.contract[0].Permission_id},{data:r.raw_data.data,fee_limit:r.raw_data.fee_limit})}catch{throw new Error("Error generating a new transaction id.")}}async alterTransaction(r,o={}){if(Reflect.has(r,"signature"))throw new Error("You can not extend the expiration of a signed transaction.");if(o.data){if(o.dataFormat!=="hex"&&(o.data=ie.toHex(o.data)),o.data=o.data.replace(/^0x/,""),o.data.length===0)throw new Error("Invalid data provided");r.raw_data.data=o.data}if(o.extension){if(o.extension=parseInt(o.extension*1e3),isNaN(o.extension)||r.raw_data.expiration+o.extension<=Date.now()+3e3)throw new Error("Invalid extension provided");r.raw_data.expiration+=o.extension}return await this.newTxID(r,{txLocal:o.txLocal})}async extendExpiration(r,o,s={}){return await this.alterTransaction(r,{extension:o,txLocal:s?.txLocal})}async addUpdateData(r,o,s="utf8",i={}){return this.alterTransaction(r,{data:o,dataFormat:s,txLocal:i?.txLocal})}}});function Fn(n){return ie.address.toHex(n)}var MA,RA,co,vu=se(()=>{Cr();kn();Qt();qt();iu();$s();vn();MA=`TRON Signed Message:
|
|
3
|
+
32`,RA=`Ethereum Signed Message:
|
|
4
|
+
32`;co=class n{tronWeb;cache;validator;signMessage;sendAsset;send;sendTrx;broadcast;broadcastHex;signTransaction;constructor(r){this.tronWeb=r,this.cache={contracts:{}},this.validator=new No,this.signMessage=this.sign,this.sendAsset=this.sendToken,this.send=this.sendTransaction,this.sendTrx=this.sendTransaction,this.broadcast=this.sendRawTransaction,this.broadcastHex=this.sendHexTransaction,this.signTransaction=this.sign}_parseToken(r){return{...r,name:this.tronWeb.toUtf8(r.name),abbr:r.abbr&&this.tronWeb.toUtf8(r.abbr),description:r.description&&this.tronWeb.toUtf8(r.description),url:r.url&&this.tronWeb.toUtf8(r.url)}}getCurrentBlock(){return this.tronWeb.fullNode.request("wallet/getnowblock")}getConfirmedCurrentBlock(){return this.tronWeb.solidityNode.request("walletsolidity/getnowblock")}async getBlock(r=this.tronWeb.defaultBlock){if(r===!1)throw new Error("No block identifier provided");return r=="earliest"&&(r=0),r=="latest"?this.getCurrentBlock():isNaN(+r)&&D.isHex(r.toString())?this.getBlockByHash(r):this.getBlockByNumber(r)}async getBlockByHash(r){let o=await this.tronWeb.fullNode.request("wallet/getblockbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Block not found");return o}async getBlockByNumber(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid block number provided");return this.tronWeb.fullNode.request("wallet/getblockbynum",{num:parseInt(r)},"post").then(o=>{if(!Object.keys(o).length)throw new Error("Block not found");return o})}async getBlockTransactionCount(r=this.tronWeb.defaultBlock){let{transactions:o=[]}=await this.getBlock(r);return o.length}async getTransactionFromBlock(r=this.tronWeb.defaultBlock,o){let{transactions:s}=await this.getBlock(r);if(!s)throw new Error("Transaction not found in block");if(o>=0&&o<s.length)return s[o];throw new Error("Invalid transaction index provided")}async getTransactionsFromBlock(r=this.tronWeb.defaultBlock){let{transactions:o}=await this.getBlock(r);if(!o)throw new Error("Transaction not found in block");return o}async getTransaction(r){let o=await this.tronWeb.fullNode.request("wallet/gettransactionbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Transaction not found");return o}async getConfirmedTransaction(r){let o=await this.tronWeb.solidityNode.request("walletsolidity/gettransactionbyid",{value:r},"post");if(!Object.keys(o).length)throw new Error("Transaction not found");return o}getUnconfirmedTransactionInfo(r){return this.tronWeb.fullNode.request("wallet/gettransactioninfobyid",{value:r},"post")}getTransactionInfo(r){return this.tronWeb.solidityNode.request("walletsolidity/gettransactioninfobyid",{value:r},"post")}getTransactionsToAddress(r=this.tronWeb.defaultAddress.hex,o=30,s=0){return this.getTransactionsRelated(this.tronWeb.address.toHex(r),"to",o,s)}getTransactionsFromAddress(r=this.tronWeb.defaultAddress.hex,o=30,s=0){return this.getTransactionsRelated(this.tronWeb.address.toHex(r),"from",o,s)}async getTransactionsRelated(r=this.tronWeb.defaultAddress.hex,o="all",s=30,i=0){if(this.tronWeb.fullnodeSatisfies(">=4.1.1"))throw new Error("This api is not supported any more");if(!["to","from","all"].includes(o))throw new Error('Invalid direction provided: Expected "to", "from" or "all"');if(o=="all"){let[a,c]=await Promise.all([this.getTransactionsRelated(r,"from",s,i),this.getTransactionsRelated(r,"to",s,i)]);return[...a.map(u=>(u.direction="from",u)),...c.map(u=>(u.direction="to",u))].sort((u,l)=>l.raw_data.timestamp-u.raw_data.timestamp)}if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!D.isInteger(s)||s<0||i&&s<1)throw new Error("Invalid limit provided");if(!D.isInteger(i)||i<0)throw new Error("Invalid offset provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.solidityNode.request(`walletextension/gettransactions${o}this`,{account:{address:r},offset:i,limit:s},"post").then(({transaction:a})=>a)}async getAccount(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.solidityNode.request("walletsolidity/getaccount",{address:r},"post")}getAccountById(r){return this.getAccountInfoById(r,{confirmed:!0})}async getAccountInfoById(r,o){return this.validator.notValid([{name:"accountId",type:"hex",value:r},{name:"accountId",type:"string",lte:32,gte:8,value:r}]),r.startsWith("0x")&&(r=r.slice(2)),this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getaccountbyid`,{account_id:r},"post")}async getBalance(r=this.tronWeb.defaultAddress.hex){let{balance:o=0}=await this.getAccount(r);return o}async getUnconfirmedAccount(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getaccount",{address:r},"post")}getUnconfirmedAccountById(r){return this.getAccountInfoById(r,{confirmed:!1})}async getUnconfirmedBalance(r=this.tronWeb.defaultAddress.hex){let{balance:o=0}=await this.getUnconfirmedAccount(r);return o}async getBandwidth(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getaccountnet",{address:r},"post").then(({freeNetUsed:o=0,freeNetLimit:s=0,NetUsed:i=0,NetLimit:a=0})=>s-o+(a-i))}async getTokensIssuedByAddress(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return r=this.tronWeb.address.toHex(r),this.tronWeb.fullNode.request("wallet/getassetissuebyaccount",{address:r},"post").then(({assetIssue:o})=>o?o.map(i=>this._parseToken(i)).reduce((i,a)=>(i[a.name]=a,i),{}):{})}async getTokenFromID(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuebyname",{value:this.tronWeb.fromUtf8(r)},"post").then(o=>{if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}async listNodes(){let{nodes:r=[]}=await this.tronWeb.fullNode.request("wallet/listnodes");return r.map(({address:{host:o,port:s}})=>`${this.tronWeb.toUtf8(o)}:${s}`)}async getBlockRange(r=0,o=30){if(!D.isInteger(r)||r<0)throw new Error("Invalid start of range provided");if(!D.isInteger(o)||o<r)throw new Error("Invalid end of range provided");if(o+1-r>100)throw new Error("Invalid range size, which should be no more than 100.");return this.tronWeb.fullNode.request("wallet/getblockbylimitnext",{startNum:parseInt(r),endNum:parseInt(o)+1},"post").then(({block:s=[]})=>s)}async listSuperRepresentatives(){let{witnesses:r=[]}=await this.tronWeb.fullNode.request("wallet/listwitnesses");return r}async listTokens(r=0,o=0){if(!D.isInteger(r)||r<0||o&&r<1)throw new Error("Invalid limit provided");if(!D.isInteger(o)||o<0)throw new Error("Invalid offset provided");return r?this.tronWeb.fullNode.request("wallet/getpaginatedassetissuelist",{offset:parseInt(o),limit:parseInt(r)},"post").then(({assetIssue:s=[]})=>s.map(i=>this._parseToken(i))):this.tronWeb.fullNode.request("wallet/getassetissuelist").then(({assetIssue:s=[]})=>s.map(i=>this._parseToken(i)))}async timeUntilNextVoteCycle(){let{num:r=-1}=await this.tronWeb.fullNode.request("wallet/getnextmaintenancetime");if(r==-1)throw new Error("Failed to get time until next vote cycle");return Math.floor(r/1e3)}async getContract(r){if(!this.tronWeb.isAddress(r))throw new Error("Invalid contract address provided");if(this.cache.contracts[r])return this.cache.contracts[r];r=this.tronWeb.address.toHex(r);let o=await this.tronWeb.fullNode.request("wallet/getcontract",{value:r});if(o.Error)throw new Error("Contract does not exist");return this.cache.contracts[r]=o,o}ecRecover(r){return n.ecRecover(r)}static ecRecover(r){if(!Ls(r))throw new Error("Invalid transaction");if(!r.signature?.length)throw new Error("Transaction is not signed");if(r.signature.length===1){let o=la(r.txID,r.signature[0]);return ie.address.fromHex(o)}return r.signature.map(o=>{let s=la(r.txID,o);return ie.address.fromHex(s)})}async verifyMessage(r,o,s=this.tronWeb.defaultAddress.base58,i=!0){if(!D.isHex(r))throw new Error("Expected hex message input");if(n.verifySignature(r,s,o,i))return!0;throw new Error("Signature does not match")}static verifySignature(r,o,s,i=!0){r=r.replace(/^0x/,"");let a=[...(0,k.toUtf8Bytes)(i?MA:RA),...D.code.hexStr2byteArray(r)],c=(0,k.keccak256)(new Uint8Array(a)),u=(0,k.recoverAddress)(c,k.Signature.from(`0x${s.replace(/^0x/,"")}`)),l=ht+u.substr(2);return ie.address.fromHex(l)==ie.address.fromHex(o)}async verifyMessageV2(r,o){return n.verifyMessageV2(r,o)}static verifyMessageV2(r,o){return D.message.verifyMessage(r,o)}verifyTypedData(r,o,s,i,a=this.tronWeb.defaultAddress.base58){if(n.verifyTypedData(r,o,s,i,a))return!0;throw new Error("Signature does not match")}static verifyTypedData(r,o,s,i,a){let c=D._TypedDataEncoder.hash(r,o,s),u=(0,k.recoverAddress)(c,k.Signature.from(`0x${i.replace(/^0x/,"")}`)),l=ht+u.substr(2);return ie.address.fromHex(l)==ie.address.fromHex(a)}async sign(r,o=this.tronWeb.defaultPrivateKey,s=!0,i=!1){if(D.isString(r)){if(!D.isHex(r))throw new Error("Expected hex message input");return n.signString(r,o,s)}if(!D.isObject(r))throw new Error("Invalid transaction provided");if(!i&&r.signature)throw new Error("Transaction is already signed");if(!i){if(this.tronWeb.address.toHex(this.tronWeb.address.fromPrivateKey(o)).toLowerCase()!==this.tronWeb.address.toHex(r.raw_data.contract[0].parameter.value.owner_address))throw new Error("Private key does not match address in transaction");if(!Ls(r))throw new Error("Invalid transaction")}return D.crypto.signTransaction(o,r)}static signString(r,o,s=!0){r=r.replace(/^0x/,"");let i=`0x${o.replace(/^0x/,"")}`,a=new k.SigningKey(i),c=[...(0,k.toUtf8Bytes)(s?MA:RA),...D.code.hexStr2byteArray(r)],u=(0,k.keccak256)(new Uint8Array(c)),l=a.sign(u);return["0x",l.r.substring(2),l.s.substring(2),Number(l.v).toString(16)].join("")}signMessageV2(r,o=this.tronWeb.defaultPrivateKey){return n.signMessageV2(r,o)}static signMessageV2(r,o){return D.message.signMessage(r,o)}_signTypedData(r,o,s,i=this.tronWeb.defaultPrivateKey){return n._signTypedData(r,o,s,i)}static _signTypedData(r,o,s,i){return D.crypto._signTypedData(r,o,s,i)}async multiSign(r,o=this.tronWeb.defaultPrivateKey,s=0){if(!D.isObject(r)||!r.raw_data||!r.raw_data.contract)throw new Error("Invalid transaction provided");if(!r.raw_data.contract[0].Permission_id&&s>0){r.raw_data.contract[0].Permission_id=s;let i=this.tronWeb.address.toHex(this.tronWeb.address.fromPrivateKey(o)).toLowerCase(),a=await this.getSignWeight(r,s);if(a.result.code==="PERMISSION_ERROR")throw new Error(a.result.message);let c=!1;if(a.permission.keys.map(u=>{u.address===i&&(c=!0)}),!c)throw new Error(o+" has no permission to sign");if(a.approved_list&&a.approved_list.indexOf(i)!=-1)throw new Error(o+" already sign transaction");if(a.transaction&&a.transaction.transaction)r=a.transaction.transaction,s>0&&(r.raw_data.contract[0].Permission_id=s);else throw new Error("Invalid transaction provided")}if(!Ls(r))throw new Error("Invalid transaction");return D.crypto.signTransaction(o,r)}async getApprovedList(r){if(!D.isObject(r))throw new Error("Invalid transaction provided");return this.tronWeb.fullNode.request("wallet/getapprovedlist",r,"post")}async getSignWeight(r,o){if(!D.isObject(r)||!r.raw_data||!r.raw_data.contract)throw new Error("Invalid transaction provided");return D.isInteger(o)?r.raw_data.contract[0].Permission_id=parseInt(o):typeof r.raw_data.contract[0].Permission_id!="number"&&(r.raw_data.contract[0].Permission_id=0),this.tronWeb.fullNode.request("wallet/getsignweight",r,"post")}async sendRawTransaction(r){if(!D.isObject(r))throw new Error("Invalid transaction provided");if(!r.signature||!D.isArray(r.signature))throw new Error("Transaction is not signed");return{...await this.tronWeb.fullNode.request("wallet/broadcasttransaction",r,"post"),transaction:r}}async sendHexTransaction(r){if(!D.isHex(r))throw new Error("Invalid hex transaction provided");let o={transaction:r},s=await this.tronWeb.fullNode.request("wallet/broadcasthex",o,"post");return s.result?{...s,transaction:JSON.parse(s.transaction),hexTransaction:r}:s}async sendTransaction(r,o,s={}){if(typeof s=="string"&&(s={privateKey:s}),!this.tronWeb.isAddress(r))throw new Error("Invalid recipient provided");if(!D.isInteger(o)||o<=0)throw new Error("Invalid amount provided");if(s={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...s},!s.privateKey&&!s.address)throw new Error("Function requires either a private key or address to be set");let i=s.privateKey?this.tronWeb.address.fromPrivateKey(s.privateKey):s.address,a=await this.tronWeb.transactionBuilder.sendTrx(r,o,i),c=await this.sign(a,s.privateKey);return await this.sendRawTransaction(c)}async sendToken(r,o,s,i={}){if(typeof i=="string"&&(i={privateKey:i}),!this.tronWeb.isAddress(r))throw new Error("Invalid recipient provided");if(!D.isInteger(o)||o<=0)throw new Error("Invalid amount provided");if(D.isInteger(s)&&(s=s.toString()),!D.isString(s))throw new Error("Invalid token ID provided");if(i={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...i},!i.privateKey&&!i.address)throw new Error("Function requires either a private key or address to be set");let a=i.privateKey?this.tronWeb.address.fromPrivateKey(i.privateKey):i.address,c=await this.tronWeb.transactionBuilder.sendToken(r,o,s,a),u=await this.sign(c,i.privateKey);return await this.sendRawTransaction(u)}async freezeBalance(r=0,o=3,s="BANDWIDTH",i={},a){if(typeof i=="string"&&(i={privateKey:i}),!["BANDWIDTH","ENERGY"].includes(s))throw new Error('Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"');if(!D.isInteger(r)||r<=0)throw new Error("Invalid amount provided");if(!D.isInteger(o)||o<3)throw new Error("Invalid duration provided, minimum of 3 days");if(i={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...i},!i.privateKey&&!i.address)throw new Error("Function requires either a private key or address to be set");let c=i.privateKey?this.tronWeb.address.fromPrivateKey(i.privateKey):i.address,u=await this.tronWeb.transactionBuilder.freezeBalance(r,o,s,c,a),l=await this.sign(u,i.privateKey);return await this.sendRawTransaction(l)}async unfreezeBalance(r="BANDWIDTH",o={},s){if(typeof o=="string"&&(o={privateKey:o}),!["BANDWIDTH","ENERGY"].includes(r))throw new Error('Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"');if(o={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...o},!o.privateKey&&!o.address)throw new Error("Function requires either a private key or address to be set");let i=o.privateKey?this.tronWeb.address.fromPrivateKey(o.privateKey):o.address,a=await this.tronWeb.transactionBuilder.unfreezeBalance(r,i,s),c=await this.sign(a,o.privateKey);return await this.sendRawTransaction(c)}async updateAccount(r,o={}){if(typeof o=="string"&&(o={privateKey:o}),!D.isString(r)||!r.length)throw new Error("Name must be a string");if(o={privateKey:this.tronWeb.defaultPrivateKey,address:this.tronWeb.defaultAddress.hex,...o},!o.privateKey&&!o.address)throw Error("Function requires either a private key or address to be set");let s=o.privateKey?this.tronWeb.address.fromPrivateKey(o.privateKey):o.address,i=await this.tronWeb.transactionBuilder.updateAccount(r,s),a=await this.sign(i,o.privateKey);return await this.sendRawTransaction(a)}async getProposal(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid proposalID provided");return this.tronWeb.fullNode.request("wallet/getproposalbyid",{id:parseInt(r)},"post")}async listProposals(){let{proposals:r=[]}=await this.tronWeb.fullNode.request("wallet/listproposals",{},"post");return r}async getChainParameters(){let{chainParameter:r=[]}=await this.tronWeb.fullNode.request("wallet/getchainparameters",{},"post");return r}async getAccountResources(r=this.tronWeb.defaultAddress.hex){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb.fullNode.request("wallet/getaccountresource",{address:this.tronWeb.address.toHex(r)},"post")}async getDelegatedResourceV2(r=this.tronWeb.defaultAddress.hex,o=this.tronWeb.defaultAddress.hex,s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!this.tronWeb.isAddress(o))throw new Error("Invalid address provided");return this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getdelegatedresourcev2`,{fromAddress:Fn(r),toAddress:Fn(o)},"post")}async getDelegatedResourceAccountIndexV2(r=this.tronWeb.defaultAddress.hex,o={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getdelegatedresourceaccountindexv2`,{value:Fn(r)},"post")}async getCanDelegatedMaxSize(r=this.tronWeb.defaultAddress.hex,o="BANDWIDTH",s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.validator.notValid([{name:"resource",type:"resource",value:o,msg:'Invalid resource provided: Expected "BANDWIDTH" or "ENERGY"'}]),this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getcandelegatedmaxsize`,{owner_address:Fn(r),type:o==="ENERGY"?1:0},"post")}async getAvailableUnfreezeCount(r=this.tronWeb.defaultAddress.hex,o={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getavailableunfreezecount`,{owner_address:Fn(r)},"post")}async getCanWithdrawUnfreezeAmount(r=this.tronWeb.defaultAddress.hex,o=Date.now(),s={confirmed:!0}){if(!this.tronWeb.isAddress(r))throw new Error("Invalid address provided");if(!D.isInteger(o)||o<0)throw new Error("Invalid timestamp provided");return this.tronWeb[s.confirmed?"solidityNode":"fullNode"].request(`wallet${s.confirmed?"solidity":""}/getcanwithdrawunfreezeamount`,{owner_address:Fn(r),timestamp:o},"post")}async getExchangeByID(r){if(!D.isInteger(r)||r<0)throw new Error("Invalid exchangeID provided");return this.tronWeb.fullNode.request("wallet/getexchangebyid",{id:r},"post")}async listExchanges(){return this.tronWeb.fullNode.request("wallet/listexchanges",{},"post").then(({exchanges:r=[]})=>r)}async listExchangesPaginated(r=10,o=0){return this.tronWeb.fullNode.request("wallet/getpaginatedexchangelist",{limit:r,offset:o},"post").then(({exchanges:s=[]})=>s)}async getNodeInfo(){return this.tronWeb.fullNode.request("wallet/getnodeinfo",{},"post")}async getTokenListByName(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuelistbyname",{value:this.tronWeb.fromUtf8(r)},"post").then(o=>{if(Array.isArray(o.assetIssue))return o.assetIssue.map(s=>this._parseToken(s));if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}getTokenByID(r){if(D.isInteger(r)&&(r=r.toString()),!D.isString(r)||!r.length)throw new Error("Invalid token ID provided");return this.tronWeb.fullNode.request("wallet/getassetissuebyid",{value:r},"post").then(o=>{if(!o.name)throw new Error("Token does not exist");return this._parseToken(o)})}async getReward(r,o={}){return o.confirmed=!0,this._getReward(r,o)}async getUnconfirmedReward(r,o={}){return o.confirmed=!1,this._getReward(r,o)}async getBrokerage(r,o={}){return o.confirmed=!0,this._getBrokerage(r,o)}async getUnconfirmedBrokerage(r,o={}){return o.confirmed=!1,this._getBrokerage(r,o)}async _getReward(r=this.tronWeb.defaultAddress.hex,o){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={address:Fn(r)};return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getReward`,s,"post").then((i={reward:void 0})=>{if(typeof i.reward>"u")throw new Error("Not found.");return i.reward})}async _getBrokerage(r=this.tronWeb.defaultAddress.hex,o){this.validator.notValid([{name:"origin",type:"address",value:r}]);let s={address:Fn(r)};return this.tronWeb[o.confirmed?"solidityNode":"fullNode"].request(`wallet${o.confirmed?"solidity":""}/getBrokerage`,s,"post").then((i={})=>{if(typeof i.brokerage>"u")throw new Error("Not found.");return i.brokerage})}async getBandwidthPrices(){return this.tronWeb.fullNode.request("wallet/getbandwidthprices",{},"post").then((r={})=>{if(typeof r.prices>"u")throw new Error("Not found.");return r.prices})}async getEnergyPrices(){return this.tronWeb.fullNode.request("wallet/getenergyprices",{},"post").then((r={})=>{if(typeof r.prices>"u")throw new Error("Not found.");return r.prices})}}});var Ry,Iu,On,Mu=se(()=>{kn();Rs();vn();Ry=n=>{if("stateMutability"in n&&(n.stateMutability=n.stateMutability?n.stateMutability.toLowerCase():"nonpayable"),n.type=n.type?n.type.toLowerCase():"",n.type==="fallback"||n.type==="receive")return"0x";let r=new D.ethersUtils.Interface([n]),o;if(n.type==="event"?o=r.getEvent(n.name):o=r.getFunction(n.name),o)return o.format("sighash");throw new Error("unknown function")},Iu=(n,r)=>ou(n,r),On=class{tronWeb;contract;abi;name;inputs;outputs;functionSelector;signature;defaultOptions;constructor(r,o){this.tronWeb=r.tronWeb,this.contract=r,this.abi=o,this.name=o.name||o.type,this.inputs=o.inputs||[],this.outputs=[],"outputs"in o&&o.outputs&&(this.outputs=o.outputs),this.functionSelector=Ry(o),this.signature=Ru(this.functionSelector,!1).slice(0,8),this.defaultOptions={feeLimit:this.tronWeb.feeLimit,callValue:0,userFeePercentage:100,shouldPollResponse:!1}}decodeInput(r){let o=JSON.parse(JSON.stringify(this.abi));return o.outputs=o.inputs,Iu(o,"0x"+r)}onMethod(...r){let o="";return this.abi&&!/event/i.test(this.abi.type)&&(o=Do(this.abi,r)),{call:async(s={})=>(s={...s,rawParameter:o},await this._call([],[],s)),send:async(s={},i=this.tronWeb.defaultPrivateKey)=>(s={...s,rawParameter:o},await this._send([],[],s,i))}}async _call(r,o,s={}){if(r.length!==o.length)throw new Error("Invalid argument count provided");if(!this.contract.address)throw new Error("Smart contract is missing address");if(!this.contract.deployed)throw new Error("Calling smart contracts requires you to load the contract first");if("stateMutability"in this.abi){let{stateMutability:l}=this.abi;if(l&&!["pure","view"].includes(l.toLowerCase()))throw new Error(`Methods with state mutability "${l}" must use send()`)}s={...this.defaultOptions,from:this.tronWeb.defaultAddress.hex,...s,_isConstant:!0};let i=o.map((l,p)=>({type:r[p],value:l})),a=await this.tronWeb.transactionBuilder.triggerSmartContract(this.contract.address,this.functionSelector,s,i,s.from?this.tronWeb.address.toHex(s.from):void 0);if(!D.hasProperty(a,"constant_result"))throw new Error("Failed to execute");let c=a.constant_result[0].length;if(c===0||c%64===8){let l="The call has been reverted or has thrown an error.";if(c!==0){l+=" Error message: ";let p="",A=a.constant_result[0].substring(8);for(let g=0;g<c-8;g+=64)p+=this.tronWeb.toUtf8(A.substring(g,g+64));l+=p.replace(/(\u0000|\u000b|\f)+/g," ").replace(/ +/g," ").replace(/\s+$/g,"")}throw new Error(l)}let u=Iu(this.abi,"0x"+a.constant_result[0]);return u.length===1&&Object.keys(u).length===1&&(u=u[0]),u}async _send(r,o,s={},i=this.tronWeb.defaultPrivateKey){if(r.length!==o.length)throw new Error("Invalid argument count provided");if(!this.contract.address)throw new Error("Smart contract is missing address");if(!this.contract.deployed)throw new Error("Calling smart contracts requires you to load the contract first");let{stateMutability:a}=this.abi;if(["pure","view"].includes(a.toLowerCase()))throw new Error(`Methods with state mutability "${a}" must use call()`);["payable"].includes(a.toLowerCase())||(s.callValue=0),s={...this.defaultOptions,from:this.tronWeb.defaultAddress.hex,...s};let c=o.map((P,b)=>({type:r[b],value:P})),u=i?this.tronWeb.address.fromPrivateKey(i):this.tronWeb.defaultAddress.base58,l=await this.tronWeb.transactionBuilder.triggerSmartContract(this.contract.address,this.functionSelector,s,c,this.tronWeb.address.toHex(u));if(!l.result||!l.result.result)throw new Error("Unknown error: "+JSON.stringify(l,null,2));let p=await this.tronWeb.trx.sign(l.transaction,i);if(!p.signature)throw i?new Error("Invalid private key provided"):new Error("Transaction was not signed properly");let A=await this.tronWeb.trx.sendRawTransaction(p);if(A.code){let P={error:A.code,message:A.code};A.message&&(P.message=this.tronWeb.toUtf8(A.message));let b=new Error(P.message);throw b.error=A.code,b}if(!s.shouldPollResponse)return p.txID;let g=async P=>{if(P===(s.pollTimes||20)){let I=new Error("Cannot find result in solidity node");throw I.error="Cannot find result in solidity node",I.transaction=p,I}let b=await this.tronWeb.trx.getTransactionInfo(p.txID);if(!Object.keys(b).length)return await new Promise(I=>setTimeout(I,3e3)),g(P+1);if(b.result&&b.result==="FAILED"){let I=new Error(this.tronWeb.toUtf8(b.resMessage));throw I.error=this.tronWeb.toUtf8(b.resMessage),I.transaction=p,I.output=b,I}if(!D.hasProperty(b,"contractResult")){let I=new Error("Failed to execute: "+JSON.stringify(b,null,2));throw I.error="Failed to execute: "+JSON.stringify(b,null,2),I.transaction=p,I.output=b,I}if(s.rawResponse)return b;let S=Iu(this.abi,"0x"+b.contractResult[0]);return S.length===1&&Object.keys(S).length===1&&(S=S[0]),s.keepTxID?[p.txID,S]:S};return g(0)}}});var uo,Fu=se(()=>{Cr();kn();Mu();Mu();uo=class{tronWeb;abi;address;eventListener;bytecode;deployed;lastBlock;methods;methodInstances;props;constructor(r,o=[],s){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.address=s,this.abi=o,this.eventListener=!1,this.bytecode=!1,this.deployed=!1,this.lastBlock=!1,this.methods={},this.methodInstances={},this.props=[],D.address.isAddress(s)?this.deployed=!0:this.address=!1,this.loadAbi(o)}hasProperty(r){return this.hasOwnProperty(r)||this.__proto__.hasOwnProperty(r)}loadAbi(r){this.abi=r,this.methods={},this.props.forEach(o=>delete this[o]),r.forEach(o=>{if(!o.type||/constructor|error/i.test(o.type))return;let s=new On(this,o),i=s.onMethod.bind(s),{name:a,functionSelector:c,signature:u}=s;this.methods[a]=i,this.methods[c]=i,this.methods[u]=i,this.methodInstances[a]=s,this.methodInstances[c]=s,this.methodInstances[u]=s,this.hasProperty(a)||(this[a]=i,this.props.push(a)),this.hasProperty(c)||(this[c]=i,this.props.push(c)),this.hasProperty(u)||(this[u]=i,this.props.push(u))})}decodeInput(r){let o=r.substring(0,8),s=r.substring(8);if(!this.methodInstances[o])throw new Error("Contract method "+o+" not found");return{name:this.methodInstances[o].name,params:this.methodInstances[o].decodeInput(s)}}async new(r,o=this.tronWeb.defaultPrivateKey){let s=this.tronWeb.address.fromPrivateKey(o),i=await this.tronWeb.transactionBuilder.createSmartContract(r,s),a=await this.tronWeb.trx.sign(i,o),c=await this.tronWeb.trx.sendRawTransaction(a);if(c.code)throw{error:c.code,message:this.tronWeb.toUtf8(c.message)};return await D.sleep(3e3),this.at(a.contract_address)}async at(r){try{let o=await this.tronWeb.trx.getContract(r);if(!o.contract_address)throw new Error("Unknown error: "+JSON.stringify(o,null,2));return this.address=o.contract_address,this.bytecode=o.bytecode,this.deployed=!0,this.loadAbi(o.abi?o.abi.entrys?o.abi.entrys:[]:[]),this}catch(o){throw o.toString().includes("does not exist")?new Error("Contract has not been deployed on the network"):new Error(o)}}}});var FA,lo,ku=se(()=>{Cr();kn();FA=be(require("semver"),1),lo=class{tronWeb;pluginNoOverride;disablePlugins;constructor(r,o={}){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r,this.pluginNoOverride=["register"],this.disablePlugins=!!o.disablePlugins}register(r,o){let s={requires:"0.0.0",components:{}},i={libs:[],plugged:[],skipped:[],error:void 0};if(this.disablePlugins)return i.error="This instance of TronWeb has plugins disabled.",i;let a=new r(this.tronWeb);if(D.isFunction(a.pluginInterface)&&(s=a.pluginInterface(o)),FA.default.satisfies(ie.version,s.requires))if(s.fullClass){let c=a.constructor.name,u=c.substring(0,1).toLowerCase()+c.substring(1);c!==u&&(Object.assign(ie,{[c]:r}),Object.assign(this.tronWeb,{[u]:a}),i.libs.push(c))}else for(let c in s.components){if(!this.tronWeb.hasOwnProperty(c))continue;let u=s.components[c],l=this.tronWeb[c].pluginNoOverride||[];for(let p in u){if(p==="constructor"||this.tronWeb[c][p]&&(l.includes(p)||/^_/.test(p))){i.skipped.push(p);continue}this.tronWeb[c][p]=u[p].bind(this.tronWeb[c]),i.plugged.push(p)}}else throw new Error("The plugin is not compatible with this version of TronWeb");return i}}});var po,Ou=se(()=>{Cr();kn();Li();po=class{tronWeb;constructor(r){if(!r||!(r instanceof ie))throw new Error("Expected instance of TronWeb");this.tronWeb=r}setServer(r,o="healthcheck"){if(!r)return this.tronWeb.eventServer=void 0;if(D.isString(r)&&(r=new ro(r)),!this.tronWeb.isValidProvider(r))throw new Error("Invalid event server provided");this.tronWeb.eventServer=r,this.tronWeb.eventServer.isConnected=()=>this.tronWeb.eventServer.request(o).then(()=>!0).catch(()=>!1)}async getEventsByContractAddress(r,o={}){let s=Object.assign({limit:20},o),{eventName:i,blockNumber:a,onlyUnconfirmed:c,onlyConfirmed:u,minBlockTimestamp:l,maxBlockTimestamp:p,orderBy:A,fingerprint:g}=s,{limit:P}=s;if(!this.tronWeb.eventServer)throw new Error("No event server configured");if(!this.tronWeb.isAddress(r))throw new Error("Invalid contract address provided");if(typeof l<"u"&&!D.isInteger(l))throw new Error("Invalid minBlockTimestamp provided");if(typeof p<"u"&&!D.isInteger(p))throw new Error("Invalid maxBlockTimestamp provided");D.isInteger(P)&&P>200&&(console.warn("Defaulting to maximum accepted limit: 200"),P=200);let b={};i&&(b.event_name=i),a&&(b.block_number=a),typeof c=="boolean"&&(b.only_unconfirmed=c),typeof u=="boolean"&&(b.only_confirmed=u),l&&(b.min_block_timestamp=l),p&&(b.max_block_timestamp=p),A&&(b.order_by=A),g&&(b.fingerprint=g),D.isInteger(P)&&(b.limit=P);let S=await this.tronWeb.eventServer.request(`v1/contracts/${this.tronWeb.address.fromHex(r)}/events?${new URLSearchParams(b).toString()}`);if(S.success)return S;throw new Error(S.error)}async getEventsByTransactionID(r,o={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let s={};return typeof o.only_unconfirmed=="boolean"&&(s.only_unconfirmed=o.only_unconfirmed),typeof o.only_confirmed=="boolean"&&(s.only_confirmed=o.only_confirmed),this.tronWeb.eventServer.request(`v1/transactions/${r}/events?${new URLSearchParams(s).toString()}`).then(i=>{if(i.success)return i;throw new Error(JSON.parse(i.error).message)})}async getEventsByBlockNumber(r,o={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let s={};return typeof o.only_confirmed=="boolean"&&(s.only_confirmed=o.only_confirmed),o.limit&&(s.limit=o.limit),o.fingerprint&&(s.fingerprint=o.fingerprint),this.tronWeb.eventServer.request(`v1/blocks/${r}/events?${new URLSearchParams(s).toString()}`).then(i=>{if(i.success)return i;throw new Error(i.error)})}async getEventsOfLatestBlock(r={}){if(!this.tronWeb.eventServer)throw new Error("No event server configured");let o={};return typeof r.only_confirmed=="boolean"&&(o.only_confirmed=r.only_confirmed),this.tronWeb.eventServer.request(`v1/blocks/latest/events?${new URLSearchParams(o).toString()}`).then(s=>{if(s.success)return s;throw new Error(s.error)})}}});function OA(n){return!!n&&typeof n=="object"&&(!!n.fullNode||!!n.fullHost)}var da,EA,xA,kA,Fy,ky,ie,ca,Cr=se(()=>{Li();kn();da=require("bignumber.js"),EA=be(require("eventemitter3"),1),xA=be(require("semver"),1);Su();vu();Fu();ku();Ou();Qt();qt();an();kA="4.7.1",Fy=15e7,ky="6.0.3";ie=class n extends EA.default{providers;BigNumber;transactionBuilder;trx;plugin;event;version;static version=ky;utils;defaultBlock;defaultPrivateKey;defaultAddress;fullnodeVersion;feeLimit;fullNode;solidityNode;eventServer;constructor(r,o="",s,i=""){super();let a,c=!1,u=!1;OA(r)?(a=r.fullNode||r.fullHost,o=r.solidityNode||r.fullHost,s=r.eventServer||r.fullHost,c=r.headers||!1,u=r.eventHeaders||c,i=r.privateKey):a=r,D.isString(a)&&(a=new bt.HttpProvider(a)),D.isString(o)&&(o=new bt.HttpProvider(o)),D.isString(s)&&(s=new bt.HttpProvider(s)),this.event=new po(this),this.transactionBuilder=new ao(this),this.trx=new co(this),this.plugin=new lo(this,{disablePlugins:OA(r)?r.disablePlugins:!1}),this.utils=D,this.setFullNode(a),this.setSolidityNode(o),this.setEventServer(s),this.providers=bt,this.BigNumber=da.BigNumber,this.defaultBlock=!1,this.defaultPrivateKey=!1,this.defaultAddress={hex:!1,base58:!1},this.version=n.version,this.sha3=n.sha3,this.fromUtf8=n.fromUtf8,this.address=n.address,this.toAscii=n.toAscii,this.toUtf8=n.toUtf8,this.isAddress=n.isAddress,this.fromAscii=n.fromAscii,this.toHex=n.toHex,this.toBigNumber=n.toBigNumber,this.toDecimal=n.toDecimal,this.fromDecimal=n.fromDecimal,this.toSun=n.toSun,this.fromSun=n.fromSun,this.createAccount=n.createAccount,this.createRandom=n.createRandom,this.fromMnemonic=n.fromMnemonic,i&&this.setPrivateKey(i),this.fullnodeVersion=kA,this.feeLimit=Fy,c&&this.setFullNodeHeader(c),u&&this.setEventHeader(u)}async getFullnodeVersion(){try{let r=await this.trx.getNodeInfo();this.fullnodeVersion=r.configNodeInfo.codeVersion,this.fullnodeVersion.split(".").length===2&&(this.fullnodeVersion+=".0")}catch{this.fullnodeVersion=kA}}setDefaultBlock(r=!1){if([!1,"latest","earliest",0].includes(r))return this.defaultBlock=r;if(!D.isInteger(r)||!r)throw new Error("Invalid block ID provided");return this.defaultBlock=Math.abs(r)}setPrivateKey(r){try{this.setAddress(n.address.fromPrivateKey(r))}catch{throw new Error("Invalid private key provided")}this.defaultPrivateKey=r,this.emit("privateKeyChanged",r)}setAddress(r){if(!n.isAddress(r))throw new Error("Invalid address provided");let o=n.address.toHex(r),s=n.address.fromHex(r);this.defaultPrivateKey&&n.address.fromPrivateKey(this.defaultPrivateKey)!==s&&(this.defaultPrivateKey=!1),this.defaultAddress={hex:o,base58:s},this.emit("addressChanged",{hex:o,base58:s})}fullnodeSatisfies(r){return xA.default.satisfies(this.fullnodeVersion,r)}isValidProvider(r){return Object.values(bt).some(o=>r instanceof o)}setFullNode(r){if(at(r)&&(r=new bt.HttpProvider(r)),!this.isValidProvider(r))throw new Error("Invalid full node provided");this.fullNode=r,this.fullNode.setStatusPage("wallet/getnowblock")}setSolidityNode(r){if(D.isString(r)&&(r=new bt.HttpProvider(r)),!this.isValidProvider(r))throw new Error("Invalid solidity node provided");this.solidityNode=r,this.solidityNode.setStatusPage("walletsolidity/getnowblock")}setEventServer(r,o){this.event.setServer(r,o)}setHeader(r={}){let o=new bt.HttpProvider(this.fullNode.host,3e4,"","",r),s=new bt.HttpProvider(this.solidityNode.host,3e4,"","",r),i=new bt.HttpProvider(this.eventServer.host,3e4,"","",r);this.setFullNode(o),this.setSolidityNode(s),this.setEventServer(i)}setFullNodeHeader(r={}){let o=new bt.HttpProvider(this.fullNode.host,3e4,"","",r),s=new bt.HttpProvider(this.solidityNode.host,3e4,"","",r);this.setFullNode(o),this.setSolidityNode(s)}setEventHeader(r={}){let o=new bt.HttpProvider(this.eventServer.host,3e4,"","",r);this.setEventServer(o)}currentProviders(){return{fullNode:this.fullNode,solidityNode:this.solidityNode,eventServer:this.eventServer}}currentProvider(){return this.currentProviders()}getEventResult(...r){return this.event.getEventsByContractAddress(...r)}getEventByTransactionID(...r){return this.event.getEventsByTransactionID(...r)}contract(r=[],o){return new uo(this,r,o)}address;static get address(){return{fromHex(r){return Hc(r)},toHex(r){return L(r)},toChecksumAddress(r){return Vi(r)},isChecksumAddress(r){return Kc(r)},fromPrivateKey(r,o=!1){return Xc(r,o)}}}sha3;static sha3(r,o=!0){return(o?"0x":"")+(0,k.keccak256)(Buffer.from(r,"utf-8")).toString().substring(2)}toHex;static toHex(r){if(D.isBoolean(r))return n.fromDecimal(+r);if(D.isBigNumber(r))return n.fromDecimal(r);if(typeof r=="object")return n.fromUtf8(JSON.stringify(r));if(D.isString(r)){if(/^(-|)0x/.test(r))return r;if(!isFinite(r)||/^\s*$/.test(r))return n.fromUtf8(r)}let o=n.fromDecimal(r);if(o==="0xNaN")throw new Error("The passed value is not convertible to a hex string");return o}toUtf8;static toUtf8(r){if(D.isHex(r))return r=r.replace(/^0x/,""),Buffer.from(r,"hex").toString("utf8");throw new Error("The passed value is not a valid hex string")}fromUtf8;static fromUtf8(r){if(!D.isString(r))throw new Error("The passed value is not a valid utf-8 string");return"0x"+Buffer.from(r,"utf8").toString("hex")}toAscii;static toAscii(r){if(D.isHex(r)){let o="",s=0,i=r.length;for(r.substring(0,2)==="0x"&&(s=2);s<i;s+=2){let a=parseInt(r.substr(s,2),16);o+=String.fromCharCode(a)}return o}else throw new Error("The passed value is not a valid hex string")}fromAscii;static fromAscii(r,o){if(!D.isString(r))throw new Error("The passed value is not a valid utf-8 string");return"0x"+Buffer.from(r,"ascii").toString("hex").padEnd(o,"0")}toDecimal;static toDecimal(r){return n.toBigNumber(r).toNumber()}fromDecimal;static fromDecimal(r){let o=n.toBigNumber(r),s=o.toString(16);return o.isLessThan(0)?"-0x"+s.substr(1):"0x"+s}fromSun;static fromSun(r){let o=n.toBigNumber(r).div(1e6);return D.isBigNumber(r)?o:o.toString(10)}toSun;static toSun(r){let o=n.toBigNumber(r).times(1e6);return D.isBigNumber(r)?o:o.toString(10)}toBigNumber;static toBigNumber(r=0){return D.isBigNumber(r)?r:D.isString(r)&&/^(-|)0x/.test(r)?new da.BigNumber(r.replace("0x",""),16):new da.BigNumber(r.toString(10),10)}isAddress;static isAddress(r=""){return to(r)}createAccount;static async createAccount(){return D.accounts.generateAccount()}createRandom;static createRandom(...r){return D.accounts.generateRandom(...r)}fromMnemonic;static fromMnemonic(...r){return D.accounts.generateAccountWithMnemonic(...r)}async isConnected(){return{fullNode:await this.fullNode.isConnected(),solidityNode:await this.solidityNode.isConnected(),eventServer:this.eventServer&&await this.eventServer.isConnected()}}},ca=ie});function Oy(n){return ie.address.toHex(n).replace(ln,"0x")}function Ey(n){return ie.address.toHex(n)}function Ny(n){let r=(0,_.getBytes)(n),o=r.length%32;return o?(0,_.concat)([r,_A.slice(o)]):(0,_.hexlify)(r)}function NA(n){return function(r){return(0,_.assertArgument)(typeof r=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,r),r}}function pa(n){{let r=n.match(/^(u?)int(\d*)$/);if(r){let o=r[1]==="",s=parseInt(r[2]||"256");(0,_.assertArgument)(s%8===0&&s!==0&&s<=256&&(r[2]==null||r[2]===String(s)),"invalid numeric width","type",n);let i=(0,_.mask)(Dy,o?s-1:s),a=o?(i+zA)*xy:jA;return function(c){let u=(0,_.getBigInt)(c,"value");return(0,_.assertArgument)(u>=a&&u<=i,`value out-of-bounds for ${n}`,"value",u),(0,_.toBeHex)(o?(0,_.toTwos)(u,256):u,32)}}}{let r=n.match(/^bytes(\d+)$/);if(r){let o=parseInt(r[1]);return(0,_.assertArgument)(o!==0&&o<=32&&r[1]===String(o),"invalid bytes width","type",n),function(s){let i=(0,_.getBytes)(s);return(0,_.assertArgument)(i.length===o,`invalid length for ${n}`,"value",s),Ny(s)}}}switch(n){case"trcToken":return pa("uint256");case"address":return function(r){return(0,_.zeroPadValue)(Oy(r),32)};case"bool":return function(r){return r?Uy:_y};case"bytes":return function(r){return(0,_.keccak256)(r)};case"string":return function(r){return(0,_.id)(r)}}return null}function UA(n,r){return`${n}(${r.map(({name:o,type:s})=>s+" "+o).join(",")})`}var _,_A,xy,jA,zA,Dy,Uy,_y,DA,Eu,jy,Ko,Aa=se(()=>{Cr();_=require("ethers");qt();_A=new Uint8Array(32);_A.fill(0);xy=BigInt(-1),jA=BigInt(0),zA=BigInt(1),Dy=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");Uy=(0,_.toBeHex)(zA,32),_y=(0,_.toBeHex)(jA,32),DA={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Eu=["name","version","chainId","verifyingContract","salt"];jy={name:NA("name"),version:NA("version"),chainId:function(n){let r=(0,_.getBigInt)(n,"domain.chainId");return(0,_.assertArgument)(r>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(r)?Number(r):(0,_.toQuantity)(r)},verifyingContract:function(n){try{return Ey(n).toLowerCase()}catch{}(0,_.assertArgument)(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){let r=(0,_.getBytes)(n,"domain.salt");return(0,_.assertArgument)(r.length===32,'invalid domain value "salt"',"domain.salt",n),(0,_.hexlify)(r)}};Ko=class n{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(r){this.#e=JSON.stringify(r),this.#t=new Map,this.#n=new Map;let o=new Map,s=new Map,i=new Map;Object.keys(r).forEach(u=>{o.set(u,new Set),s.set(u,[]),i.set(u,new Set)});for(let u in r){let l=new Set;for(let p of r[u]){(0,_.assertArgument)(!l.has(p.name),`duplicate variable name ${JSON.stringify(p.name)} in ${JSON.stringify(u)}`,"types",r),l.add(p.name);let A=p.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;(0,_.assertArgument)(A!==u,`circular type reference to ${JSON.stringify(A)}`,"types",r),!pa(A)&&((0,_.assertArgument)(s.has(A),`unknown type ${JSON.stringify(A)}`,"types",r),s.get(A).push(u),o.get(u).add(A))}}let a=Array.from(s.keys()).filter(u=>s.get(u).length===0);(0,_.assertArgument)(a.length!==0,"missing primary type","types",r),(0,_.assertArgument)(a.length===1,`ambiguous primary types or unused types: ${a.map(u=>JSON.stringify(u)).join(", ")}`,"types",r),(0,_.defineProperties)(this,{primaryType:a[0]});function c(u,l){(0,_.assertArgument)(!l.has(u),`circular type reference to ${JSON.stringify(u)}`,"types",r),l.add(u);for(let p of o.get(u))if(s.has(p)){c(p,l);for(let A of l)i.get(A).add(p)}l.delete(u)}c(this.primaryType,new Set);for(let[u,l]of i){let p=Array.from(l);p.sort(),this.#t.set(u,UA(u,r[u])+p.map(A=>UA(A,r[A])).join(""))}}getEncoder(r){let o=this.#n.get(r);return o||(o=this.#r(r),this.#n.set(r,o)),o}#r(r){{let i=pa(r);if(i)return i}let o=r.match(/^(.*)(\x5b(\d*)\x5d)$/);if(o){let i=o[1],a=this.getEncoder(i);return c=>{(0,_.assertArgument)(!o[3]||parseInt(o[3])===c.length,`array length mismatch; expected length ${parseInt(o[3])}`,"value",c);let u=c.map(a);return this.#t.has(i)&&(u=u.map(_.keccak256)),(0,_.keccak256)((0,_.concat)(u))}}let s=this.types[r];if(s){let i=(0,_.id)(this.#t.get(r));return a=>{let c=s.map(({name:u,type:l})=>{let p=this.getEncoder(l)(a[u]);return this.#t.has(l)?(0,_.keccak256)(p):p});return c.unshift(i),(0,_.concat)(c)}}(0,_.assertArgument)(!1,`unknown type: ${r}`,"type",r)}encodeType(r){let o=this.#t.get(r);return(0,_.assertArgument)(o,`unknown type: ${JSON.stringify(r)}`,"name",r),o}encodeData(r,o){return this.getEncoder(r)(o)}hashStruct(r,o){return(0,_.keccak256)(this.encodeData(r,o))}encode(r){return this.encodeData(this.primaryType,r)}hash(r){return this.hashStruct(this.primaryType,r)}_visit(r,o,s){if(pa(r))return s(r,o);let i=r.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i)return(0,_.assertArgument)(!i[3]||parseInt(i[3])===o.length,`array length mismatch; expected length ${parseInt(i[3])}`,"value",o),o.map(c=>this._visit(i[1],c,s));let a=this.types[r];if(a)return a.reduce((c,{name:u,type:l})=>(c[u]=this._visit(l,o[u],s),c),{});(0,_.assertArgument)(!1,`unknown type: ${r}`,"type",r)}visit(r,o){return this._visit(this.primaryType,r,o)}static from(r){return new n(r)}static getPrimaryType(r){return n.from(r).primaryType}static hashStruct(r,o,s){return n.from(o).hashStruct(r,s)}static hashDomain(r){let o=[];for(let s in r){if(r[s]==null)continue;let i=DA[s];(0,_.assertArgument)(i,`invalid typed-data domain key: ${JSON.stringify(s)}`,"domain",r),o.push({name:s,type:i})}return o.sort((s,i)=>Eu.indexOf(s.name)-Eu.indexOf(i.name)),n.hashStruct("EIP712Domain",{EIP712Domain:o},r)}static encode(r,o,s){return(0,_.concat)(["0x1901",n.hashDomain(r),n.from(o).hash(s)])}static hash(r,o,s){return(0,_.keccak256)(n.encode(r,o,s))}static async resolveNames(r,o,s,i){r=Object.assign({},r);for(let u in r)r[u]==null&&delete r[u];let a={};r.verifyingContract&&!(0,_.isHexString)(r.verifyingContract,20)&&(a[r.verifyingContract]="0x");let c=n.from(o);c.visit(s,(u,l)=>(u==="address"&&!(0,_.isHexString)(l,20)&&(a[l]="0x"),l));for(let u in a)a[u]=await i(u);return r.verifyingContract&&a[r.verifyingContract]&&(r.verifyingContract=a[r.verifyingContract]),s=c.visit(s,(u,l)=>u==="address"&&a[l]?a[l]:l),{domain:r,value:s}}static getPayload(r,o,s){n.hashDomain(r);let i={},a=[];Eu.forEach(l=>{let p=r[l];p!=null&&(i[l]=jy[l](p),a.push({name:l,type:DA[l]}))});let c=n.from(o),u=Object.assign({},o);return(0,_.assertArgument)(u.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",o),u.EIP712Domain=a,c.encode(s),{types:u,domain:i,primaryType:c.primaryType,message:c.visit(s,(l,p)=>{if(l.match(/^bytes(\d*)/))return(0,_.hexlify)((0,_.getBytes)(p));if(l.match(/^u?int/))return(0,_.getBigInt)(p).toString();switch(l){case"trcToken":return(0,_.getBigInt)(p).toString();case"address":return p.toLowerCase();case"bool":return!!p;case"string":return(0,_.assertArgument)(typeof p=="string","invalid string","value",p),p}(0,_.assertArgument)(!1,"unsupported type","type",l)})}}}});var Nu={};Gt(Nu,{ECKeySign:()=>Du,SHA256:()=>Xr,_signTypedData:()=>$y,arrayToBase64String:()=>Gy,computeAddress:()=>Zs,decode58Check:()=>Jy,decodeBase58Address:()=>qc,ecRecover:()=>la,genPriKey:()=>xu,getAddressFromPriKey:()=>Js,getAddressFromPriKeyBase64String:()=>Xy,getBase58CheckAddress:()=>wr,getBase58CheckAddressFromPriKeyBase64String:()=>Hy,getHexStrAddressFromPriKeyBase64String:()=>Ky,getPubKeyFromPriKey:()=>Ao,getRowBytesFromTransactionBase64:()=>Zy,isAddressValid:()=>Qc,passwordToAddress:()=>Yy,pkToAddress:()=>xo,sha3:()=>Ru,signBytes:()=>Ly,signTransaction:()=>Vy});function zy(n){return it(Ae(n).padStart(64,"0"))}function wr(n){let r=Xr(n),s=Xr(r).slice(0,4);return s=n.concat(s),ru(s)}function qc(n){if(typeof n!="string"||n.length<=4)return!1;let r=Is(n);if(n.length<=4)return!1;let s=r.length-4,i=r.slice(s);r=r.slice(0,s);let a=Xr(r),u=Xr(a).slice(0,4);if(i[0]==u[0]&&i[1]==u[1]&&i[2]==u[2]&&i[3]==u[3])return r;throw new Error("Invalid address provided")}function Vy(n,r){typeof n=="string"&&(n=it(n));let o=r.txID,s=Du(it(o),n);return Array.isArray(r.signature)?r.signature.includes(s)||r.signature.push(s):r.signature=[s],r}function la(n,r){n="0x"+n.replace(/^0x/,""),r="0x"+r.replace(/^0x/,"");let o=(0,k.recoverAddress)(Lc(n),k.Signature.from(r));return ht+o.substring(2)}function Gy(n){return btoa(String.fromCharCode(...n))}function Ly(n,r){typeof n=="string"&&(n=it(n));let o=Xr(r);return Du(o,n)}function $y(n,r,o,s){let i=`0x${s.replace(/^0x/,"")}`,a=new k.SigningKey(i),c=Ko.hash(n,r,o),u=a.sign(c);return["0x",u.r.substring(2),u.s.substring(2),Number(u.v).toString(16)].join("")}function Zy(n){let r=sn(n);return globalThis.proto.protocol.Transaction.deserializeBinary(r).getRawData().serializeBinary()}function xu(){let n=fa.secp256k1.utils.randomPrivateKey(),r=Ae(n);return r=r.padStart(64,"0"),it(r)}function Zs(n){n.length===65&&(n=n.slice(1));let r=(0,k.keccak256)(new Uint8Array(n)).toString().substring(2),o=ht+r.substring(24);return it(o)}function Js(n){let r=Ao(n);return Zs(r)}function Jy(n){let r=Is(n);if(r.length<=4)return!1;let o=r.slice(0,r.length-4),s=Xr(o),i=Xr(s);return i[0]===r[o.length]&&i[1]===r[o.length+1]&&i[2]===r[o.length+2]&&i[3]===r[o.length+3]?o:!1}function Qc(n){if(typeof n!="string"||n.length!==Zc)return!1;let r=Is(n);if(r.length!==25||r[0]!==Jc)return!1;let o=r.slice(21);r=r.slice(0,21);let s=Xr(r),a=Xr(s).slice(0,4);return o[0]==a[0]&&o[1]==a[1]&&o[2]==a[2]&&o[3]==a[3]}function Hy(n){let r=sn(n),o=Ao(r),s=Zs(o);return wr(s)}function Ky(n){let r=sn(n),o=Ao(r),s=Zs(o);return Ae(s)}function Xy(n){let r=sn(n),o=Ao(r),s=Zs(o);return Cs(s)}function Ao(n){let r=fa.secp256k1.ProjectivePoint.fromPrivateKey(new Uint8Array(zy(n))),o=r.x,s=r.y,i=o.toString(16).padStart(64,"0"),a=s.toString(16).padStart(64,"0"),c=`04${i}${a}`;return it(c)}function Du(n,r){let o=fa.secp256k1.sign(Ae(n),Ae(r)),s=o.r.toString(16),i=o.s.toString(16),a=o.recovery+27;return s.padStart(64,"0")+i.padStart(64,"0")+Oo(a)}function Xr(n){let r=Ae(n),o=(0,k.sha256)("0x"+r).replace(/^0x/,"");return it(o)}function Yy(n){let r=sn(n),o=Js(r);return wr(o)}function xo(n,r=!1){let o=it(n,r),s=Js(o);return wr(s)}function Ru(n,r=!0){return(r?"0x":"")+(0,k.keccak256)(Buffer.from(n,"utf-8")).toString().substring(2)}var fa,vn=se(()=>{qt();Hn();Gi();Jn();Qt();Aa();fa=require("ethereum-cryptography/secp256k1")});var Uu={};Gt(Uu,{generateAccount:()=>Qy,generateAccountWithMnemonic:()=>tb,generateRandom:()=>eb});function Qy(){let n=xu(),r=Ao(n),o=Js(n),s=Ae(n),i=Ae(r);return{privateKey:s,publicKey:i,address:{base58:wr(o),hex:Ae(o)}}}function eb(n="",r=zi,o){let s=k.HDNodeWallet.createRandom(n,r,o);return{mnemonic:s.mnemonic,privateKey:s.privateKey,publicKey:s.signingKey.publicKey,address:xo(s.privateKey.replace(/^0x/,"")),path:s.path}}function tb(n,r=zi,o="",s=null){if(!String(r).match(/^m\/44\'\/195\'/))throw new Error(qy);let i=k.HDNodeWallet.fromMnemonic(k.Mnemonic.fromPhrase(n,o,s),r);return{mnemonic:i.mnemonic,privateKey:i.privateKey,publicKey:i.signingKey.publicKey,address:xo(i.privateKey.replace(/^0x/,""))}}var qy,_u=se(()=>{Jn();vn();Qt();qt();qy="Invalid tron path provided"});var zu={};Gt(zu,{TRON_MESSAGE_PREFIX:()=>VA,hashMessage:()=>ju,signMessage:()=>rb,verifyMessage:()=>nb});function ju(n){return typeof n=="string"?n=(0,k.toUtf8Bytes)(n):Array.isArray(n)&&(n=new Uint8Array(n)),(0,k.keccak256)((0,k.concat)([(0,k.toUtf8Bytes)(VA),(0,k.toUtf8Bytes)(String(n.length)),n]))}function rb(n,r){r.match(/^0x/)||(r="0x"+r);let o=new k.SigningKey(r),s=ju(n),i=o.sign(s);return Gc(i)}function nb(n,r){r.match(/^0x/)||(r="0x"+r);let o=(0,k.recoverAddress)(ju(n),r);return wr(it(o.replace(/^0x/,ht)))}var VA,Vu=se(()=>{Qt();qt();vn();Hn();VA=`TRON Signed Message:
|
|
5
|
+
`});var ob,D,kn=se(()=>{_u();qt();Gi();Jn();vn();Hn();Rs();Vu();Qt();Aa();$s();an();_u();qt();Gi();Jn();vn();Hn();Rs();Vu();Qt();Aa();$s();an();ob={...Ec,address:Yc,code:Fc,accounts:Uu,base58:nu,bytes:Mc,crypto:Nu,abi:su,message:zu,_TypedDataEncoder:Ko,transaction:Wu,ethersUtils:$c},D=ob});var GA=se(()=>{});var LA=se(()=>{});var $A=se(()=>{});var ZA=se(()=>{});var JA=se(()=>{});var HA=se(()=>{});var Gu,KA,XA,YA,qA=se(()=>{(function(n){n[n.BANDWIDTH=0]="BANDWIDTH",n[n.ENERGY=1]="ENERGY",n[n.TRON_POWER=2]="TRON_POWER"})(Gu||(Gu={}));(function(n){n.ENOUGH_PERMISSION="ENOUGH_PERMISSION",n.NOT_ENOUGH_PERMISSION="NOT_ENOUGH_PERMISSION",n.SIGNATURE_FORMAT_ERROR="SIGNATURE_FORMAT_ERROR",n.COMPUTE_ADDRESS_ERROR="COMPUTE_ADDRESS_ERROR",n.PERMISSION_ERROR="PERMISSION_ERROR",n.OTHER_ERROR="OTHER_ERROR"})(KA||(KA={}));(function(n){n[n.SUCCESS=0]="SUCCESS",n[n.SIGERROR=1]="SIGERROR",n[n.CONTRACT_VALIDATE_ERROR=2]="CONTRACT_VALIDATE_ERROR",n[n.CONTRACT_EXE_ERROR=3]="CONTRACT_EXE_ERROR",n[n.BANDWITH_ERROR=4]="BANDWITH_ERROR",n[n.DUP_TRANSACTION_ERROR=5]="DUP_TRANSACTION_ERROR",n[n.TAPOS_ERROR=6]="TAPOS_ERROR",n[n.TOO_BIG_TRANSACTION_ERROR=7]="TOO_BIG_TRANSACTION_ERROR",n[n.TRANSACTION_EXPIRATION_ERROR=8]="TRANSACTION_EXPIRATION_ERROR",n[n.SERVER_BUSY=9]="SERVER_BUSY",n[n.NO_CONNECTION=10]="NO_CONNECTION",n[n.NOT_ENOUGH_EFFECTIVE_CONNECTION=11]="NOT_ENOUGH_EFFECTIVE_CONNECTION",n[n.OTHER_ERROR=20]="OTHER_ERROR"})(XA||(XA={}));(function(n){n[n.PENDING=0]="PENDING",n[n.DISAPPROVED=1]="DISAPPROVED",n[n.APPROVED=2]="APPROVED",n[n.CANCELED=3]="CANCELED"})(YA||(YA={}))});var QA=se(()=>{});var ma={};Gt(ma,{AccountType:()=>cu,ContractType:()=>pe,Permission_PermissionType:()=>au,ResourceCode:()=>Gu});var ef=se(()=>{GA();LA();uu();$A();ZA();JA();HA();qA();QA()});var tf={};Gt(tf,{BigNumber:()=>Lu.BigNumber,Contract:()=>uo,Event:()=>po,Method:()=>On,Plugin:()=>lo,TransactionBuilder:()=>ao,TronWeb:()=>ie,Trx:()=>co,Types:()=>ma,default:()=>sb,providers:()=>bt,utils:()=>D});var Lu,sb,rf=se(()=>{kn();Lu=require("bignumber.js");Li();Su();vu();Fu();Ou();ku();Cr();ef();sb={utils:D,BigNumber:Lu.BigNumber,providers:bt,TransactionBuilder:ao,Trx:co,Contract:uo,Method:On,Event:po,Plugin:lo,TronWeb:ie,Types:ma}});function xa(n){try{return(0,Ea.fromBase58)(n).length===Pb}catch{return!1}}function ar(n){return Cb(n)&&Bb(n)===ii}function os(n){return ar(n)}function wb(n){return n.includes("::")?ul(n):n}function ul(n){let[r,o]=n.split("::"),s=n.slice(r.length+o.length+4),i=s.includes("<")?s.slice(0,s.indexOf("<")):s,a=s.includes("<")?(0,Ea.splitGenericParameters)(s.slice(s.indexOf("<")+1,s.lastIndexOf(">"))).map(c=>wb(c.trim())):[];return{address:le(r),module:o,name:i,typeParams:a}}function ai(n){let{address:r,module:o,name:s,typeParams:i}=typeof n=="string"?ul(n):n,a=i?.length>0?`<${i.map(c=>typeof c=="string"?c:ai(c)).join(",")}>`:"";return`${r}::${o}::${s}${a}`}function le(n,r=!1){let o=n.toLowerCase();return!r&&o.startsWith("0x")&&(o=o.slice(2)),`0x${o.padStart(ii*2,"0")}`}function Zt(n,r=!1){return le(n,r)}function Cb(n){return/^(0x|0X)?[a-fA-F0-9]+$/.test(n)&&n.length%2===0}function Bb(n){return/^(0x|0X)/.test(n)?(n.length-2)/2:n.length/2}var Ea,Pb,ii,Jt=se(()=>{Ea=require("@mysten/bcs"),Pb=32;ii=32});var zf,Wb,Sb,mn,ll=se(()=>{zf=require("@mysten/bcs");Jt();Wb=/^vector<(.+)>$/,Sb=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/,mn=class n{static parseFromStr(r,o=!1){if(r==="address")return{address:null};if(r==="bool")return{bool:null};if(r==="u8")return{u8:null};if(r==="u16")return{u16:null};if(r==="u32")return{u32:null};if(r==="u64")return{u64:null};if(r==="u128")return{u128:null};if(r==="u256")return{u256:null};if(r==="signer")return{signer:null};let s=r.match(Wb);if(s)return{vector:n.parseFromStr(s[1],o)};let i=r.match(Sb);if(i)return{struct:{address:o?le(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:n.parseStructTypeArgs(i[5],o)}};throw new Error(`Encountered unexpected token when parsing type args for ${r}`)}static parseStructTypeArgs(r,o=!1){return(0,zf.splitGenericParameters)(r).map(s=>n.parseFromStr(s,o))}static tagToString(r){if("bool"in r)return"bool";if("u8"in r)return"u8";if("u16"in r)return"u16";if("u32"in r)return"u32";if("u64"in r)return"u64";if("u128"in r)return"u128";if("u256"in r)return"u256";if("address"in r)return"address";if("signer"in r)return"signer";if("vector"in r)return`vector<${n.tagToString(r.vector)}>`;if("struct"in r){let o=r.struct,s=o.typeParams.map(n.tagToString).join(", ");return`${o.address}::${o.module}::${o.name}${s?`<${s}>`:""}`}throw new Error("Invalid TypeTag")}}});function vb(n){return v.bcs.u64({name:"unsafe_u64",...n}).transform({input:r=>r,output:r=>Number(r)})}function Ib(n){return v.bcs.enum("Option",{None:null,Some:n})}function Il(n){return v.bcs.struct(`IntentMessage<${n.name}>`,{intent:vl,value:n})}var v,Ve,cr,Ht,dl,pl,Al,fl,Da,Fr,ml,gl,hl,yl,bl,Tl,Pl,wl,Cl,Bl,Wl,Sl,vl,Ml,Rl,Fl,kl,Vf,Mb,Ol,Gf,Lf,El=se(()=>{v=require("@mysten/bcs");Jt();ll();Ve=v.bcs.bytes(ii).transform({validate:n=>{let r=typeof n=="string"?n:(0,v.toHex)(n);if(!r||!ar(le(r)))throw new Error(`Invalid Sui address ${r}`)},input:n=>typeof n=="string"?(0,v.fromHex)(le(n)):n,output:n=>le((0,v.toHex)(n))}),cr=v.bcs.vector(v.bcs.u8()).transform({name:"ObjectDigest",input:n=>(0,v.fromBase58)(n),output:n=>(0,v.toBase58)(new Uint8Array(n)),validate:n=>{if((0,v.fromBase58)(n).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Ht=v.bcs.struct("SuiObjectRef",{objectId:Ve,version:v.bcs.u64(),digest:cr}),dl=v.bcs.struct("SharedObjectRef",{objectId:Ve,initialSharedVersion:v.bcs.u64(),mutable:v.bcs.bool()}),pl=v.bcs.enum("ObjectArg",{ImmOrOwnedObject:Ht,SharedObject:dl,Receiving:Ht}),Al=v.bcs.enum("CallArg",{Pure:v.bcs.struct("Pure",{bytes:v.bcs.vector(v.bcs.u8()).transform({input:n=>typeof n=="string"?(0,v.fromBase64)(n):n,output:n=>(0,v.toBase64)(new Uint8Array(n))})}),Object:pl}),fl=v.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:v.bcs.lazy(()=>fl),struct:v.bcs.lazy(()=>Tl),u16:null,u32:null,u256:null}),Da=fl.transform({input:n=>typeof n=="string"?mn.parseFromStr(n,!0):n,output:n=>mn.tagToString(n)}),Fr=v.bcs.enum("Argument",{GasCoin:null,Input:v.bcs.u16(),Result:v.bcs.u16(),NestedResult:v.bcs.tuple([v.bcs.u16(),v.bcs.u16()])}),ml=v.bcs.struct("ProgrammableMoveCall",{package:Ve,module:v.bcs.string(),function:v.bcs.string(),typeArguments:v.bcs.vector(Da),arguments:v.bcs.vector(Fr)}),gl=v.bcs.enum("Command",{MoveCall:ml,TransferObjects:v.bcs.struct("TransferObjects",{objects:v.bcs.vector(Fr),address:Fr}),SplitCoins:v.bcs.struct("SplitCoins",{coin:Fr,amounts:v.bcs.vector(Fr)}),MergeCoins:v.bcs.struct("MergeCoins",{destination:Fr,sources:v.bcs.vector(Fr)}),Publish:v.bcs.struct("Publish",{modules:v.bcs.vector(v.bcs.vector(v.bcs.u8()).transform({input:n=>typeof n=="string"?(0,v.fromBase64)(n):n,output:n=>(0,v.toBase64)(new Uint8Array(n))})),dependencies:v.bcs.vector(Ve)}),MakeMoveVec:v.bcs.struct("MakeMoveVec",{type:Ib(Da).transform({input:n=>n===null?{None:!0}:{Some:n},output:n=>n.Some??null}),elements:v.bcs.vector(Fr)}),Upgrade:v.bcs.struct("Upgrade",{modules:v.bcs.vector(v.bcs.vector(v.bcs.u8()).transform({input:n=>typeof n=="string"?(0,v.fromBase64)(n):n,output:n=>(0,v.toBase64)(new Uint8Array(n))})),dependencies:v.bcs.vector(Ve),package:Ve,ticket:Fr})}),hl=v.bcs.struct("ProgrammableTransaction",{inputs:v.bcs.vector(Al),commands:v.bcs.vector(gl)}),yl=v.bcs.enum("TransactionKind",{ProgrammableTransaction:hl,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),bl=v.bcs.enum("TransactionExpiration",{None:null,Epoch:vb()}),Tl=v.bcs.struct("StructTag",{address:Ve,module:v.bcs.string(),name:v.bcs.string(),typeParams:v.bcs.vector(fl)}),Pl=v.bcs.struct("GasData",{payment:v.bcs.vector(Ht),owner:Ve,price:v.bcs.u64(),budget:v.bcs.u64()}),wl=v.bcs.struct("TransactionDataV1",{kind:yl,sender:Ve,gasData:Pl,expiration:bl}),Cl=v.bcs.enum("TransactionData",{V1:wl}),Bl=v.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Wl=v.bcs.enum("IntentVersion",{V0:null}),Sl=v.bcs.enum("AppId",{Sui:null}),vl=v.bcs.struct("Intent",{scope:Bl,version:Wl,appId:Sl});Ml=v.bcs.enum("CompressedSignature",{ED25519:v.bcs.fixedArray(64,v.bcs.u8()),Secp256k1:v.bcs.fixedArray(64,v.bcs.u8()),Secp256r1:v.bcs.fixedArray(64,v.bcs.u8()),ZkLogin:v.bcs.vector(v.bcs.u8())}),Rl=v.bcs.enum("PublicKey",{ED25519:v.bcs.fixedArray(32,v.bcs.u8()),Secp256k1:v.bcs.fixedArray(33,v.bcs.u8()),Secp256r1:v.bcs.fixedArray(33,v.bcs.u8()),ZkLogin:v.bcs.vector(v.bcs.u8())}),Fl=v.bcs.struct("MultiSigPkMap",{pubKey:Rl,weight:v.bcs.u8()}),kl=v.bcs.struct("MultiSigPublicKey",{pk_map:v.bcs.vector(Fl),threshold:v.bcs.u16()}),Vf=v.bcs.struct("MultiSig",{sigs:v.bcs.vector(Ml),bitmap:v.bcs.u16(),multisig_pk:kl}),Mb=v.bcs.vector(v.bcs.u8()).transform({input:n=>typeof n=="string"?(0,v.fromBase64)(n):n,output:n=>(0,v.toBase64)(new Uint8Array(n))}),Ol=v.bcs.struct("SenderSignedTransaction",{intentMessage:Il(Cl),txSignatures:v.bcs.vector(Mb)}),Gf=v.bcs.vector(Ol,{name:"SenderSignedData"}),Lf=v.bcs.struct("PasskeyAuthenticator",{authenticatorData:v.bcs.vector(v.bcs.u8()),clientDataJson:v.bcs.string(),userSignature:v.bcs.vector(v.bcs.u8())})});var M,Rb,Fb,$f,kb,Ob,Eb,Zf,Jf,ss,xb,xl,Db,Nb,Ub,_b,jb,zb,Hf,Kf=se(()=>{M=require("@mysten/bcs");El();Rb=M.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:M.bcs.struct("UnableToFetchPackage",{packageId:Ve}),NotAPackage:M.bcs.struct("NotAPackage",{objectId:Ve}),IncompatibleUpgrade:null,DigestDoesNotMatch:M.bcs.struct("DigestDoesNotMatch",{digest:M.bcs.vector(M.bcs.u8())}),UnknownUpgradePolicy:M.bcs.struct("UnknownUpgradePolicy",{policy:M.bcs.u8()}),PackageIDDoesNotMatch:M.bcs.struct("PackageIDDoesNotMatch",{packageId:Ve,ticketId:Ve})}),Fb=M.bcs.struct("ModuleId",{address:Ve,name:M.bcs.string()}),$f=M.bcs.struct("MoveLocation",{module:Fb,function:M.bcs.u16(),instruction:M.bcs.u16(),functionName:M.bcs.option(M.bcs.string())}),kb=M.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:M.bcs.struct("IndexOutOfBounds",{idx:M.bcs.u16()}),SecondaryIndexOutOfBounds:M.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:M.bcs.u16(),secondaryIdx:M.bcs.u16()}),InvalidResultArity:M.bcs.struct("InvalidResultArity",{resultIdx:M.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),Ob=M.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),Eb=M.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:M.bcs.struct("MoveObjectTooBig",{objectSize:M.bcs.u64(),maxObjectSize:M.bcs.u64()}),MovePackageTooBig:M.bcs.struct("MovePackageTooBig",{objectSize:M.bcs.u64(),maxObjectSize:M.bcs.u64()}),CircularObjectOwnership:M.bcs.struct("CircularObjectOwnership",{object:Ve}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:M.bcs.option($f),MoveAbort:M.bcs.tuple([$f,M.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:M.bcs.struct("CommandArgumentError",{argIdx:M.bcs.u16(),kind:kb}),TypeArgumentError:M.bcs.struct("TypeArgumentError",{argumentIdx:M.bcs.u16(),kind:Ob}),UnusedValueWithoutDrop:M.bcs.struct("UnusedValueWithoutDrop",{resultIdx:M.bcs.u16(),secondaryIdx:M.bcs.u16()}),InvalidPublicFunctionReturnType:M.bcs.struct("InvalidPublicFunctionReturnType",{idx:M.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:M.bcs.struct("EffectsTooLarge",{currentSize:M.bcs.u64(),maxSize:M.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:M.bcs.struct("PackageUpgradeError",{upgradeError:Rb}),WrittenObjectsTooLarge:M.bcs.struct("WrittenObjectsTooLarge",{currentSize:M.bcs.u64(),maxSize:M.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:M.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:M.bcs.vector(Ve)}),AddressDeniedForCoin:M.bcs.struct("AddressDeniedForCoin",{address:Ve,coinType:M.bcs.string()}),CoinTypeGlobalPause:M.bcs.struct("CoinTypeGlobalPause",{coinType:M.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Zf=M.bcs.enum("ExecutionStatus",{Success:null,Failed:M.bcs.struct("ExecutionFailed",{error:Eb,command:M.bcs.option(M.bcs.u64())})}),Jf=M.bcs.struct("GasCostSummary",{computationCost:M.bcs.u64(),storageCost:M.bcs.u64(),storageRebate:M.bcs.u64(),nonRefundableStorageFee:M.bcs.u64()}),ss=M.bcs.enum("Owner",{AddressOwner:Ve,ObjectOwner:Ve,Shared:M.bcs.struct("Shared",{initialSharedVersion:M.bcs.u64()}),Immutable:null}),xb=M.bcs.struct("TransactionEffectsV1",{status:Zf,executedEpoch:M.bcs.u64(),gasUsed:Jf,modifiedAtVersions:M.bcs.vector(M.bcs.tuple([Ve,M.bcs.u64()])),sharedObjects:M.bcs.vector(Ht),transactionDigest:cr,created:M.bcs.vector(M.bcs.tuple([Ht,ss])),mutated:M.bcs.vector(M.bcs.tuple([Ht,ss])),unwrapped:M.bcs.vector(M.bcs.tuple([Ht,ss])),deleted:M.bcs.vector(Ht),unwrappedThenDeleted:M.bcs.vector(Ht),wrapped:M.bcs.vector(Ht),gasObject:M.bcs.tuple([Ht,ss]),eventsDigest:M.bcs.option(cr),dependencies:M.bcs.vector(cr)}),xl=M.bcs.tuple([M.bcs.u64(),cr]),Db=M.bcs.enum("ObjectIn",{NotExist:null,Exist:M.bcs.tuple([xl,ss])}),Nb=M.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:M.bcs.tuple([cr,ss]),PackageWrite:xl}),Ub=M.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),_b=M.bcs.struct("EffectsObjectChange",{inputState:Db,outputState:Nb,idOperation:Ub}),jb=M.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:xl,MutateDeleted:M.bcs.u64(),ReadDeleted:M.bcs.u64(),Cancelled:M.bcs.u64(),PerEpochConfig:null}),zb=M.bcs.struct("TransactionEffectsV2",{status:Zf,executedEpoch:M.bcs.u64(),gasUsed:Jf,transactionDigest:cr,gasObjectIndex:M.bcs.option(M.bcs.u32()),eventsDigest:M.bcs.option(cr),dependencies:M.bcs.vector(cr),lamportVersion:M.bcs.u64(),changedObjects:M.bcs.vector(M.bcs.tuple([Ve,_b])),unchangedSharedObjects:M.bcs.vector(M.bcs.tuple([Ve,jb])),auxDataDigest:M.bcs.option(cr)}),Hf=M.bcs.enum("TransactionEffects",{V1:xb,V2:zb})});var kr,Vb,R,Pt=se(()=>{kr=require("@mysten/bcs");El();Kf();ll();Vb=require("@mysten/bcs"),R={...kr.bcs,U8:kr.bcs.u8(),U16:kr.bcs.u16(),U32:kr.bcs.u32(),U64:kr.bcs.u64(),U128:kr.bcs.u128(),U256:kr.bcs.u256(),ULEB128:kr.bcs.uleb128(),Bool:kr.bcs.bool(),String:kr.bcs.string(),Address:Ve,AppId:Sl,Argument:Fr,CallArg:Al,CompressedSignature:Ml,GasData:Pl,Intent:vl,IntentMessage:Il,IntentScope:Bl,IntentVersion:Wl,MultiSig:Vf,MultiSigPkMap:Fl,MultiSigPublicKey:kl,ObjectArg:pl,ObjectDigest:cr,ProgrammableMoveCall:ml,ProgrammableTransaction:hl,PublicKey:Rl,SenderSignedData:Gf,SenderSignedTransaction:Ol,SharedObjectRef:dl,StructTag:Tl,SuiObjectRef:Ht,Command:gl,TransactionData:Cl,TransactionDataV1:wl,TransactionExpiration:bl,TransactionKind:yl,TypeTag:Da,TransactionEffects:Hf,PasskeyAuthenticator:Lf}});function JT(n,r=["<",">"]){let[o,s]=r,i=[],a="",c=0;for(let u=0;u<n.length;u++){let l=n[u];if(l===o&&c++,l===s&&c--,c===0&&l===","){i.push(a.trim()),a="";continue}a+=l}return i.push(a.trim()),i}function Ft(n){if(typeof n!="string")throw new Error(`Illegal type passed as a name of the type: ${n}`);let[r,o]=["<",">"],s=n.indexOf(r),i=Array.from(n).reverse().indexOf(o);if(s===-1&&i===-1)return{typeName:n,typeArgs:[]};if(s===-1||i===-1)throw new Error(`Unclosed generic in name '${n}'`);let a=n.slice(0,s),c=JT(n.slice(s+1,n.length-i-1),[r,o]);return{typeName:a,typeArgs:c}}function Pm(n){return!n||typeof n!="object"||Array.isArray(n)?!1:"GasCoin"in n||"Input"in n||"Result"in n||"NestedResult"in n}function ce(n,r){return Pm(r)?r:n.object(r)}function yr(n,r,o){if(Pm(r))return ce(n,r);function s(p){let{typeName:A,typeArgs:g}=Ft(p);switch(A){case"bool":return R.Bool;case"u8":return R.U8;case"u16":return R.U16;case"u32":return R.U32;case"u64":return R.U64;case"u128":return R.U128;case"u256":return R.U256;case"address":return R.Address;case"0x1::string::String":case"0x1::ascii::String":return R.String;case"0x2::object::ID":return R.Address;case"0x1::option::Option":return R.option(s(g[0]));case"vector":return R.vector(s(g[0]));default:throw new Error(`invalid primitive type ${p}`)}}function i(p){for(let A of p){if(typeof A>"u"||A===null)return!0;if(Array.isArray(A))return i(A)}return!1}function a(p){for(let A of p){if(!Array.isArray(A)){if(A===null)continue;switch(typeof A){case"string":case"number":case"bigint":case"boolean":continue;default:return!1}}return a(A)}return!0}function c(p){for(let A of p){if(!Array.isArray(A))switch(typeof A){case"string":case"number":case"bigint":case"boolean":return!0;default:continue}return c(A)}return!1}let{typeName:u,typeArgs:l}=Ft(o);switch(u){case"0x1::option::Option":if(r===null)return n.pure.option("bool",null);if(a([r]))return n.pure(s(o).serialize(r));if(c([r]))throw new Error("mixing primitive and TransactionArgument values is not supported");return n.moveCall({target:"0x1::option::some",typeArguments:[l[0]],arguments:[yr(n,r,l[0])]});case"vector":if(!Array.isArray(r))throw new Error("expected an array for vector type");if(r.length===0)return n.pure(R.vector(R.Bool).serialize([]));if(i(r))throw new Error("the provided array contains undefined or null values");if(a(r))return n.pure(s(o).serialize(r));if(c(r))throw new Error("mixing primitive and TransactionArgument values is not supported");return n.makeMoveVec({type:l[0],elements:r});default:return n.pure(s(o).serialize(r))}}function HT(n){let r=n.split("0x").join("");for(let o=0;o<r.length;o++)if(r[o]!=="0")return`0x${r.substring(o)}`;return"0x0"}function ne(n){let{typeName:r,typeArgs:o}=Ft(n);switch(r){case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":case"address":case"signer":return r;case"vector":return`vector<${ne(o[0])}>`;default:{let s=r.split("::");s[0]=HT(s[0]);let i=s.join("::");return o.length>0?`${i}<${o.map(a=>ne(a)).join(",")}>`:i}}}function Ie(n,...r){return r.length>0?`${n}<${r.join(", ")}>`:n}var wt=se(()=>{"use strict";Pt()});var Vn=Ot((LI,wm)=>{"use strict";wt();var ql=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},KT=new ql;wm.exports=KT});var rd=Ot((HI,Mm)=>{"use strict";wt();var td=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},XT=new td;Mm.exports=XT});var sd=Ot((qI,Fm)=>{"use strict";wt();var od=class n{static $PACKAGE_ID="";static $PUBLISHED_AT="";static $PKG_V=[];get PACKAGE_ID(){return ne(n.$PACKAGE_ID)}get PUBLISHED_AT(){return ne(n.$PUBLISHED_AT)}get PKG_V1(){return ne(n.$PKG_V[1])}setPackageId(r){n.$PACKAGE_ID=r}setPublishedAt(r){n.$PUBLISHED_AT=r}setPkgV(r,o){n.$PKG_V[r]=o}setAddress(r,o){n.$PACKAGE_ID=r,n.$PUBLISHED_AT=r,n.$PKG_V[1]=o||r}},YT=new od;Fm.exports=YT});var yP={};Gt(yP,{AddressStatus:()=>Ii,AllbridgeCoreSdk:()=>md,AmountFormat:()=>Xs,AmountNotEnoughError:()=>Ln,ArgumentInvalidDecimalsError:()=>hs,CCTPDoesNotSupportedError:()=>Ct,ChainSymbol:()=>Xt,ChainType:()=>Le,ErrorCode:()=>hd,ExtraGasMaxLimitExceededError:()=>gs,FeePaymentMethod:()=>Dn,InsufficientPoolLiquidityError:()=>Gr,InvalidAmountError:()=>Vr,InvalidGasFeePaymentOptionError:()=>Mo,InvalidMessengerOptionError:()=>wc,InvalidTxError:()=>$n,JupiterError:()=>gt,Messenger:()=>Pr,MethodNotSupportedError:()=>st,NodeRpcUrlNotInitializedError:()=>ys,SdkError:()=>U,SdkRootError:()=>tt,SolanaAutoTxFee:()=>Ca,TimeoutError:()=>Fo,TxTooLargeError:()=>bs,VerifyTxError:()=>Ro,mainnet:()=>ms,nodeRpcUrlsDefault:()=>lg,nodeUrlsDefault:()=>ug});module.exports=cg(yP);var ms={coreApiUrl:"https://core.api.allbridgecoreapi.net",coreApiQueryParams:{},coreApiHeaders:{},jupiterUrl:"https://lite-api.jup.ag/swap/v1",wormholeMessengerProgramId:"worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth",solanaLookUpTable:"2JcBAEVnAwVo4u8d61iqgHPrzZuugur7cVTjWubsVLHj",sorobanNetworkPassphrase:"Public Global Stellar Network ; September 2015",tronJsonRpc:"https://api.trongrid.io/jsonrpc",cctpParams:{cctpTransmitterProgramId:"CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd",cctpTokenMessengerMinter:"CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3",cctpDomains:{ETH:0,AVA:1,OPT:2,ARB:3,SOL:5,BAS:6,POL:7,SUI:8}},cachePoolInfoChainSec:20},ug={solanaRpcUrl:"https://api.mainnet-beta.solana.com",tronRpcUrl:"https://api.trongrid.io"},lg={SOL:"https://api.mainnet-beta.solana.com",TRX:"https://api.trongrid.io",SRB:"https://rpc.stellar.org:443",STLR:"https://horizon.stellar.org",SUI:"https://fullnode.mainnet.sui.io"};var jt=require("big.js");var tt=class extends Error{errorCode;constructor(r,o){super(o),this.errorCode=r}},U=class extends tt{constructor(r){super("SdkError",r)}},Vr=class extends tt{constructor(r){super("InvalidAmountError",r)}},Ln=class extends tt{constructor(r){super("AmountNotEnoughError",r)}},Gr=class extends tt{constructor(r){super("InsufficientPoolLiquidityError",r)}},gt=class extends tt{constructor(r){super("JupiterError",r)}},Mo=class extends tt{constructor(r){super("InvalidGasFeePaymentOptionError",r)}},wc=class extends tt{constructor(r){super("InvalidMessengerOptionError",r)}},st=class extends tt{constructor(r){super("MethodNotSupportedError",r)}},Ro=class extends tt{constructor(r){super("VerifyTxError",r)}},$n=class extends tt{constructor(r){super("InvalidTxError",r)}},gs=class extends tt{constructor(r){super("ExtraGasMaxLimitExceededError",r)}},hs=class extends tt{constructor(r,o,s){super("ArgumentInvalidDecimalsError",`Argument '${r}' decimals '${o}' cannot be greater than '${s}'`)}},Fo=class extends tt{constructor(r){super("TimeoutError",r)}},ys=class extends tt{constructor(r){super("NodeRpcUrlNotInitializedError",`For chain '${r}' Node RPC URL not initialized`)}},Ct=class extends tt{constructor(r){super("CCTPDoesNotSupportedError",r)}},bs=class extends tt{constructor(){super("TxTooLargeError","Transaction too large: try again later or switch to another messenger or pay relayer fee in native gas currency")}},hd=(F=>(F.SDK_ERROR="SdkError",F.INVALID_AMOUNT_ERROR="InvalidAmountError",F.AMOUNT_NOT_ENOUGH_ERROR="AmountNotEnoughError",F.INSUFFICIENT_POOL_LIQUIDITY_ERROR="InsufficientPoolLiquidityError",F.JUPITER_ERROR="JupiterError",F.INVALID_GAS_FEE_PAYMENT_OPTION_ERROR="InvalidGasFeePaymentOptionError",F.INVALID_MESSENGER_OPTION_ERROR="InvalidMessengerOptionError",F.METHOD_NOT_SUPPORTED_ERROR="MethodNotSupportedError",F.VERIFY_TX_ERROR="VerifyTxError",F.INVALID_TX_ERROR="InvalidTxError",F.EXTRA_GAS_MAX_LIMIT_EXCEEDED_ERROR="ExtraGasMaxLimitExceededError",F.ARGUMENT_INVALID_DECIMALS_ERROR="ArgumentInvalidDecimalsError",F.TIMEOUT_ERROR="TimeoutError",F.NODE_RPC_URL_NOT_INITIALIZED_ERROR="NodeRpcUrlNotInitializedError",F.CCTP_DOES_NOT_SUPPORTED_ERROR="CCTPDoesNotSupportedError",F.TX_TOO_LARGE="TxTooLargeError",F))(hd||{});var Xt=(b=>(b.BSC="BSC",b.ETH="ETH",b.BAS="BAS",b.SOL="SOL",b.TRX="TRX",b.POL="POL",b.ARB="ARB",b.CEL="CEL",b.AVA="AVA",b.SRB="SRB",b.STLR="STLR",b.OPT="OPT",b.SUI="SUI",b))(Xt||{}),Le=(a=>(a.EVM="EVM",a.SOLANA="SOLANA",a.TRX="TRX",a.SRB="SRB",a.SUI="SUI",a))(Le||{});var dg={EVM:18,SOLANA:9,TRX:6,SRB:7,SUI:9},pg={BSC:{chainSymbol:"BSC",chainId:"0x38",name:"BNB Chain",chainType:"EVM"},ETH:{chainSymbol:"ETH",chainId:"0x1",name:"Ethereum",chainType:"EVM"},BAS:{chainSymbol:"BAS",chainId:"0x2105",name:"Base",chainType:"EVM"},ARB:{chainSymbol:"ARB",chainId:"0xa4b1",name:"Arbitrum",chainType:"EVM"},AVA:{chainSymbol:"AVA",chainId:"0xa86a",name:"Avalanche",chainType:"EVM"},CEL:{chainSymbol:"CEL",chainId:"0xa4ec",name:"Celo",chainType:"EVM"},POL:{chainSymbol:"POL",chainId:"0x89",name:"Polygon",chainType:"EVM"},OPT:{chainSymbol:"OPT",chainId:"0xa",name:"OP Mainnet",chainType:"EVM"},SOL:{chainSymbol:"SOL",name:"Solana",chainType:"SOLANA"},TRX:{chainSymbol:"TRX",name:"Tron",chainType:"TRX"},SRB:{chainSymbol:"SRB",name:"Stellar",chainType:"SRB"},STLR:{chainSymbol:"STLR",name:"Stellar",chainType:"SRB"},SUI:{chainSymbol:"SUI",name:"Sui",chainType:"SUI"}},Re=(()=>{let n={...pg};return{addChainsProperties(r){n={...n,...r}},getChainProperty(r){let o=n[r];if(!o)throw new U(`Cannot find chain properties for ${r}`);return o},getChainsProperties(){return n},getChainDecimalsByType(r){return dg[r]}}})();var Md=be(require("axios"));var yd="3.22.1-alpha.2";var Z=require("big.js"),vi=be(require("bn.js"));function Cc(n,r){return(0,Z.Big)(100).minus((0,Z.Big)(100).times(r).div(n)).toNumber()}function Zn(n,r){return Lr(n,r,3).round(0,Z.Big.roundDown)}function Yt(n,r){return Lr(n,3,r)}function Lr(n,r,o){let s=(0,Z.Big)(o).minus(r).toNumber();return(0,Z.Big)(n).times(Ts(s))}function Ts(n){return(0,Z.Big)(10).pow(n)}function xe(n,r){return(0,Z.Big)(n).times(Ts(r))}function Ce(n,r){let o=(0,Z.Big)(n);return o.eq(0)?(0,Z.Big)(0):(0,Z.Big)(o).div(Ts(r))}function Et(n){return Ce((0,Z.Big)(n.tokenBalance).minus(n.vUsdBalance).toFixed(),3).div(2).toFixed()}function $r(n,{feeShare:r,decimals:o},s){let i=(0,Z.Big)(n);if(i.lte(0))return"0";let a=i.times(r),c=i.minus(a),u=Zn(c,o),l=(0,Z.Big)(s.tokenBalance).plus(u),p=Zr(l,s.aValue,s.dValue);return(0,Z.Big)(s.vUsdBalance).minus(p).round(0,Z.Big.roundDown).toFixed()}function Ps(n,{feeShare:r,decimals:o},s){let i=(0,Z.Big)(n);if(i.lte(0))return(0,Z.Big)(0).toFixed();let a=i.plus(s.vUsdBalance),c=Zr(a,s.aValue,s.dValue),u=Yt((0,Z.Big)(s.tokenBalance).minus(c),o),l=(0,Z.Big)(u).times(r);return(0,Z.Big)(u).minus(l).round(0,Z.Big.roundDown).toFixed()}function bd(n,r){let o=(0,Z.Big)(n);if(o.lte(0))return r;let s=o.plus(r.vUsdBalance),i=Zr(s,r.aValue,r.dValue);return{aValue:r.aValue,dValue:r.dValue,tokenBalance:i.toFixed(0),vUsdBalance:s.toFixed(0)}}function Td(n,{feeShare:r,decimals:o},s){if((0,Z.Big)(n).lte(0))return(0,Z.Big)(0);let i=(0,Z.Big)(s.vUsdBalance).minus(n);if(i.lte(0))throw new Gr;let a=Zr(i,s.aValue,s.dValue),c=(0,Z.Big)(a).minus(s.tokenBalance),u=Yt(c,o),l=(0,Z.Big)(r).div((0,Z.Big)(1).minus(r)),p=(0,Z.Big)(u).times(l).round(0,Z.Big.roundUp);return(0,Z.Big)(u).plus(p).round(0,Z.Big.roundDown)}function Pd(n,{feeShare:r,decimals:o},s){if((0,Z.Big)(n).lte(0))return(0,Z.Big)(0);let i=(0,Z.Big)(r).div((0,Z.Big)(1).minus(r)),a=(0,Z.Big)(n).times(i).round(0,Z.Big.roundUp),c=(0,Z.Big)(n).plus(a),u=Zn(c,o),l=(0,Z.Big)(s.tokenBalance).minus(u);if(l.lte(0))throw new Gr;let p=Zr(l,s.aValue,s.dValue);return(0,Z.Big)(p).minus(s.vUsdBalance).round(0,Z.Big.roundDown)}function Zr(n,r,o){let s=(0,Z.Big)(4).times(r).times((0,Z.Big)(o).minus(n)).minus(o),i=(0,Z.Big)(o).pow(3),a=s.pow(2),c=(0,Z.Big)(n).times((0,Z.Big)(n).times(a).plus((0,Z.Big)(4).times(r).times(i))).sqrt().round(0,Z.Big.roundDown),u=(0,Z.Big)(8).times(r).times(n),l=s.times(n).plus(c).div(u).round(0,Z.Big.roundDown);return l.eq(0)?(0,Z.Big)(0):l.plus(1)}function wd(n,r,o,s){let i=new vi.default(n),a=new vi.default(o),c=new vi.default(r);return i.mul(a).shrn(s).sub(c).toString()}function Cd(n){return(0,Z.Big)(n).gt(0)?`${Number((0,Z.Big)(n).times(100).toFixed(2)).toLocaleString()}%`:"N/A"}function Bd(n,r,o){let s=(0,Z.Big)(r).times(o),i=(0,Z.Big)(r).plus(o),a=(0,Z.Big)(8).times(n).times(s).times(i),c=s.times((0,Z.Big)(16).times(n).minus(4)).div(3),u=a.times(a),l=c.times(c).times(c),p=u.plus(l),A=(0,Z.Big)(p).sqrt(),g=(0,Z.Big)(Math.cbrt(+a.plus(A).toFixed())),P=(0,Z.Big)(Math.cbrt(+a.minus(A).toFixed()));return g.plus(P).toFixed()}var Ii=(c=>(c.OK="OK",c.INVALID="INVALID",c.FORBIDDEN="FORBIDDEN",c.UNINITIALIZED="UNINITIALIZED",c.CONTRACT_ADDRESS="CONTRACT_ADDRESS",c.WRONG_ASSOCIATED_ACCOUNT_OWNER="WRONG_ASSOCIATED_ACCOUNT_OWNER",c))(Ii||{});var Pr=(i=>(i[i.ALLBRIDGE=1]="ALLBRIDGE",i[i.WORMHOLE=2]="WORMHOLE",i[i.CCTP=3]="CCTP",i[i.CCTP_V2=4]="CCTP_V2",i))(Pr||{});function Wd(n){return Object.entries(n).reduce((r,o)=>{let s=o[0],i=o[1],a=hg(s,i);return a&&(r[s]=a),r},{})}function Sd(n){let r={};for(let[o,s]of Object.entries(n)){let i=o;for(let a of s.tokens){let c=ko({chainSymbol:i,poolAddress:a.poolAddress}),u=Et(a.poolInfo);r[c]={...a.poolInfo,imbalance:u}}}return r}function Ag(n,r){let{name:o,...s}=n,{poolInfo:i,...a}=r;return{...a,...s,chainName:o}}function fg(n){switch(n){case"allbridge":return 1;case"wormhole":return 2;case"cctp":return 3;case"cctpV2":return 4}}function mg(n){return Object.entries(n).reduce((r,[o,s])=>(r[o]=gg(s),r),{})}function gg(n){return Object.entries(n).reduce((r,[o,s])=>{let i=fg(o);return i&&(r[i]=s),r},{})}function hg(n,r){let o=Re.getChainsProperties()[n];if(!o)return null;let s={...o,allbridgeChainId:r.chainId,bridgeAddress:r.bridgeAddress,transferTime:mg(r.transferTime),txCostAmount:r.txCostAmount,confirmations:r.confirmations,suiAddresses:r.suiAddresses};return{...s,tokens:r.tokens.map(i=>Ag(s,i))}}function ko(n){return n.chainSymbol+"_"+n.poolAddress}function vd(n){let r=[];for(let[o,s]of Object.entries(n)){let i=o;for(let a of s.tokens)r.push({chainSymbol:i,poolAddress:a.poolAddress})}return r}function Id(n){let r={};for(let[o,s]of Object.entries(n)){let i=o;for(let[a,c]of Object.entries(s))c.imbalance=Et(c),r[ko({chainSymbol:i,poolAddress:a})]=c}return r}var Mi=class{api;constructor(r){this.api=Md.default.create({baseURL:r.coreApiUrl,headers:{Accept:"application/json",...r.coreApiHeaders,"x-Sdk-Agent":"AllbridgeCoreSDK/"+yd},params:r.coreApiQueryParams})}async getTokenInfo(){let{data:r}=await this.api.get("/token-info",{params:{filter:"all"}});return{chainDetailsMap:Wd(r),poolInfoMap:Sd(r)}}async getPendingInfo(){let{data:r}=await this.api.get("/pending-info");return r}async getGasBalance(r,o){let{data:s}=await this.api.get(`/check/${r}/${o}`);return s}async getTransferStatus(r,o){let{data:s}=await this.api.get(`/chain/${r}/${o}`);return s}async getReceiveTransactionCost(r){let{data:o}=await this.api.post("/receive-fee",r,{headers:{"Content-Type":"application/json"}});return{exchangeRate:o.exchangeRate,fee:o.fee,sourceNativeTokenPrice:o.sourceNativeTokenPrice}}async getPoolInfoMap(r){let o=r instanceof Array?r:[r],{data:s}=await this.api.post("/pool-info",{pools:o},{headers:{"Content-Type":"application/json"}});return Id(s)}};var yg=(n,r)=>n!==null&&Object.prototype.hasOwnProperty.call(n,r),Rd="__cache__",Bc=function(n){return typeof n!="string"?Rd+JSON.stringify(n):Rd+n},Wc=class{constructor(r={defaultTtl:60*1e3}){this.cache={},this.defaultTtl=r.defaultTtl||60*1e3}put(r,o,s){let i=(s?s.ttl:void 0)||this.defaultTtl,a=(s?s.callback:void 0)||function(){},c=Bc(r),u=this.cache[c];u&&clearTimeout(u.handle);let l=setTimeout(()=>this.remove(r),i);this.cache[c]={handle:l,data:o,callback:a}}get(r){let o=this.cache[Bc(r)];return o&&o.data}remove(r){let o=Bc(r),s=this.cache[o];s&&(clearTimeout(s.handle),delete this.cache[o],s.callback(r,s.data))}clear(){for(let r in this.cache)yg(this.cache,r)&&clearTimeout(this.cache[r].handle);this.cache={}}size(){return Object.keys(this.cache).length}},on=Wc;var Sc=20*1e3,bg=55*1e3,Ri=class{constructor(r){this.apiClient=r;this.tokenInfoCache=new on({defaultTtl:bg}),this.receivedTransactionCache=new on({defaultTtl:Sc}),this.pendingInfoCache=new on({defaultTtl:Sc}),this.gasBalanceCache=new on({defaultTtl:Sc})}tokenInfoCache;pendingInfoCache;gasBalanceCache;receivedTransactionCache;getTokenInfo(){let r="TOKEN_INFO_CACHE_KEY",o=this.tokenInfoCache.get(r);if(o)return o;let s=this.apiClient.getTokenInfo();return this.tokenInfoCache.put(r,s),s}async getGasBalance(r,o){let s=`GAS_BALANCE_${r}_${o}`,i=this.gasBalanceCache.get(s);if(i)return i;let a=this.apiClient.getGasBalance(r,o);return this.gasBalanceCache.put(s,a),a}async getPendingInfo(){let r="PENDING_INFO_CACHE_KEY",o=this.pendingInfoCache.get(r);if(o)return o;let s=this.apiClient.getPendingInfo();return this.pendingInfoCache.put(r,s),s}async getReceiveTransactionCost(r){let o=`RECEIVE_TX_COST_${r.sourceChainId}_${r.destinationChainId}_${r.messenger}`,s=this.receivedTransactionCache.get(o);if(s)return s;let i=await this.apiClient.getReceiveTransactionCost(r);return this.receivedTransactionCache.put(o,i),i}async getTransferStatus(r,o){return this.apiClient.getTransferStatus(r,o)}async getPoolInfoMap(r){return this.apiClient.getPoolInfoMap(r)}};var Fi=class{constructor(r){this.apiClient=r}async getChainDetailsMap(){return(await this.apiClient.getTokenInfo()).chainDetailsMap}async tokens(){let r=await this.getChainDetailsMap();return Object.values(r).flatMap(o=>o.tokens)}async getPendingInfo(){return this.apiClient.getPendingInfo()}async getGasBalance(r,o){return this.apiClient.getGasBalance(r,o)}async getChainDetailsMapAndPoolInfoMap(){return await this.apiClient.getTokenInfo()}async getTransferStatus(r,o){return await this.apiClient.getTransferStatus(r,o)}async getReceiveTransactionCost(r){return await this.apiClient.getReceiveTransactionCost(r)}async getPoolInfoMap(r){return await this.apiClient.getPoolInfoMap(r)}};var ki=class{constructor(r,o){this.client=r;this.isStaging=o.coreApiQueryParams?.staging==="true"}isStaging;async getChainDetailsMap(r){let o=await this.client.getChainDetailsMap(),s={};for(let i in o){let a=o[i];a&&(s[i]={...a,tokens:Fd(a.tokens,r,this.isStaging)})}return s}async tokens(r){return Fd(await this.client.tokens(),r,this.isStaging)}async getPendingInfo(){return this.client.getPendingInfo()}async getGasBalance(r,o){return this.client.getGasBalance(r,o)}async getTransferStatus(r,o){return await this.client.getTransferStatus(r,o)}async getReceiveTransactionCost(r){return await this.client.getReceiveTransactionCost(r)}cachePut(r,o){return this.client.cachePut(r,o)}getPoolInfoByKey(r){return this.client.getPoolInfoByKey(r)}refreshPoolInfo(r){return this.client.refreshPoolInfo(r)}};function Fd(n,r,o){return n.filter(s=>o?!0:s.flags[r]).map(Tg)}function Tg(n){let{flags:r,...o}=n;return o}var Pg=55*1e3,Oi=class{constructor(r){this.client=r;this.poolInfoCache=new vc}poolInfoCache;async getChainDetailsMap(){return(await this.client.getChainDetailsMapAndPoolInfoMap()).chainDetailsMap}async tokens(){return await this.client.tokens()}getTransferStatus(r,o){return this.client.getTransferStatus(r,o)}getReceiveTransactionCost(r){return this.client.getReceiveTransactionCost(r)}getPendingInfo(){return this.client.getPendingInfo()}getGasBalance(r,o){return this.client.getGasBalance(r,o)}async getPoolInfoByKey(r){this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);let o=this.poolInfoCache.get(r);if(o)return o;{let s=await this.client.getPoolInfoMap(r);this.poolInfoCache.putAll(s);let i=s[ko(r)];if(i)return i;throw new U("Cannot find pool info for "+r.poolAddress+" on chain "+r.chainSymbol)}}async refreshPoolInfo(r){let o;if(r)this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap),o=await this.client.getPoolInfoMap(r);else{let s=await this.client.getChainDetailsMapAndPoolInfoMap();o=await this.client.getPoolInfoMap(vd(s.chainDetailsMap))}this.poolInfoCache.putAll(o)}cachePut(r,o){this.poolInfoCache.put(ko(r),o)}},vc=class{cache;constructor(){this.cache=new on({defaultTtl:Pg})}putAll(r){for(let[o,s]of Object.entries(r))this.cache.put(o,s)}putAllIfNotExists(r){for(let[o,s]of Object.entries(r))this.cache.get(o)||this.cache.put(o,s)}put(r,o){this.cache.put(r,o)}get(r){let o=ko(r);return this.cache.get(o)}};var _m=require("web3");var $u;async function Sr(){return $u||($u=(await Promise.resolve().then(()=>(rf(),tf))).default),$u}var Zu=require("big.js");async function dt(n,r){return await n.getPoolInfoByKey({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress})}function ze(n){if((0,Zu.Big)(n).lte(0))throw new Vr("Amount must be greater than zero")}function $e(n,r,o){let s=(0,Zu.Big)(r).toFixed(),[i,a]=s.split(".");if(a&&a.length>o)throw new hs(n,a.length,o)}async function ga(n,r,o){return await Promise.race([n,new Promise((s,i)=>{setTimeout(()=>i(new Fo(r)),o)})])}async function Ju(n,r,o,s){if(o<1)throw new Error(`Bad argument: 'maxRetries' must be greater than 0, but ${o} was received.`);let i=0;for(;;)try{return await ga(n(),r,s)}catch{if(++i>=o)throw new Fo(r)}}async function nf(n,r,o,s=1.5,i=!1){let a=[],c=0,u=await n();if(a.push(u),!r(u))return a;let l=new Date(Date.now()+o*1e3).valueOf(),p=1e3,A=p;for(;Date.now()<l;){let g=a[a.length-1];if(g===void 0||!r(g))break;c++,i&&console.info(`Waiting ${p}ms before trying again (bringing the total wait time to ${A}ms so far, of total ${o*1e3}ms)`),await new Promise(b=>setTimeout(b,p)),p=p*s,new Date(Date.now()+p).valueOf()>l&&(p=l-Date.now(),i&&console.info(`was gonna wait too long; new waitTime: ${p}ms`)),A=p+A;let P=await n(g);a.push(P),i&&r(P)&&console.info(`${c}. Called ${n.name}; ${a.length} prev attempts. Most recent: ${JSON.stringify(a[a.length-1],null,2)}`)}return a}var Pf=require("big.js");var ib={abi:[{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"uint256",name:"_chainPrecision",type:"uint256"},{internalType:"contract Messenger",name:"_allbridgeMessenger",type:"address"},{internalType:"contract WormholeMessenger",name:"_wormholeMessenger",type:"address"},{internalType:"contract IGasOracle",name:"_gasOracle",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"gas",type:"uint256"}],name:"BridgingFeeFromTokens",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"bridgeTransactionCost",type:"uint256"},{indexed:!1,internalType:"uint256",name:"messageTransactionCost",type:"uint256"}],name:"ReceiveFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Received",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes32",name:"sendToken",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"receiveToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"sendAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receiveAmount",type:"uint256"}],name:"Swapped",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{indexed:!1,internalType:"bytes32",name:"message",type:"bytes32"}],name:"TokensReceived",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"receiveToken",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"}],name:"TokensSent",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"addBridgeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract Pool",name:"pool",type:"address"},{internalType:"bytes32",name:"token",type:"bytes32"}],name:"addPool",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"canSwap",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"gasUsage",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"address",name:"tokenAddress",type:"address"}],name:"getBridgingCostInTokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"getMessageCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"getMessageGasUsage",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"getTransactionCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"message",type:"bytes32"},{internalType:"enum MessengerProtocol",name:"protocol",type:"uint8"}],name:"hasReceivedMessage",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"message",type:"bytes32"}],name:"hasSentMessage",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"}],name:"hashMessage",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"otherBridgeTokens",outputs:[{internalType:"bool",name:"isSupported",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"otherBridges",outputs:[{internalType:"bytes32",name:"bridgeAddress",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"tokenId",type:"bytes32"}],name:"pools",outputs:[{internalType:"contract Pool",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"processedMessages",outputs:[{internalType:"uint256",name:"isProcessed",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"}],name:"receiveTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"bridgeAddress",type:"bytes32"}],name:"registerBridge",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_chainId",type:"uint256"},{internalType:"bytes32",name:"tokenAddress",type:"bytes32"}],name:"removeBridgeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"sentMessages",outputs:[{internalType:"uint256",name:"isSent",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract Messenger",name:"_allbridgeMessenger",type:"address"}],name:"setAllbridgeMessenger",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IGasOracle",name:"_gasOracle",type:"address"}],name:"setGasOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"setGasUsage",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_rebalancer",type:"address"}],name:"setRebalancer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_stopAuthority",type:"address"}],name:"setStopAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract WormholeMessenger",name:"_wormholeMessenger",type:"address"}],name:"setWormholeMessenger",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startSwap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopSwap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"token",type:"bytes32"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"}],name:"swap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"token",type:"bytes32"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"bytes32",name:"receiveToken",type:"bytes32"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"enum MessengerProtocol",name:"messenger",type:"uint8"},{internalType:"uint256",name:"feeTokenAmount",type:"uint256"}],name:"swapAndBridge",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token",type:"address"}],name:"withdrawBridgingFeeInTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawGasTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},of=ib;var ab={abi:[{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"},{internalType:"uint256",name:"chainPrecision_",type:"uint256"},{internalType:"address",name:"tokenAddress",type:"address"},{internalType:"address",name:"cctpMessenger_",type:"address"},{internalType:"address",name:"cctpTransmitter_",type:"address"},{internalType:"contract IGasOracle",name:"gasOracle_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ReceivedExtraGas",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ReceivedGas",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"newRecipient",type:"bytes32"}],name:"RecipientReplaced",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"recipientWalletAddress",type:"bytes32"}],name:"TokensSentExtras",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"bytes32",name:"recipient",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"destinationChainId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeFromGas",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeFromTokens",type:"uint256"},{indexed:!1,internalType:"uint256",name:"relayerFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"receivedRelayerFeeTokenAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"adminFeeTokenAmount",type:"uint256"}],name:"TokensSent",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"adminFeeShareBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"uint256",name:"relayerFeeTokenAmount",type:"uint256"}],name:"bridge",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"},{internalType:"bytes32",name:"recipientWalletAddress",type:"bytes32"},{internalType:"uint256",name:"destinationChainId",type:"uint256"},{internalType:"uint256",name:"relayerFeeTokenAmount",type:"uint256"}],name:"bridgeWithWalletAddress",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"chainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"originalMessage",type:"bytes"},{internalType:"bytes",name:"originalAttestation",type:"bytes"},{internalType:"bytes32",name:"newRecipient",type:"bytes32"}],name:"changeRecipient",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"gasUsage",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"destinationChainId",type:"uint256"}],name:"getBridgingCostInTokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"}],name:"getDomainByChainId",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"}],name:"getTransactionCost",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"sourceChainId",type:"uint256"},{internalType:"uint64",name:"nonce",type:"uint64"}],name:"isMessageProcessed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bytes",name:"message",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"receiveTokens",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"},{internalType:"uint32",name:"domain",type:"uint32"}],name:"registerBridgeDestination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"adminFeeShareBP_",type:"uint256"}],name:"setAdminFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IGasOracle",name:"gasOracle_",type:"address"}],name:"setGasOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"uint256",name:"gasAmount",type:"uint256"}],name:"setGasUsage",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"chainId_",type:"uint256"}],name:"unregisterBridgeDestination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawFeeInTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawGas",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},sf=ab;var ba=be(require("@project-serum/anchor")),el=require("@solana/web3.js");var It=be(require("@project-serum/anchor")),Mt=require("@solana/web3.js");async function vr(n,r){return It.utils.token.associatedAddress({mint:r,owner:n})}async function En(n){let[r]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("config")],n);return r}async function af(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("lock"),Uint8Array.from(n)],r);return o}async function Hs(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("price_v2"),Uint8Array.from([n])],r);return o}async function Xo(n){let r=await En(n),[o]=await Mt.PublicKey.findProgramAddress([r.toBuffer()],n);return o}async function cf(n,r){let[o]=await Mt.PublicKey.findProgramAddress([n.toBuffer()],r);return o}async function Yo(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("token"),n.toBytes()],r);return o}async function uf(n,r,o){let[s]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("other_bridge_token"),Buffer.from([n]),r],o);return s}async function Hu(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("chain_bridge"),Uint8Array.from([n])],r);return o}async function Ku(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("gas_usage"),Uint8Array.from([n])],r);return o}async function lf(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("sent_message"),n],r);return o}async function Xu(n,r,o){let[s]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("user_deposit"),r.toBytes(),n.toBytes()],o);return s}async function df(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("cctp_bridge"),n.toBytes()],r);return o}async function pf(n,r){let[o]=await Mt.PublicKey.findProgramAddress([It.utils.bytes.utf8.encode("token"),n.toBytes()],r);return o}function Af(n,r){let[o]=Mt.PublicKey.findProgramAddressSync([It.utils.bytes.utf8.encode("lock"),r.toBuffer()],n);return o}function ff(n,r,o,s){let i=fo("message_transmitter",o),a=fo("token_messenger",s),c=fo("__event_authority",s),u=fo("token_minter",s),l=fo("local_token",s,[r]),p=fo("remote_token_messenger",s,[n.toString()]),A=fo("sender_authority",s);return{messageTransmitterAccount:i,tokenMessenger:a,tokenMessengerEventAuthority:c,tokenMinter:u,localToken:l,remoteTokenMessengerKey:p,authorityPda:A}}function fo(n,r,o=[]){let s=[Buffer.from(It.utils.bytes.utf8.encode(n))];for(let a of o)typeof a=="string"?s.push(Buffer.from(It.utils.bytes.utf8.encode(a))):Array.isArray(a)||Buffer.isBuffer(a)?s.push(Buffer.from(Uint8Array.from(a))):s.push(Buffer.from(Uint8Array.from(a.toBuffer())));return Mt.PublicKey.findProgramAddressSync(s,r)[0]}var mf=require("@project-serum/anchor"),ha=require("@solana/web3.js");function xn(n,r){let o=new ha.Connection(n,"confirmed"),s=new ha.PublicKey(r);return new mf.AnchorProvider(o,{publicKey:s},{preflightCommitment:"confirmed",commitment:"confirmed"})}var hf=require("@solana/web3.js"),yf=require("@stellar/stellar-sdk"),Yr=require("big.js"),Yu=be(require("randombytes"));async function An(n,r,o){let s;switch(r){case"EVM":{s=gf(n);break}case"SOLANA":{s=new hf.PublicKey(n).toBuffer();break}case"TRX":{s=await cb(n);break}case"SRB":{s=new yf.Address(n).toBuffer();break}case"SUI":{s=gf(n);break}}switch(o){case"EVM":return"0x"+s.toString("hex");case"SOLANA":return Array.from(s);case"TRX":return s;case"SRB":return s.toJSON().data;case"SUI":return"0x"+s.toString("hex")}}function Ir(n){return n.replace(/^0x/i,"")}function bf(n){return Buffer.from(n.replace(/^0x/i,""),"hex")}function gf(n){let o=bf(n);return Buffer.concat([Buffer.alloc(32-o.length,0),o],32)}async function cb(n){let r=await Ks(n),o=bf(r);return ub(o,32)}async function Ks(n){let{utils:r}=await Sr(),o=r.crypto.decodeBase58Address(n);return o?r.bytes.byteArray2hexStr(o).replace(/^41/,"0x"):""}function ub(n,r){if(n.length>=r)return n;let o=Buffer.alloc(r,0);return n.copy(o,r-n.length),o}function ya(){return(0,Yu.default)(32)}function qr(){let n=(0,Yu.default)(32).readBigInt64BE();return n<0?n*-1n:n}async function Qr(n,r){let o={},s=r.sourceToken;if(o.amount=xe(r.amount,s.decimals).toFixed(),o.contractAddress=s.bridgeAddress,o.fromAccountAddress=r.fromAccountAddress,n==="SUI"){if(!s.originTokenAddress)throw new U("SUI sourceToken must contain 'originTokenAddress'");o.fromTokenAddress=s.originTokenAddress}else o.fromTokenAddress=await An(s.tokenAddress,n,n);if(o.toAccountAddress=r.toAccountAddress,n==="SUI"){if(!r.destinationToken.originTokenAddress)throw new U("SUI destinationToken must contain 'originTokenAddress'");o.toTokenAddress=r.destinationToken.originTokenAddress}else o.toTokenAddress=await An(r.destinationToken.tokenAddress,n,n);return o.minimumReceiveAmount=r.minimumReceiveAmount?xe(r.minimumReceiveAmount,r.destinationToken.decimals).toFixed():"0",o}async function Mr(n,r,o){let s={};s.fromChainId=r.sourceToken.allbridgeChainId,s.fromChainSymbol=r.sourceToken.chainSymbol;let i=Re.getChainProperty(r.destinationToken.chainSymbol).chainType;if(n==="SUI"){if(!r.sourceToken.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");s.fromTokenAddress=r.sourceToken.originTokenAddress}else s.fromTokenAddress=r.sourceToken.tokenAddress;s.toChainId=r.destinationToken.allbridgeChainId,s.toTokenAddress=r.destinationToken.tokenAddress,r.gasFeePaymentMethod==="stablecoin"?s.gasFeePaymentMethod="stablecoin":s.gasFeePaymentMethod="native";let a=r.sourceToken;if(r.messenger===3){if(!a.cctpAddress||!r.destinationToken.cctpAddress)throw new Ct("Such route does not support CCTP protocol");s.contractAddress=a.cctpAddress}else if(r.messenger===4){if(!a.cctpV2Address||!r.destinationToken.cctpV2Address)throw new Ct("Such route does not support CCTP V2 protocol");s.contractAddress=a.cctpV2Address}else s.contractAddress=a.bridgeAddress;s.messenger=r.messenger,s.fromAccountAddress=r.fromAccountAddress,s.amount=xe(r.amount,a.decimals).toFixed();let{fee:c,feeFormat:u}=r;if(!c){let g=(await qu(s.fromChainId,r.sourceToken.chainType,s.toChainId,a.decimals,s.messenger,o))[s.gasFeePaymentMethod];if(!g)throw new Mo;c=g.int,u="int"}if(u=="float")switch(s.gasFeePaymentMethod){case"native":s.fee=xe(c,Re.getChainDecimalsByType(a.chainType)).toFixed(0);break;case"stablecoin":s.fee=xe(c,a.decimals).toFixed(0);break}else s.fee=c;let{extraGas:l,extraGasFormat:p}=r;if(l&&+l>0){if(p=="float")switch(s.gasFeePaymentMethod){case"native":s.extraGas=xe(l,Re.getChainDecimalsByType(a.chainType)).toFixed(0);break;case"stablecoin":s.extraGas=xe(l,a.decimals).toFixed(0);break}else s.extraGas=l;await db(s.extraGas,s.gasFeePaymentMethod,a,r.destinationToken,o)}return n!=="SUI"&&(s.fromTokenAddress=await An(s.fromTokenAddress,n,n)),s.toAccountAddress=await An(r.toAccountAddress,i,n),s.toTokenAddress=await An(s.toTokenAddress,i,n),s.gasFeePaymentMethod=="stablecoin"&&lb(s.amount,a.decimals,s.fee,s.extraGas),s}function lb(n,r,o,s){let i=(0,Yr.Big)(n).minus(o).minus(s??0);if(i.lte(0))throw new Ln(`Amount not enough to pay fee, ${Ce((0,Yr.Big)(i).minus(1).neg(),r).toFixed()} stables is missing`)}async function qu(n,r,o,s,i,a){let c=await a.getReceiveTransactionCost({sourceChainId:n,destinationChainId:o,messenger:i}),u={native:{int:c.fee,float:Ce(c.fee,Re.getChainDecimalsByType(r)).toFixed()}};if(c.sourceNativeTokenPrice){let l=Lr(new Yr.Big(c.fee).mul(c.sourceNativeTokenPrice),Re.getChainDecimalsByType(r),s).toFixed(0,Yr.Big.roundUp);u.stablecoin={int:l,float:Ce(l,s).toFixed()}}return u}async function db(n,r,o,s,i){let c=(await Qu(o,s,i)).extraGasMax[r];if(!c)throw new Mo(`Impossible to pay extra gas by '${r}' payment method`);let u=c.int;if((0,Yr.Big)(n).gt(u))throw new gs(`Extra gas ${n} in int format, exceeded limit ${u} for '${r}' payment method`)}async function Qu(n,r,o){let s={},i=await o.getReceiveTransactionCost({sourceChainId:n.allbridgeChainId,destinationChainId:r.allbridgeChainId,messenger:1}),a=r.txCostAmount.maxAmount,c=Ce(a,Re.getChainDecimalsByType(r.chainType)).toFixed(),u=(0,Yr.Big)(c).div(i.exchangeRate).toFixed(Re.getChainDecimalsByType(n.chainType),Yr.Big.roundDown),l=xe(u,Re.getChainDecimalsByType(n.chainType)).toFixed(0);if(s.native={int:l,float:u},i.sourceNativeTokenPrice){let p=(0,Yr.Big)(u).mul(i.sourceNativeTokenPrice).toFixed(n.decimals,Yr.Big.roundDown);s.stablecoin={int:xe(p,n.decimals).toFixed(0),float:p}}return{extraGasMax:s,destinationChain:{gasAmountMax:{int:a,float:c},swap:{int:r.txCostAmount.swap,float:Ce(r.txCostAmount.swap,Re.getChainDecimalsByType(r.chainType)).toFixed()},transfer:{int:r.txCostAmount.transfer,float:Ce(r.txCostAmount.transfer,Re.getChainDecimalsByType(r.chainType)).toFixed()}},exchangeRate:i.exchangeRate,sourceNativeTokenPrice:i.sourceNativeTokenPrice}}function Tf(n){return n.sourceToken.chainSymbol!==n.destinationToken.chainSymbol}async function Ta(n,r,o,s){let i,a=new el.PublicKey(r),c=new el.PublicKey(o),u=await vr(a,c),l=xn(s,r);ba.setProvider(l);let p=await ba.Spl.token(l).account.token.fetchNullable(u);if(p?.authority.equals(a))i=await An(u.toBase58(),"SOLANA",n);else{let A=await l.connection.getTokenAccountsByOwner(a,{mint:c});if(A.value.length===0&&!p)i=await An(u.toBase58(),"SOLANA",n);else if(A.value.length>0){let g=A.value[0];if(!g?.pubkey)throw new U("First token account or its public key is undefined");i=await An(g.pubkey.toBase58(),"SOLANA",n)}else throw new U("Associated account has wrong owner")}return i}var sr=class{};var Ys=class extends sr{constructor(o,s,i){super();this.web3=o;this.api=s;this.nodeRpcUrlsConfig=i}chainType="EVM";async send(o){let s=await this.buildRawTransactionSend(o);return this.sendRawTransaction(s)}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o,g=this.getBridgeContract(i).methods.swap(s,c,l,u,p);return Promise.resolve({from:a,to:i,data:g.encodeABI()})}async buildRawTransactionSend(o){let s=await Mr(this.chainType,o,this.api),{amount:i,contractAddress:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,toTokenAddress:A,messenger:g,fee:P,gasFeePaymentMethod:b,extraGas:S}=s,I="0x"+ya().toString("hex"),F,j,G=P;if(S&&(G=(0,Pf.Big)(G).plus(S).toFixed()),g===3||g===4){let $=await this.buildRawTransactionCctpSend(o,s,G);F=$.sendMethod,j=$.value}else{let $=this.getBridgeContract(a);b==="stablecoin"?(F=$.methods.swapAndBridge(u,i,p,l,A,I,g,G),j="0"):(F=$.methods.swapAndBridge(u,i,p,l,A,I,g,0),j=G)}return Promise.resolve({from:c,to:a,value:j,data:F.encodeABI()})}async buildRawTransactionCctpSend(o,s,i){let{amount:a,contractAddress:c,toChainId:u,toAccountAddress:l,gasFeePaymentMethod:p}=s,A=this.getCctpBridgeContract(c),g,P;if(o.destinationToken.chainType==="SOLANA"){let b=await Ta(this.chainType,o.toAccountAddress,o.destinationToken.tokenAddress,this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"));p==="stablecoin"?(g=A.methods.bridgeWithWalletAddress(a,b,l,u,i),P="0"):(g=A.methods.bridgeWithWalletAddress(a,b,l,u,0),P=i)}else p==="stablecoin"?(g=A.methods.bridge(a,l,u,i),P="0"):(g=A.methods.bridge(a,l,u,0),P=i);return{sendMethod:g,value:P}}async sendRawTransaction(o){let s=await this.web3.eth.estimateGas(o),i={maxPriorityFeePerGas:null,maxFeePerGas:null},{transactionHash:a}=await this.web3.eth.sendTransaction({...o,gas:s,...i});return{txId:a.toString()}}getBridgeContract(o){return new this.web3.eth.Contract(of.abi,o)}getCctpBridgeContract(o){return new this.web3.eth.Contract(sf.abi,o)}};var Pa=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i}async approve(r,o){let s,i;o?(s=r,i=o):i=r;let a=qs(i.token,i.messenger);return this.tokenService.buildRawTransactionApprove({...i,spender:a},s)}async send(r,o){return ze(r.amount),$e("amount",r.amount,r.sourceToken.decimals),Tf(r)?(await wa(r.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionSend(r):(await wa(r.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionSwap(r)}};var Ye=require("@project-serum/anchor"),Ee=require("@solana/web3.js"),gr=require("big.js");var Qs={version:"0.1.0",name:"bridge",instructions:[{name:"initialize",accounts:[{name:"admin",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializeArgs"}}]},{name:"initializePool",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"token",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializePoolArgs"}}]},{name:"initDepositAccount",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"deposit",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"withdraw",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"amountLp",type:"u64"}]},{name:"swapAndBridge",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"messenger",isMut:!1,isSigner:!1},{name:"messengerConfig",isMut:!0,isSigner:!1},{name:"sentMessageAccount",isMut:!0,isSigner:!1},{name:"messengerGasUsage",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"swapAndBridgeWormhole",accounts:[{name:"user",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"wormholeMessenger",isMut:!1,isSigner:!1},{name:"wormholeMessengerConfig",isMut:!0,isSigner:!1},{name:"wormholeProgram",isMut:!1,isSigner:!1},{name:"bridge",isMut:!0,isSigner:!1},{name:"message",isMut:!0,isSigner:!0},{name:"sequence",isMut:!0,isSigner:!1},{name:"feeCollector",isMut:!0,isSigner:!1},{name:"messengerGasUsage",isMut:!1,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"swap",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"sendMint",isMut:!1,isSigner:!1},{name:"receiveMint",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1},{name:"sendPool",isMut:!0,isSigner:!1},{name:"receivePool",isMut:!0,isSigner:!1},{name:"sendBridgeToken",isMut:!0,isSigner:!1},{name:"receiveBridgeToken",isMut:!0,isSigner:!1},{name:"sendUserToken",isMut:!0,isSigner:!1},{name:"receiveUserToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"},{name:"receiveAmountMin",type:"u64"}]},{name:"registerChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"RegisterChainBridgeArgs"}}]},{name:"updateChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateChainBridgeArgs"}}]},{name:"receiveAndSwap",accounts:[{name:"user",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"receivedMessageAccount",isMut:!1,isSigner:!1},{name:"unlock",isMut:!0,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"messengerProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UnlockArgs"}}]},{name:"receiveAndSwapWormhole",accounts:[{name:"user",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"receivedMessageAccount",isMut:!1,isSigner:!1},{name:"unlock",isMut:!0,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"messengerProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UnlockArgs"}}]},{name:"withdrawGasToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"recipient",isMut:!0,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"claimRewards",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"setAdmin",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"newAdmin",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[]},{name:"startBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"actionType",type:{defined:"ActionType"}}]},{name:"stopBridge",accounts:[{name:"stopAuthority",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"actionType",type:{defined:"ActionType"}}]},{name:"setRebalancer",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"rebalancer",isMut:!1,isSigner:!1}],args:[]},{name:"setStopAuthority",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"newAuthority",isMut:!1,isSigner:!1},{name:"config",isMut:!0,isSigner:!1}],args:[]},{name:"setAllbridgeMessengerProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setWormholeMessengerProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setGasOracleProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"setPoolFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"setBalanceRatioMin",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"balanceRatioMinBp",type:"u16"}]},{name:"setPoolAdminFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"addOtherBridgeToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!1,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"chainId",type:"u8"},{name:"tokenAddress",type:{array:["u8",32]}}]},{name:"removeOtherBridgeToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"config",isMut:!0,isSigner:!1},{name:"otherBridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"chainId",type:"u8"},{name:"tokenAddress",type:{array:["u8",32]}}]},{name:"withdrawAdminFee",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"adminToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"adjustTotalLpAmount",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"config",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"userDeposit",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]}],accounts:[{name:"chainBridge",type:{kind:"struct",fields:[{name:"address",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"config",type:{kind:"struct",fields:[{name:"admin",type:"publicKey"},{name:"allbridgeMessengerProgramId",type:"publicKey"},{name:"wormholeMessengerProgramId",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"},{name:"rebalancer",type:"publicKey"},{name:"stopAuthority",type:"publicKey"},{name:"authorityBumpSeed",type:"u8"},{name:"canSwap",type:"bool"},{name:"canDeposit",type:"bool"},{name:"canWithdraw",type:"bool"}]}},{name:"lock",type:{kind:"struct",fields:[{name:"sender",type:"publicKey"},{name:"sentTokenAddress",type:"publicKey"},{name:"amount",type:"u64"},{name:"vusdAmount",type:"u64"},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"nonce",type:{array:["u8",32]}},{name:"messenger",type:{defined:"Messenger"}},{name:"slot",type:"u64"},{name:"fee",type:"u64"}]}},{name:"otherBridgeToken",type:{kind:"struct",fields:[]}},{name:"pool",type:{kind:"struct",fields:[{name:"mint",type:"publicKey"},{name:"a",type:"u64"},{name:"d",type:"u64"},{name:"tokenBalance",type:"u64"},{name:"vUsdBalance",type:"u64"},{name:"reserves",type:"u64"},{name:"decimals",type:"u8"},{name:"totalLpAmount",type:"u64"},{name:"feeShareBp",type:"u64"},{name:"adminFeeShareBp",type:"u64"},{name:"accRewardPerShareP",type:"u128"},{name:"adminFeeAmount",type:"u64"},{name:"balanceRatioMinBp",type:"u16"}]}},{name:"unlock",type:{kind:"struct",fields:[{name:"hash",type:{array:["u8",32]}},{name:"amount",type:"u64"},{name:"fee",type:"u64"},{name:"vUsdAmount",type:"u64"},{name:"slot",type:"u64"}]}},{name:"userDeposit",type:{kind:"struct",fields:[{name:"userAddress",type:"publicKey"},{name:"mint",type:"publicKey"},{name:"lpAmount",type:"u64"},{name:"rewardDebt",type:"u64"}]}}],types:[{name:"RegisterChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainBridgeAddress",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"UpdateChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainBridgeAddress",type:{array:["u8",32]}},{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"}]}},{name:"InitializeArgs",type:{kind:"struct",fields:[{name:"allbridgeMessengerProgramId",type:"publicKey"},{name:"wormholeMessengerProgramId",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"}]}},{name:"InitializePoolArgs",type:{kind:"struct",fields:[{name:"a",type:"u64"},{name:"feeShareBp",type:"u64"},{name:"adminFeeShareBp",type:"u64"},{name:"balanceRatioMinBp",type:"u16"}]}},{name:"BridgeArgs",type:{kind:"struct",fields:[{name:"nonce",type:{array:["u8",32]}},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"vusdAmount",type:"u64"}]}},{name:"UnlockArgs",type:{kind:"struct",fields:[{name:"nonce",type:{array:["u8",32]}},{name:"amount",type:"u64"},{name:"recipient",type:"publicKey"},{name:"sourceChainId",type:"u8"},{name:"receiveToken",type:"publicKey"},{name:"messenger",type:{defined:"Messenger"}},{name:"hash",type:{array:["u8",32]}},{name:"receiveAmountMin",type:"u64"}]}},{name:"RewardError",type:{kind:"enum",variants:[{name:"FeeTooHigh"}]}},{name:"Messenger",type:{kind:"enum",variants:[{name:"None"},{name:"Allbridge"},{name:"Wormhole"}]}},{name:"ActionType",type:{kind:"enum",variants:[{name:"Deposit"},{name:"Withdraw"},{name:"Swap"}]}}],errors:[{code:6e3,name:"AccountAlreadyInitialized",msg:"This account has already been initialized"},{code:6001,name:"AdminAuthorityInvalid",msg:"This instruction requires admin authority"},{code:6002,name:"InvalidSignature",msg:"Provided signature has wrong signer or message"},{code:6003,name:"InvalidHash",msg:"Wrong unlock message hash"},{code:6004,name:"PoolOverflow",msg:"PoolInfo overflow"},{code:6005,name:"ReservesExhausted",msg:"Reserves exhausted"},{code:6006,name:"ZeroAmount",msg:"Zero amount"},{code:6007,name:"ZeroChanges",msg:"Zero changes"},{code:6008,name:"HighVusdAmount",msg:"vUSD amount is too high"},{code:6009,name:"BalanceRatioExceeded",msg:"Balance ratio exceeded"},{code:6010,name:"InsufficientReceivedAmount",msg:"Received insufficient amount"},{code:6011,name:"ForbiddenAction",msg:"ForbiddenAction"},{code:6012,name:"ValueTooHigh",msg:"Value is too high"}]};var wf={version:"0.1.0",name:"cctp_bridge",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"admin",isMut:!0,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"InitializeArgs"}}]},{name:"bridge",accounts:[{name:"user",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"lock",isMut:!0,isSigner:!1},{name:"mint",isMut:!0,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1},{name:"cctpMessenger",isMut:!1,isSigner:!1},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"messageTransmitterAccount",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"remoteTokenMessengerKey",isMut:!1,isSigner:!1},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"gasPrice",isMut:!1,isSigner:!1},{name:"thisGasPrice",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!1,isSigner:!1},{name:"userToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"BridgeArgs"}}]},{name:"registerChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"RegisterChainBridgeArgs"}}]},{name:"updateChainBridge",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"chainBridge",isMut:!0,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateChainBridgeArgs"}}]},{name:"setAdminFeeShare",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"feeShareBp",type:"u64"}]},{name:"setGasOracleProgramId",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]},{name:"withdrawGasToken",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"recipient",isMut:!0,isSigner:!1},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"amount",type:"u64"}]},{name:"withdrawAdminFee",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!1,isSigner:!1},{name:"bridgeToken",isMut:!0,isSigner:!1},{name:"adminToken",isMut:!0,isSigner:!1},{name:"bridgeAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[]},{name:"setCctpTokenMessengerMinter",accounts:[{name:"admin",isMut:!1,isSigner:!0},{name:"mint",isMut:!1,isSigner:!1},{name:"cctpBridge",isMut:!0,isSigner:!1}],args:[{name:"newProgramId",type:"publicKey"}]}],accounts:[{name:"cctpBridge",type:{kind:"struct",fields:[{name:"mint",type:"publicKey"},{name:"admin",type:"publicKey"},{name:"cctpTokenMessengerMinter",type:"publicKey"},{name:"gasOracleProgramId",type:"publicKey"},{name:"authorityBumpSeed",type:"u8"},{name:"adminFeeShareBp",type:"u64"},{name:"adminFeeAmount",type:"u64"}]}},{name:"chainBridge",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"}]}},{name:"lock",type:{kind:"struct",fields:[{name:"sender",type:"publicKey"},{name:"amount",type:"u64"},{name:"adminFee",type:"u64"},{name:"relayerFee",type:"u64"},{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"slot",type:"u64"}]}}],types:[{name:"RegisterChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"},{name:"mint",type:"publicKey"}]}},{name:"UpdateChainBridgeArgs",type:{kind:"struct",fields:[{name:"chainId",type:"u8"},{name:"gasUsage",type:"u64"},{name:"domain",type:"u32"},{name:"mint",type:"publicKey"}]}},{name:"BridgeArgs",type:{kind:"struct",fields:[{name:"recipient",type:{array:["u8",32]}},{name:"destinationChainId",type:"u8"},{name:"receiveToken",type:{array:["u8",32]}},{name:"amount",type:"u64"}]}},{name:"InitializeArgs",type:{kind:"struct",fields:[{name:"gasOracleProgramId",type:"publicKey"},{name:"cctpTokenMessengerMinter",type:"publicKey"}]}}],errors:[{code:6e3,name:"ValueTooHigh",msg:"Value is too high"}]};var Cf=require("@project-serum/anchor"),Bf=be(require("big.js")),ei=require("web3");async function qo(n,r){return await Cf.Spl.token(r).account.token.fetch(n)}async function Wf(n,r,o){let s=await r.account.pool.fetch(o),i=s.decimals,a=(0,Bf.default)(s.feeShareBp.toString()).div(1e4).toFixed(),c={aValue:s.a.toString(),dValue:s.d.toString(),totalLpAmount:s.totalLpAmount.toString(),tokenBalance:s.tokenBalance.toString(),vUsdBalance:s.vUsdBalance.toString(),accRewardPerShareP:s.accRewardPerShareP.toString()};return $r(n,{decimals:i,feeShare:a},c)}function Sf(n){let r=n.amount,o="0x"+n.recipient.toString("hex"),s=n.sourceChainId,i=n.destinationChainId,a="0x"+n.receiveToken.toString("hex"),c="0x"+n.nonce.toString("hex"),u=1,l="0x"+n.chainBridge.toString("hex"),p=ei.Web3.utils.encodePacked({t:"uint256",v:r},{t:"bytes32",v:o},{t:"uint256",v:s},{t:"bytes32",v:a},{t:"uint256",v:c},{t:"uint8",v:u});if(!p)throw new U("message cannot be undefined");let A=ei.Web3.utils.keccak256(Buffer.from(p.replace("0x",""),"hex")),g=Buffer.from(A.replace("0x",""),"hex");g[0]=s,g[1]=i;let P=ei.Web3.utils.encodePacked({t:"bytes32",v:"0x"+g.toString("hex")},{t:"bytes32",v:l});if(!P)throw new $n("messageWithSigner cannot be undefined");let b=ei.Web3.utils.keccak256(Buffer.from(P.replace("0x",""),"hex")),S=Buffer.from(b.replace("0x",""),"hex");return S[0]=g[0],S[1]=g[1],S}var ir=require("@solana/web3.js"),vf=require("big.js");var tl=require("@solana/web3.js");async function mo(n,r){return await Promise.all(n.message.addressTableLookups.map(async o=>new tl.AddressLookupTableAccount({key:o.accountKey,state:tl.AddressLookupTableAccount.deserialize(await r.getAccountInfo(o.accountKey).then(s=>{if(!s)throw new U("Cannot get AccountInfo");return s.data}))})))}var Ca="AUTO";async function Qo(n,r,o){let s=new ir.Connection(o,"confirmed"),i=(await s.simulateTransaction(n)).value.unitsConsumed;await Mf(n.instructions,i,r,s)}async function If(n,r,o){let s=new ir.Connection(o,"confirmed"),i=await mo(n,s),a=ir.TransactionMessage.decompile(n.message,{addressLookupTableAccounts:i});if(n.serialize().length>1232)throw new bs;await Mf(a.instructions,769230,r,s),n.message=a.compileToV0Message(i)}async function Mf(n,r,o,s){if(r>0){let i=pb(r,n);if(o?.solana){let a=o.solana;if(a===Ca)await rl(n,s);else if("pricePerUnitInMicroLamports"in a)await rl(n,s,a.pricePerUnitInMicroLamports);else{let c=(0,vf.Big)(a.extraFeeInLamports).div(i).mul(Ts(6)).toFixed(0);await rl(n,s,c)}}}}function pb(n,r){let o=r.findIndex(a=>a.programId.equals(ir.ComputeBudgetProgram.programId)&&ir.ComputeBudgetInstruction.decodeInstructionType(a)==="SetComputeUnitLimit"),s=Number((n*1.3).toFixed(0)),i=ir.ComputeBudgetProgram.setComputeUnitLimit({units:s});return o>=0?r[o]=i:r.push(i),s.toString()}async function rl(n,r,o){let s=n.findIndex(c=>c.programId.equals(ir.ComputeBudgetProgram.programId)&&ir.ComputeBudgetInstruction.decodeInstructionType(c)==="SetComputeUnitPrice"),i=BigInt(o||await Ab(r)),a=ir.ComputeBudgetProgram.setComputeUnitPrice({microLamports:i});return s>=0?n[s]=a:n.push(a),i.toString()}async function Ab(n){let r=await n.getRecentPrioritizationFees(),o=0;for(let s of r)o+=s.prioritizationFee;return(o/r.length).toFixed(0)}var Rf=require("@solana/spl-token"),go=require("@solana/web3.js"),es=be(require("axios"));var Ba=class{connection;jupiterUrl;apiKeyHeader;maxAccounts;constructor(r,o){this.connection=new go.Connection(r),this.jupiterUrl=o.jupiterUrl.replace(/\/$/,""),this.apiKeyHeader=o.jupiterApiKeyHeader,this.maxAccounts=o.jupiterMaxAccounts}async getJupiterSwapTx(r,o,s,i){let a;try{let g=i?"ExactOut":"ExactIn",P=`${this.jupiterUrl}/quote?inputMint=${o}&outputMint=${Rf.NATIVE_MINT.toString()}&amount=${s}&swapMode=${g}&slippageBps=100&onlyDirectRoutes=true`;this.maxAccounts&&(P+=`&maxAccounts=${this.maxAccounts}`),a=await es.default.get(P,{headers:this.apiKeyHeader?{"x-api-key":this.apiKeyHeader}:void 0})}catch(g){throw g instanceof es.AxiosError&&g.response&&g.response.data&&g.response.data.error?new gt(g.response.data.error):new gt("Cannot get route")}let c;if(i&&a?.data?.inAmount)c=a.data.inAmount;else if(i)throw new gt("Cannot get inAmount");let u;try{u=await es.default.post(`${this.jupiterUrl}/swap`,{quoteResponse:a.data,userPublicKey:r,wrapAndUnwrapSol:!0},{headers:this.apiKeyHeader?{"x-api-key":this.apiKeyHeader}:void 0})}catch(g){throw g instanceof es.AxiosError&&g.response&&g.response.data&&g.response.data.error?new gt(g.response.data.error):new gt("Cannot get swap transaction")}let l;if(u?.data?.swapTransaction)l=u.data.swapTransaction;else throw new gt("Cannot get swap transaction");let p=Buffer.from(l,"base64"),A=go.VersionedTransaction.deserialize(p);return i?{tx:A,amountIn:c}:{tx:A}}async amendJupiterWithSdkTx(r,o){try{let s=await mo(r,this.connection),i=await mo(o,this.connection),a=go.TransactionMessage.decompile(r.message,{addressLookupTableAccounts:s}),c=go.TransactionMessage.decompile(o.message,{addressLookupTableAccounts:i});if(c.instructions.shift(),a.instructions.push(...c.instructions),s.push(...i),r.message=a.compileToV0Message(s),o.message.header.numRequiredSignatures===2&&r.signatures.length===1){let u=o.signatures[0];if(!u)throw new U("Signature is undefined");r.signatures.push(u)}return r}catch(s){throw s instanceof Error&&s.message?new gt(`Some error occurred during creation final swap and bridge transaction. ${s.message}`):new gt("Some error occurred during creation final swap and bridge transaction")}}};var nl=1e6,Ff=1.1,Wa=class extends sr{constructor(o,s,i){super();this.solanaRpcUrl=o;this.params=s;this.api=i;this.jupiterService=new Ba(o,s.jupiterParams)}chainType="SOLANA";jupiterService;async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildSwapTransaction(s,o.sourceToken.poolAddress,o.destinationToken.poolAddress,o.txFeeParams)}async buildSwapTransaction(o,s,i,a){let{fromAccountAddress:c,amount:u,contractAddress:l,fromTokenAddress:p,toTokenAddress:A,toAccountAddress:g,minimumReceiveAmount:P}=o,b=c,S=l,I=p,F=A,j=i,G=g,$=new Ee.PublicKey(b),q=xn(this.solanaRpcUrl,$.toString()),de=new Ye.Program(Qs,S,q),oe=await Xo(de.programId),ot=await En(de.programId),De=new Ee.PublicKey(I),Ge=await Yo(De,de.programId),pt=new Ee.PublicKey(s),zt=await vr($,De),At=new Ee.PublicKey(G),Me=new Ee.PublicKey(F),Ne=await Yo(Me,de.programId),ft=new Ee.PublicKey(j),mt=await vr(At,Me),Vt=[Ye.web3.ComputeBudgetProgram.setComputeUnitLimit({units:nl})];try{await qo(mt,q)}catch{let rg=await Ye.Spl.associatedToken(q).methods.create().accounts({mint:Me,owner:At,associatedAccount:mt}).instruction();Vt.push(rg)}let pr=await de.methods.swap(new Ye.BN(u),new Ye.BN(P||0)).accounts({payer:$,config:ot,bridgeAuthority:oe,user:$,sendBridgeToken:Ge,sendMint:De,sendPool:pt,sendUserToken:zt,receiveBridgeToken:Ne,receiveMint:Me,receivePool:ft,receiveUserToken:mt}).preInstructions(Vt).transaction(),Tr=q.connection;return pr.recentBlockhash=(await Tr.getLatestBlockhash()).blockhash,pr.feePayer=$,await Qo(pr,a,this.solanaRpcUrl),await this.convertToVersionedTransaction(pr,Tr)}async buildRawTransactionSend(o){let s=await Mr(this.chainType,o,this.api),i=this.addPoolAddress(o,s),a=i.gasFeePaymentMethod=="stablecoin",c;if(a)try{let{tx:p,solTxSendUpdatedParams:A}=await this.processJup(i,o,!0);c=p,i={...i,...A}}catch{try{let{tx:A,solTxSendUpdatedParams:g}=await this.processJup(i,o,!1);c=A,i={...i,...g}}catch(A){throw A instanceof tt?A:A instanceof Error&&A.message?new gt(`Some error occurred during creation Jupiter swap transaction. ${A.message}`):new gt("Some error occurred during creation Jupiter swap transaction")}}let u,l;switch(s.messenger){case 1:{let p=await this.prepareSwapAndBridgeData(i);u=await this.buildSwapAndBridgeAllbridgeTransaction(p);break}case 2:{let p=await this.prepareSwapAndBridgeData(i),{transaction:A,messageAccount:g}=await this.buildSwapAndBridgeWormholeTransaction(p);u=A,l=g;break}case 3:case 4:{let p=await this.prepareSwapAndBridgeCctpData(i),{transaction:A,messageSentEventDataKeypair:g}=await this.buildSwapAndBridgeCctpTransaction(o.destinationToken.chainSymbol,p);u=A,l=g;break}}if(a){if(!c)throw new gt("Swap tx is absent");u=await this.jupiterService.amendJupiterWithSdkTx(c,u)}return await If(u,o.txFeeParams,this.solanaRpcUrl),l&&u.sign([l]),u}async processJup(o,s,i){let{fee:a,extraGas:c,gasFeePaymentMethod:u}=await this.convertStableCoinFeeAndExtraGasToNativeCurrency(s.sourceToken.decimals,o),l=i?(0,gr.Big)(a):(0,gr.Big)(o.fee);c&&(l=l.plus(c)),i||(l=l.mul(Ff));let{tx:p,amountIn:A}=await this.jupiterService.getJupiterSwapTx(s.fromAccountAddress,s.sourceToken.tokenAddress,l.toFixed(0),i),g;if(i){if(!A)throw new gt("Cannot get inAmount");g=(0,gr.Big)(o.amount).minus((0,gr.Big)(A).mul(Ff)).toFixed(0)}else g=(0,gr.Big)(o.amount).minus(l).toFixed(0);if((0,gr.Big)(g).lte(0))throw new Ln(`Amount not enough to pay fee, ${Ce((0,gr.Big)(g).minus(1).neg(),s.sourceToken.decimals).toFixed()} stables is missing`);return{tx:p,solTxSendUpdatedParams:{amount:g,fee:a,extraGas:c,gasFeePaymentMethod:u}}}addPoolAddress(o,s){return{...s,poolAddress:o.sourceToken.poolAddress}}async convertStableCoinFeeAndExtraGasToNativeCurrency(o,s){if(s.gasFeePaymentMethod=="stablecoin"){let i=(await this.api.getReceiveTransactionCost({sourceChainId:s.fromChainId,destinationChainId:s.toChainId,messenger:s.messenger})).sourceNativeTokenPrice,a=(0,gr.Big)(s.fee).div(i).mul((0,gr.Big)(10).pow(Re.getChainDecimalsByType("SOLANA")-o)).toFixed(0),c;return s.extraGas&&(c=(0,gr.Big)(s.extraGas).div(i).mul((0,gr.Big)(10).pow(Re.getChainDecimalsByType("SOLANA")-o)).toFixed(0)),{fee:a,extraGas:c,gasFeePaymentMethod:"native"}}return{fee:s.fee,extraGas:s.extraGas,gasFeePaymentMethod:"native"}}getExtraGasInstruction(o,s,i){return Ye.web3.SystemProgram.transfer({fromPubkey:s,toPubkey:i,lamports:+o})}async prepareSwapAndBridgeData(o){let{amount:s,contractAddress:i,fromChainId:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,toTokenAddress:A,poolAddress:g,extraGas:P}=o,b=u,S=c,I=l,F=A,j=p,G=i,$=a,q=xn(this.solanaRpcUrl,S),de=new Ye.Program(Qs,G,q),oe=Array.from(ya()),ot=new Ee.PublicKey(g),De=await Wf(s,de,ot),Ge=await af(oe,de.programId),pt=await Xo(de.programId),zt=await vr(new Ee.PublicKey(S),new Ee.PublicKey(b)),At=await Yo(new Ee.PublicKey(b),de.programId),Me=await Hu(I,de.programId),Ne=await uf(I,Buffer.from(F),de.programId),ft=await En(de.programId),mt=await de.account.config.fetch(ft),Vt=await Hs(I,mt.gasOracleProgramId),pr=await Hs($,mt.gasOracleProgramId),Tr=Sf({amount:De,recipient:Buffer.from(j),nonce:Buffer.from(oe),receiveToken:Buffer.from(F),destinationChainId:I,sourceChainId:$,chainBridge:(await Xo(de.programId)).toBuffer()}),ke={};return ke.bridge=de,ke.amount=new Ye.BN(s),ke.vusdAmount=new Ye.BN(De),ke.nonce=oe,ke.recipient=Array.from(j),ke.receiveToken=Array.from(F),ke.poolAccount=ot,ke.lockAccount=Ge,ke.bridgeAuthority=pt,ke.userToken=zt,ke.bridgeTokenAccount=At,ke.chainBridgeAccount=Me,ke.otherBridgeTokenAccount=Ne,ke.userAccount=new Ee.PublicKey(S),ke.destinationChainId=I,ke.mint=new Ee.PublicKey(b),ke.config=ft,ke.configAccountInfo=mt,ke.gasPrice=Vt,ke.thisGasPrice=pr,ke.message=Tr,P&&(ke.extraGasInstruction=this.getExtraGasInstruction(P,ke.userAccount,ft)),ke}async buildSwapAndBridgeAllbridgeTransaction(o){let{bridge:s,vusdAmount:i,nonce:a,recipient:c,receiveToken:u,poolAccount:l,lockAccount:p,bridgeAuthority:A,userToken:g,bridgeTokenAccount:P,chainBridgeAccount:b,otherBridgeTokenAccount:S,userAccount:I,destinationChainId:F,mint:j,config:G,configAccountInfo:$,gasPrice:q,thisGasPrice:de,message:oe,extraGasInstruction:ot}=o,De=$.allbridgeMessengerProgramId,Ge=await Ku(F,De),pt=await En(De),zt=await lf(oe,De),At=[];ot&&At.push(ot);let Me=await s.methods.swapAndBridge({vusdAmount:i,nonce:a,destinationChainId:F,recipient:c,receiveToken:u}).accounts({mint:j,user:I,config:G,lock:p,pool:l,gasPrice:q,thisGasPrice:de,bridgeAuthority:A,userToken:g,bridgeToken:P,chainBridge:b,messenger:De,messengerGasUsage:Ge,messengerConfig:pt,sentMessageAccount:zt,otherBridgeToken:S}).preInstructions([Ye.web3.ComputeBudgetProgram.setComputeUnitLimit({units:nl})]).postInstructions(At).transaction(),Ne=xn(this.solanaRpcUrl,I.toString()).connection;return Me.recentBlockhash=(await Ne.getLatestBlockhash()).blockhash,Me.feePayer=I,await this.convertToVersionedTransaction(Me,Ne)}async convertToVersionedTransaction(o,s){let i=await s.getAddressLookupTable(new Ee.PublicKey(this.params.solanaLookUpTable)).then(c=>c.value);if(!i)throw new U("Cannot find allbridgeLookupTableAccount");let a=new Ye.web3.TransactionMessage({payerKey:o.feePayer,recentBlockhash:o.recentBlockhash,instructions:o.instructions}).compileToV0Message([i]);return new Ye.web3.VersionedTransaction(a)}async buildSwapAndBridgeWormholeTransaction(o){let{bridge:s,vusdAmount:i,nonce:a,recipient:c,receiveToken:u,poolAccount:l,lockAccount:p,bridgeAuthority:A,userToken:g,bridgeTokenAccount:P,chainBridgeAccount:b,otherBridgeTokenAccount:S,userAccount:I,destinationChainId:F,mint:j,config:G,configAccountInfo:$,gasPrice:q,thisGasPrice:de,message:oe,extraGasInstruction:ot}=o,De=this.params.wormholeMessengerProgramId,[Ge]=Ee.PublicKey.findProgramAddressSync([Buffer.from("Bridge")],new Ee.PublicKey(De)),[pt]=Ee.PublicKey.findProgramAddressSync([Buffer.from("fee_collector")],new Ee.PublicKey(De)),[zt]=Ee.PublicKey.findProgramAddressSync([Buffer.from("Sequence"),A.toBuffer()],new Ee.PublicKey(De)),At=await Ku(F,$.wormholeMessengerProgramId),Me=await En($.wormholeMessengerProgramId),Ne=Ee.Keypair.generate(),ft=xn(this.solanaRpcUrl,I.toString()),mt=await ft.connection.getAccountInfo(Ge);if(mt==null)throw new U("Cannot fetch wormhole bridge account info");let Vt=new Ye.BN(mt.data.slice(16,24),"le").toString(),pr=Ee.SystemProgram.transfer({fromPubkey:I,toPubkey:pt,lamports:+Vt}),Tr=[];ot&&Tr.push(ot);let ke={mint:j,user:I,config:G,lock:p,pool:l,gasPrice:q,thisGasPrice:de,bridgeAuthority:A,userToken:g,bridgeToken:P,chainBridge:b,otherBridgeToken:S,messengerGasUsage:At,wormholeProgram:De,bridge:Ge,message:Ne.publicKey,wormholeMessenger:$.wormholeMessengerProgramId,sequence:zt,feeCollector:pt,wormholeMessengerConfig:Me,clock:Ye.web3.SYSVAR_CLOCK_PUBKEY},Wi=await s.methods.swapAndBridgeWormhole({vusdAmount:i,nonce:a,destinationChainId:F,recipient:c,receiveToken:u}).accounts(ke).preInstructions([Ye.web3.ComputeBudgetProgram.setComputeUnitLimit({units:nl}),pr]).postInstructions(Tr).signers([Ne]).transaction();return Wi.recentBlockhash=(await ft.connection.getLatestBlockhash()).blockhash,Wi.feePayer=I,{transaction:await this.convertToVersionedTransaction(Wi,ft.connection),messageAccount:Ne}}async prepareSwapAndBridgeCctpData(o){let{contractAddress:s,amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,extraGas:A}=o,g=s;if(!g)throw new Ct("Such route does not support CCTP protocol");let P=4,b=a,S=p,I=l,F=xn(this.solanaRpcUrl,b),j=new Ye.Program(wf,g,F),G=new Ee.PublicKey(c),$=await df(G,j.programId),q=new Ee.PublicKey(b),de=await j.account.cctpBridge.fetch($),oe={};return oe.cctpBridge=j,oe.cctpBridgeAccount=$,oe.cctpAddressAccount=new Ee.PublicKey(g),oe.amount=new Ye.BN(i),oe.recipient=Array.from(I),oe.receiveToken=Array.from(S),oe.userToken=await vr(q,G),oe.bridgeAuthority=await cf($,j.programId),oe.bridgeTokenAccount=await pf(G,j.programId),oe.chainBridgeAccount=await Hu(u,j.programId),oe.userAccount=q,oe.destinationChainId=u,oe.mint=G,oe.gasPrice=await Hs(u,de.gasOracleProgramId),oe.thisGasPrice=await Hs(P,de.gasOracleProgramId),oe.provider=F,A&&(oe.extraGasInstruction=this.getExtraGasInstruction(A,oe.userAccount,$)),oe}async buildSwapAndBridgeCctpTransaction(o,s){let{cctpBridge:i,cctpBridgeAccount:a,amount:c,recipient:u,receiveToken:l,bridgeAuthority:p,userToken:A,bridgeTokenAccount:g,chainBridgeAccount:P,userAccount:b,destinationChainId:S,mint:I,gasPrice:F,thisGasPrice:j,extraGasInstruction:G,provider:$}=s,q=this.params.cctpParams.cctpDomains[o],de=this.params.cctpParams.cctpTransmitterProgramId,oe=this.params.cctpParams.cctpTokenMessengerMinter;if(q==null||!de||!oe)throw new U("CCTP is not configured");let ot=new Ee.PublicKey(de),De=new Ee.PublicKey(oe),{messageTransmitterAccount:Ge,tokenMessenger:pt,tokenMessengerEventAuthority:zt,tokenMinter:At,localToken:Me,remoteTokenMessengerKey:Ne,authorityPda:ft}=ff(q,I,ot,De),mt=[];G&&mt.push(G);let Vt=Ee.Keypair.generate(),pr=Af(i.programId,Vt.publicKey),Tr=await i.methods.bridge({amount:c,destinationChainId:S,recipient:u,receiveToken:l}).accounts({mint:I,user:b,cctpBridge:a,messageSentEventData:Vt.publicKey,lock:pr,cctpMessenger:De,messageTransmitterProgram:ot,messageTransmitterAccount:Ge,tokenMessenger:pt,tokenMinter:At,localToken:Me,remoteTokenMessengerKey:Ne,authorityPda:ft,eventAuthority:zt,bridgeToken:g,gasPrice:F,thisGasPrice:j,chainBridge:P,userToken:A,bridgeAuthority:p}).preInstructions([Ye.web3.ComputeBudgetProgram.setComputeUnitLimit({units:2e6})]).postInstructions(mt).transaction(),ke=$.connection;return Tr.recentBlockhash=(await ke.getLatestBlockhash()).blockhash,Tr.feePayer=b,{transaction:await this.convertToVersionedTransaction(Tr,ke),messageSentEventDataKeypair:Vt}}send(o){throw new st}};var Sa=require("@stellar/stellar-sdk"),kf=require("big.js");var t=require("@stellar/stellar-sdk"),fb=t.contract.Spec,mb=t.contract.Client;var ti=class extends mb{constructor(o){super(new fb(["AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABAAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAltZXNzZW5nZXIAAAAAAAATAAAAAAAAAApnYXNfb3JhY2xlAAAAAAATAAAAAAAAAAxuYXRpdmVfdG9rZW4AAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAPc3dhcF9hbmRfYnJpZGdlAAAAAAkAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACXJlY2lwaWVudAAAAAAAA+4AAAAgAAAAAAAAABRkZXN0aW5hdGlvbl9jaGFpbl9pZAAAAAQAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAFbm9uY2UAAAAAAAAMAAAAAAAAAApnYXNfYW1vdW50AAAAAAAKAAAAAAAAABBmZWVfdG9rZW5fYW1vdW50AAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOcmVjZWl2ZV90b2tlbnMAAAAAAAgAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAlyZWNpcGllbnQAAAAAAAATAAAAAAAAAA9zb3VyY2VfY2hhaW5faWQAAAAABAAAAAAAAAANcmVjZWl2ZV90b2tlbgAAAAAAA+4AAAAgAAAAAAAAAAVub25jZQAAAAAAAAwAAAAAAAAAEnJlY2VpdmVfYW1vdW50X21pbgAAAAAACgAAAAAAAAAJZXh0cmFfZ2FzAAAAAAAD6AAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAEc3dhcAAAAAYAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAA+4AAAAgAAAAAAAAAA1yZWNlaXZlX3Rva2VuAAAAAAAD7gAAACAAAAAAAAAACXJlY2lwaWVudAAAAAAAABMAAAAAAAAAEnJlY2VpdmVfYW1vdW50X21pbgAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAJc3RvcF9zd2FwAAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAKc3RhcnRfc3dhcAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOc2V0X2dhc19vcmFjbGUAAAAAAAEAAAAAAAAAC25ld19hZGRyZXNzAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAASc2V0X3N0b3BfYXV0aG9yaXR5AAAAAAABAAAAAAAAAA5zdG9wX2F1dGhvcml0eQAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAOc2V0X3JlYmFsYW5jZXIAAAAAAAEAAAAAAAAACnJlYmFsYW5jZXIAAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc2V0X21lc3NlbmdlcgAAAAAAAAEAAAAAAAAACW1lc3NlbmdlcgAAAAAAABMAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc2V0X2dhc191c2FnZQAAAAAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAAJZ2FzX3VzYWdlAAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAPcmVnaXN0ZXJfYnJpZGdlAAAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAAOYnJpZGdlX2FkZHJlc3MAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAQYWRkX2JyaWRnZV90b2tlbgAAAAIAAAAAAAAACGNoYWluX2lkAAAABAAAAAAAAAANdG9rZW5fYWRkcmVzcwAAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAATcmVtb3ZlX2JyaWRnZV90b2tlbgAAAAACAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAPuAAAAIAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAIYWRkX3Bvb2wAAAACAAAAAAAAAARwb29sAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAATd2l0aGRyYXdfZ2FzX3Rva2VucwAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABmFtb3VudAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAfd2l0aGRyYXdfYnJpZGdpbmdfZmVlX2luX3Rva2VucwAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAVaGFzX3Byb2Nlc3NlZF9tZXNzYWdlAAAAAAAAAQAAAAAAAAAHbWVzc2FnZQAAAAPuAAAAIAAAAAEAAAPpAAAAAQAAAAM=","AAAAAAAAAAAAAAAUaGFzX3JlY2VpdmVkX21lc3NhZ2UAAAABAAAAAAAAAAdtZXNzYWdlAAAAA+4AAAAgAAAAAQAAA+kAAAABAAAAAw==","AAAAAAAAAAAAAAAQZ2V0X3Bvb2xfYWRkcmVzcwAAAAEAAAAAAAAADXRva2VuX2FkZHJlc3MAAAAAAAPuAAAAIAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAKZ2V0X2NvbmZpZwAAAAAAAAAAAAEAAAPpAAAH0AAAAAZCcmlkZ2UAAAAAAAM=","AAAAAAAAAAAAAAASZ2V0X3N0b3BfYXV0aG9yaXR5AAAAAAAAAAAAAQAAA+kAAAATAAAAAw==","AAAAAAAAAAAAAAAUZ2V0X3RyYW5zYWN0aW9uX2Nvc3QAAAABAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAABAAAD6QAAAAoAAAAD","AAAAAAAAAAAAAAANZ2V0X2dhc191c2FnZQAAAAAAAAEAAAAAAAAACGNoYWluX2lkAAAABAAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAAJZ2V0X2FkbWluAAAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAOZ2V0X2dhc19vcmFjbGUAAAAAAAAAAAABAAAD6QAAABMAAAAD","AAAAAAAAAAAAAAASZ2V0X2Fub3RoZXJfYnJpZGdlAAAAAAABAAAAAAAAAAhjaGFpbl9pZAAAAAQAAAABAAAD6QAAB9AAAAANQW5vdGhlckJyaWRnZQAAAAAAAAM=","AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAJbmV3X2FkbWluAAAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAHdXBncmFkZQAAAAABAAAAAAAAAA1uZXdfd2FzbV9oYXNoAAAAAAAD7gAAACAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAQAAAAAAAAAAAAAAB1N3YXBwZWQAAAAABgAAAAAAAAAOcmVjZWl2ZV9hbW91bnQAAAAAAAoAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAJcmVjaXBpZW50AAAAAAAAEwAAAAAAAAALc2VuZF9hbW91bnQAAAAACgAAAAAAAAAKc2VuZF90b2tlbgAAAAAD7gAAACAAAAAAAAAABnNlbmRlcgAAAAAAEw==","AAAAAQAAAAAAAAAAAAAAClRva2Vuc1NlbnQAAAAAAAUAAAAAAAAABmFtb3VudAAAAAAACgAAAAAAAAAUZGVzdGluYXRpb25fY2hhaW5faWQAAAAEAAAAAAAAAAVub25jZQAAAAAAAAwAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAJcmVjaXBpZW50AAAAAAAD7gAAACA=","AAAAAQAAAAAAAAAAAAAADlRva2Vuc1JlY2VpdmVkAAAAAAAEAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAB21lc3NhZ2UAAAAD7gAAACAAAAAAAAAABW5vbmNlAAAAAAAADAAAAAAAAAAJcmVjaXBpZW50AAAAAAAD7gAAACA=","AAAAAQAAAAAAAAAAAAAAClJlY2VpdmVGZWUAAAAAAAMAAAAAAAAAF2JyaWRnZV90cmFuc2FjdGlvbl9jb3N0AAAAAAoAAAAAAAAACWV4dHJhX2dhcwAAAAAAAAoAAAAAAAAAGG1lc3NhZ2VfdHJhbnNhY3Rpb25fY29zdAAAAAo=","AAAAAQAAAAAAAAAAAAAAFUJyaWRnaW5nRmVlRnJvbVRva2VucwAAAAAAAAIAAAAAAAAAEGZlZV90b2tlbl9hbW91bnQAAAAKAAAAAAAAAANnYXMAAAAACg==","AAAAAQAAAAAAAAAAAAAADUFub3RoZXJCcmlkZ2UAAAAAAAACAAAAAAAAAAdhZGRyZXNzAAAAA+4AAAAgAAAAAAAAAAZ0b2tlbnMAAAAAA+wAAAPuAAAAIAAAAAE=","AAAAAQAAAAAAAAAAAAAABkJyaWRnZQAAAAAABgAAAGBwcmVjb21wdXRlZCB2YWx1ZXMgb2YgdGhlIHNjYWxpbmcgZmFjdG9yIHJlcXVpcmVkIGZvciBwYXlpbmcgdGhlIGJyaWRnaW5nIGZlZSB3aXRoIHN0YWJsZSB0b2tlbnMAAAAeYnJpZGdpbmdfZmVlX2NvbnZlcnNpb25fZmFjdG9yAAAAAAPsAAAAEwAAAAoAAAAAAAAACGNhbl9zd2FwAAAAAQAAAGxwcmVjb21wdXRlZCB2YWx1ZXMgdG8gZGl2aWRlIGJ5IHRvIGNoYW5nZSB0aGUgcHJlY2lzaW9uIGZyb20gdGhlIEdhcyBPcmFjbGUgcHJlY2lzaW9uIHRvIHRoZSB0b2tlbiBwcmVjaXNpb24AAAAWZnJvbV9nYXNfb3JhY2xlX2ZhY3RvcgAAAAAD7AAAABMAAAAKAAAAAAAAAAltZXNzZW5nZXIAAAAAAAATAAAAAAAAAAVwb29scwAAAAAAA+wAAAPuAAAAIAAAABMAAAAAAAAACnJlYmFsYW5jZXIAAAAAABM=","AAAAAgAAAAAAAAAAAAAAB0RhdGFLZXkAAAAAAwAAAAEAAAAAAAAAC090aGVyQnJpZGdlAAAAAAEAAAAEAAAAAQAAAAAAAAALU2VudE1lc3NhZ2UAAAAAAQAAA+4AAAAgAAAAAQAAAAAAAAAPUmVjZWl2ZWRNZXNzYWdlAAAAAAEAAAPuAAAAIA==","AAAAAQAAAAAAAAAAAAAABUFkbWluAAAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAQAAAAAAAAAAAAAAEEdhc09yYWNsZUFkZHJlc3MAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAAAQAAAAAAAAAAAAAACEdhc1VzYWdlAAAAAQAAAAAAAAABMAAAAAAAA+wAAAAEAAAACg==","AAAAAQAAAAAAAAAAAAAAC05hdGl2ZVRva2VuAAAAAAEAAAAAAAAAATAAAAAAAAAT","AAAAAQAAAAAAAAAAAAAADVN0b3BBdXRob3JpdHkAAAAAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAKAAAAAAAAAANVW5pbXBsZW1lbnRlZAAAAAAAAAAAAAAAAAAAC0luaXRpYWxpemVkAAAAAAEAAAAAAAAADVVuaW5pdGlhbGl6ZWQAAAAAAAACAAAAAAAAAAxVbmF1dGhvcml6ZWQAAAADAAAAAAAAAApJbnZhbGlkQXJnAAAAAAAEAAAAAAAAAA5JbnZhbGlkQ2hhaW5JZAAAAAAABQAAAAAAAAATSW52YWxpZE90aGVyQ2hhaW5JZAAAAAAGAAAAAAAAAA5HYXNVc2FnZU5vdFNldAAAAAAABwAAAAAAAAANQnJva2VuQWRkcmVzcwAAAAAAAAgAAAAAAAAACE5vdEZvdW5kAAAACQAAAAAAAAAYVG9rZW5JbnN1ZmZpY2llbnRCYWxhbmNlAAAACgAAAAAAAAAKQ2FzdEZhaWxlZAAAAAAACwAAAAAAAAAMVTI1Nk92ZXJmbG93AAAADAAAAAAAAAAKWmVyb0Ftb3VudAAAAAAAZwAAAAAAAAAMUG9vbE92ZXJmbG93AAAAaAAAAAAAAAALWmVyb0NoYW5nZXMAAAAAaQAAAAAAAAARUmVzZXJ2ZXNFeGhhdXN0ZWQAAAAAAABqAAAAAAAAABpJbnN1ZmZpY2llbnRSZWNlaXZlZEFtb3VudAAAAAAAawAAAAAAAAAUQmFsYW5jZVJhdGlvRXhjZWVkZWQAAABsAAAAAAAAAAlGb3JiaWRkZW4AAAAAAABtAAAAAAAAABlVbmF1dGhvcml6ZWRTdG9wQXV0aG9yaXR5AAAAAAAAywAAAAAAAAAOU3dhcFByb2hpYml0ZWQAAAAAAMwAAAAAAAAAEkFtb3VudFRvb0xvd0ZvckZlZQAAAAAAzQAAAAAAAAAWQnJpZGdlVG9UaGVaZXJvQWRkcmVzcwAAAAAAzgAAAAAAAAAORW1wdHlSZWNpcGllbnQAAAAAAM8AAAAAAAAAE1NvdXJjZU5vdFJlZ2lzdGVyZWQAAAAA0AAAAAAAAAAVV3JvbmdEZXN0aW5hdGlvbkNoYWluAAAAAAAA0QAAAAAAAAATVW5rbm93bkFub3RoZXJDaGFpbgAAAADSAAAAAAAAABFUb2tlbnNBbHJlYWR5U2VudAAAAAAAANMAAAAAAAAAEE1lc3NhZ2VQcm9jZXNzZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ"]),o);this.options=o}fromJSON={initialize:this.txFromJSON,swap_and_bridge:this.txFromJSON,receive_tokens:this.txFromJSON,swap:this.txFromJSON,stop_swap:this.txFromJSON,start_swap:this.txFromJSON,set_gas_oracle:this.txFromJSON,set_stop_authority:this.txFromJSON,set_rebalancer:this.txFromJSON,set_messenger:this.txFromJSON,set_gas_usage:this.txFromJSON,register_bridge:this.txFromJSON,add_bridge_token:this.txFromJSON,remove_bridge_token:this.txFromJSON,add_pool:this.txFromJSON,withdraw_gas_tokens:this.txFromJSON,withdraw_bridging_fee_in_tokens:this.txFromJSON,has_processed_message:this.txFromJSON,has_received_message:this.txFromJSON,get_pool_address:this.txFromJSON,get_config:this.txFromJSON,get_stop_authority:this.txFromJSON,get_transaction_cost:this.txFromJSON,get_gas_usage:this.txFromJSON,get_admin:this.txFromJSON,get_gas_oracle:this.txFromJSON,get_another_bridge:this.txFromJSON,set_admin:this.txFromJSON,upgrade:this.txFromJSON}};var va=class extends sr{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";async buildRawTransactionSend(o){let s=await Mr(this.chainType,o,this.api);return await this.buildRawTransactionSendFromParams(s)}async buildRawTransactionSendFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,kf.Big)(b).plus(P).toFixed());let S=this.getContract(ti,i,a),I;return g==="stablecoin"?I=await S.swap_and_bridge({sender:a,token:Sa.Address.contract(Buffer.from(c)).toString(),amount:BigInt(s),recipient:Buffer.from(l),destination_chain_id:+u,receive_token:Buffer.from(p),nonce:qr(),gas_amount:BigInt(0),fee_token_amount:BigInt(b)}):I=await S.swap_and_bridge({sender:a,token:Sa.Address.contract(Buffer.from(c)).toString(),amount:BigInt(s),recipient:Buffer.from(l),destination_chain_id:+u,receive_token:Buffer.from(p),nonce:qr(),gas_amount:BigInt(b),fee_token_amount:BigInt(0)}),I.toXDR()}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o;return(await this.getContract(ti,i,a).swap({sender:a,amount:BigInt(s),token:Sa.Address.contract(Buffer.from(c)).toBuffer(),receive_token:Buffer.from(l),recipient:u,receive_amount_min:BigInt(p)})).toXDR()}send(o){throw new st}getContract(o,s,i){let a={publicKey:i,contractId:s,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new o(a)}};var Of="1.18.0",Ef="1.40.0";var gb={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"},Ia=class extends Error{},ts=class extends Ia{constructor(r,o){super(r),this.code=o,this.type=gb[o]??"ServerError"}},Ma=class extends Ia{constructor(r,o,s){super(r),this.status=o,this.statusText=s}};var xf=n=>{throw TypeError(n)},sl=(n,r,o)=>r.has(n)||xf("Cannot "+o),qe=(n,r,o)=>(sl(n,r,"read from private field"),o?o.call(n):r.get(n)),ho=(n,r,o)=>r.has(n)?xf("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),rs=(n,r,o,s)=>(sl(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),Df=(n,r,o)=>(sl(n,r,"access private method"),o),hb=(n,r,o,s)=>({set _(i){rs(n,r,i,o)},get _(){return qe(n,r,s)}}),yo,ri,fn,bo,ni,ns,Ra,Nf,Uf;function yb(n){let r=new URL(n);return r.protocol=r.protocol.replace("http","ws"),r.toString()}var bb={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5},Fa=class{constructor(r,o={}){if(ho(this,Ra),ho(this,yo,0),ho(this,ri,0),ho(this,fn,null),ho(this,bo,null),ho(this,ni,new Set),ho(this,ns,new Map),this.endpoint=r,this.options={...bb,...o},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=yb(this.endpoint))}async makeRequest(r,o){let s=await Df(this,Ra,Nf).call(this);return new Promise((i,a)=>{rs(this,yo,qe(this,yo)+1),qe(this,ns).set(qe(this,yo),{resolve:i,reject:a,timeout:setTimeout(()=>{qe(this,ns).delete(qe(this,yo)),a(new Error(`Request timeout: ${r}`))},this.options.callTimeout)}),s.send(JSON.stringify({jsonrpc:"2.0",id:qe(this,yo),method:r,params:o}))}).then(({error:i,result:a})=>{if(i)throw new ts(i.message,i.code);return a})}async subscribe(r){let o=new ol(r);return qe(this,ni).add(o),await o.subscribe(this),()=>o.unsubscribe(this)}};yo=new WeakMap;ri=new WeakMap;fn=new WeakMap;bo=new WeakMap;ni=new WeakMap;ns=new WeakMap;Ra=new WeakSet;Nf=function(){return qe(this,bo)?qe(this,bo):(rs(this,bo,new Promise(n=>{qe(this,fn)?.close(),rs(this,fn,new this.options.WebSocketConstructor(this.endpoint)),qe(this,fn).addEventListener("open",()=>{rs(this,ri,0),n(qe(this,fn))}),qe(this,fn).addEventListener("close",()=>{hb(this,ri)._++,qe(this,ri)<=this.options.maxReconnects&&setTimeout(()=>{Df(this,Ra,Uf).call(this)},this.options.reconnectTimeout)}),qe(this,fn).addEventListener("message",({data:r})=>{let o;try{o=JSON.parse(r)}catch(s){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:s}));return}if("id"in o&&o.id!=null&&qe(this,ns).has(o.id)){let{resolve:s,timeout:i}=qe(this,ns).get(o.id);clearTimeout(i),s(o)}else if("params"in o){let{params:s}=o;qe(this,ni).forEach(i=>{i.subscriptionId===s.subscription&&s.subscription===i.subscriptionId&&i.onMessage(s.result)})}})})),qe(this,bo))};Uf=async function(){return qe(this,fn)?.close(),rs(this,bo,null),Promise.allSettled([...qe(this,ni)].map(n=>n.subscribe(this)))};var ol=class{constructor(r){this.subscriptionId=null,this.subscribed=!1,this.input=r}onMessage(r){this.subscribed&&this.input.onMessage(r)}async unsubscribe(r){let{subscriptionId:o}=this;return this.subscribed=!1,o==null?!1:(this.subscriptionId=null,r.makeRequest(this.input.unsubscribe,[o]))}async subscribe(r){this.subscriptionId=null,this.subscribed=!0;let o=await r.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=o)}};var _f=n=>{throw TypeError(n)},cl=(n,r,o)=>r.has(n)||_f("Cannot "+o),hr=(n,r,o)=>(cl(n,r,"read from private field"),o?o.call(n):r.get(n)),ka=(n,r,o)=>r.has(n)?_f("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),il=(n,r,o,s)=>(cl(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),Tb=(n,r,o)=>(cl(n,r,"access private method"),o),oi,Rr,si,al,jf,Oa=class{constructor(r){ka(this,al),ka(this,oi,0),ka(this,Rr),ka(this,si),il(this,Rr,r)}fetch(r,o){let s=hr(this,Rr).fetch??fetch;if(!s)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return s(r,o)}async request(r){il(this,oi,hr(this,oi)+1);let o=await this.fetch(hr(this,Rr).rpc?.url??hr(this,Rr).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":Of,"Client-Target-Api-Version":Ef,"Client-Request-Method":r.method,...hr(this,Rr).rpc?.headers},body:JSON.stringify({jsonrpc:"2.0",id:hr(this,oi),method:r.method,params:r.params})});if(!o.ok)throw new Ma(`Unexpected status code: ${o.status}`,o.status,o.statusText);let s=await o.json();if("error"in s&&s.error!=null)throw new ts(s.error.message,s.error.code);return s.result}async subscribe(r){let o=await Tb(this,al,jf).call(this).subscribe(r);return async()=>!!await o()}};oi=new WeakMap;Rr=new WeakMap;si=new WeakMap;al=new WeakSet;jf=function(){if(!hr(this,si)){let n=hr(this,Rr).WebSocketConstructor??WebSocket;if(!n)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");il(this,si,new Fa(hr(this,Rr).websocket?.url??hr(this,Rr).url,{WebSocketConstructor:n,...hr(this,Rr).websocket}))}return hr(this,si)};var Tn=require("@mysten/bcs");Pt();Jt();var We=require("@mysten/bcs");var Gb=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Lb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function Xf(n,r="at"){let o=n.toLowerCase(),s;if(o.includes("@")){if(!Gb.test(o))throw new Error(`Invalid SuiNS name ${n}`);let[i,a]=o.split("@");s=[...i?i.split("."):[],a]}else{if(!Lb.test(o))throw new Error(`Invalid SuiNS name ${n}`);s=o.split(".").slice(0,-1)}return r==="dot"?`${s.join(".")}.sui`:`${s.slice(0,-1).join(".")}@${s[s.length-1]}`}Jt();var $b=BigInt(1e9),Dl="0x1",Na="0x2";var Ua=Zt("0x6");var Nl=`${Na}::sui::SUI`,Zb=Zt("0x5");Jt();var Jb="object",Hb="ID",Kb="ascii",Xb="String",Yb="string",qb="String",Qb="option",eT="Option";function Yf(n){let r=typeof n.body=="object"&&"datatype"in n.body?n.body.datatype:null;return!!r&&le(r.package)===le("0x2")&&r.module==="tx_context"&&r.type==="TxContext"}function _a(n){if(typeof n=="string")switch(n){case"address":return R.Address;case"bool":return R.Bool;case"u8":return R.U8;case"u16":return R.U16;case"u32":return R.U32;case"u64":return R.U64;case"u128":return R.U128;case"u256":return R.U256;default:throw new Error(`Unknown type signature ${n}`)}if("vector"in n){if(n.vector==="u8")return R.vector(R.U8).transform({input:o=>typeof o=="string"?new TextEncoder().encode(o):o,output:o=>o});let r=_a(n.vector);return r?R.vector(r):null}if("datatype"in n){let r=le(n.datatype.package);if(r===le(Dl)){if(n.datatype.module===Kb&&n.datatype.type===Xb)return R.String;if(n.datatype.module===Yb&&n.datatype.type===qb)return R.String;if(n.datatype.module===Qb&&n.datatype.type===eT){let o=_a(n.datatype.typeParameters[0]);return o?R.vector(o):null}}if(r===le(Na)&&n.datatype.module===Jb&&n.datatype.type===Hb)return R.Address}return null}function qf(n){return typeof n=="object"&&"Reference"in n?{ref:"&",body:ci(n.Reference)}:typeof n=="object"&&"MutableReference"in n?{ref:"&mut",body:ci(n.MutableReference)}:{ref:null,body:ci(n)}}function ci(n){if(typeof n=="string")switch(n){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${n}`)}if("Vector"in n)return{vector:ci(n.Vector)};if("Struct"in n)return{datatype:{package:n.Struct.address,module:n.Struct.module,type:n.Struct.name,typeParameters:n.Struct.typeArguments.map(ci)}};if("TypeParameter"in n)return{typeParameter:n.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(n)}`)}var Qf=require("@mysten/bcs");Jt();function tT(n){return{$kind:"Pure",Pure:{bytes:n instanceof Uint8Array?(0,Qf.toBase64)(n):n.toBase64()}}}var Kt={Pure:tT,ObjectRef({objectId:n,digest:r,version:o}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:r,version:o,objectId:le(n)}}}},SharedObjectRef({objectId:n,mutable:r,initialSharedVersion:o}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:r,initialSharedVersion:o,objectId:le(n)}}}},ReceivingRef({objectId:n,digest:r,version:o}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:r,version:o,objectId:le(n)}}}}};var zl=require("@mysten/bcs"),Er=require("valibot");Jt();var w=require("valibot");Jt();function Un(n){let r=Object.entries(n).map(([o,s])=>(0,w.object)({[o]:s}));return(0,w.pipe)((0,w.union)(r),(0,w.transform)(o=>({...o,$kind:Object.keys(o)[0]})))}var To=(0,w.pipe)((0,w.string)(),(0,w.transform)(n=>le(n)),(0,w.check)(ar)),Ut=To,Nn=(0,w.string)(),Rt=(0,w.pipe)((0,w.union)([(0,w.string)(),(0,w.pipe)((0,w.number)(),(0,w.integer)())]),(0,w.check)(n=>{try{return BigInt(n),BigInt(n)>=0&&BigInt(n)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Or=(0,w.object)({objectId:To,version:Rt,digest:(0,w.string)()}),_e=(0,w.pipe)((0,w.union)([(0,w.object)({GasCoin:(0,w.literal)(!0)}),(0,w.object)({Input:(0,w.pipe)((0,w.number)(),(0,w.integer)()),type:(0,w.optional)((0,w.literal)("pure"))}),(0,w.object)({Input:(0,w.pipe)((0,w.number)(),(0,w.integer)()),type:(0,w.optional)((0,w.literal)("object"))}),(0,w.object)({Result:(0,w.pipe)((0,w.number)(),(0,w.integer)())}),(0,w.object)({NestedResult:(0,w.tuple)([(0,w.pipe)((0,w.number)(),(0,w.integer)()),(0,w.pipe)((0,w.number)(),(0,w.integer)())])})]),(0,w.transform)(n=>({...n,$kind:Object.keys(n)[0]}))),rT=(0,w.object)({budget:(0,w.nullable)(Rt),price:(0,w.nullable)(Rt),owner:(0,w.nullable)(To),payment:(0,w.nullable)((0,w.array)(Or))}),xv=(0,w.object)({address:(0,w.string)(),module:(0,w.string)(),name:(0,w.string)(),typeParams:(0,w.array)((0,w.string)())}),Ul=(0,w.union)([(0,w.literal)("address"),(0,w.literal)("bool"),(0,w.literal)("u8"),(0,w.literal)("u16"),(0,w.literal)("u32"),(0,w.literal)("u64"),(0,w.literal)("u128"),(0,w.literal)("u256"),(0,w.object)({vector:(0,w.lazy)(()=>Ul)}),(0,w.object)({datatype:(0,w.object)({package:(0,w.string)(),module:(0,w.string)(),type:(0,w.string)(),typeParameters:(0,w.array)((0,w.lazy)(()=>Ul))})}),(0,w.object)({typeParameter:(0,w.pipe)((0,w.number)(),(0,w.integer)())})]),nT=(0,w.object)({ref:(0,w.nullable)((0,w.union)([(0,w.literal)("&"),(0,w.literal)("&mut")])),body:Ul}),oT=(0,w.object)({package:Ut,module:(0,w.string)(),function:(0,w.string)(),typeArguments:(0,w.array)((0,w.string)()),arguments:(0,w.array)(_e),_argumentTypes:(0,w.optional)((0,w.nullable)((0,w.array)(nT)))}),sT=(0,w.object)({name:(0,w.string)(),inputs:(0,w.record)((0,w.string)(),(0,w.union)([_e,(0,w.array)(_e)])),data:(0,w.record)((0,w.string)(),(0,w.unknown)())}),iT=Un({MoveCall:oT,TransferObjects:(0,w.object)({objects:(0,w.array)(_e),address:_e}),SplitCoins:(0,w.object)({coin:_e,amounts:(0,w.array)(_e)}),MergeCoins:(0,w.object)({destination:_e,sources:(0,w.array)(_e)}),Publish:(0,w.object)({modules:(0,w.array)(Nn),dependencies:(0,w.array)(Ut)}),MakeMoveVec:(0,w.object)({type:(0,w.nullable)((0,w.string)()),elements:(0,w.array)(_e)}),Upgrade:(0,w.object)({modules:(0,w.array)(Nn),dependencies:(0,w.array)(Ut),package:Ut,ticket:_e}),$Intent:sT}),em=Un({ImmOrOwnedObject:Or,SharedObject:(0,w.object)({objectId:Ut,initialSharedVersion:Rt,mutable:(0,w.boolean)()}),Receiving:Or}),aT=Un({Object:em,Pure:(0,w.object)({bytes:Nn}),UnresolvedPure:(0,w.object)({value:(0,w.unknown)()}),UnresolvedObject:(0,w.object)({objectId:Ut,version:(0,w.optional)((0,w.nullable)(Rt)),digest:(0,w.optional)((0,w.nullable)((0,w.string)())),initialSharedVersion:(0,w.optional)((0,w.nullable)(Rt))})}),_l=Un({Object:em,Pure:(0,w.object)({bytes:Nn})}),jl=Un({None:(0,w.literal)(!0),Epoch:Rt}),is=(0,w.object)({version:(0,w.literal)(2),sender:(0,w.nullish)(To),expiration:(0,w.nullish)(jl),gasData:rT,inputs:(0,w.array)(aT),commands:(0,w.array)(iT)});var ur={MoveCall(n){let[r,o="",s=""]="target"in n?n.target.split("::"):[n.package,n.module,n.function];return{$kind:"MoveCall",MoveCall:{package:r,module:o,function:s,typeArguments:n.typeArguments??[],arguments:n.arguments??[]}}},TransferObjects(n,r){return{$kind:"TransferObjects",TransferObjects:{objects:n.map(o=>(0,Er.parse)(_e,o)),address:(0,Er.parse)(_e,r)}}},SplitCoins(n,r){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Er.parse)(_e,n),amounts:r.map(o=>(0,Er.parse)(_e,o))}}},MergeCoins(n,r){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Er.parse)(_e,n),sources:r.map(o=>(0,Er.parse)(_e,o))}}},Publish({modules:n,dependencies:r}){return{$kind:"Publish",Publish:{modules:n.map(o=>typeof o=="string"?o:(0,zl.toBase64)(new Uint8Array(o))),dependencies:r.map(o=>Zt(o))}}},Upgrade({modules:n,dependencies:r,package:o,ticket:s}){return{$kind:"Upgrade",Upgrade:{modules:n.map(i=>typeof i=="string"?i:(0,zl.toBase64)(new Uint8Array(i))),dependencies:r.map(i=>Zt(i)),package:o,ticket:(0,Er.parse)(_e,s)}}},MakeMoveVec({type:n,elements:r}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:n??null,elements:r.map(o=>(0,Er.parse)(_e,o))}}},Intent({name:n,inputs:r={},data:o={}}){return{$kind:"$Intent",$Intent:{name:n,inputs:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,Array.isArray(i)?i.map(a=>(0,Er.parse)(_e,a)):(0,Er.parse)(_e,i)])),data:o}}}};var as=require("@mysten/bcs"),en=require("valibot");Jt();var _n=require("@mysten/bcs"),T=require("valibot");Pt();var Vl=(0,T.object)({digest:(0,T.string)(),objectId:(0,T.string)(),version:(0,T.union)([(0,T.pipe)((0,T.number)(),(0,T.integer)()),(0,T.string)(),(0,T.bigint)()])}),cT=Un({ImmOrOwned:Vl,Shared:(0,T.object)({objectId:Ut,initialSharedVersion:Rt,mutable:(0,T.boolean)()}),Receiving:Vl}),tm=Un({Object:cT,Pure:(0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))}),nm=(0,T.union)([(0,T.object)({kind:(0,T.literal)("Input"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),value:(0,T.unknown)(),type:(0,T.optional)((0,T.literal)("object"))}),(0,T.object)({kind:(0,T.literal)("Input"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),value:(0,T.unknown)(),type:(0,T.literal)("pure")})]),uT=(0,T.union)([(0,T.object)({Epoch:(0,T.pipe)((0,T.number)(),(0,T.integer)())}),(0,T.object)({None:(0,T.nullable)((0,T.literal)(!0))})]),rm=(0,T.pipe)((0,T.union)([(0,T.number)(),(0,T.string)(),(0,T.bigint)()]),(0,T.check)(n=>{if(!["string","number","bigint"].includes(typeof n))return!1;try{return BigInt(n),!0}catch{return!1}})),Gl=(0,T.union)([(0,T.object)({bool:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u8:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u64:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u128:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({address:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({signer:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({vector:(0,T.lazy)(()=>Gl)}),(0,T.object)({struct:(0,T.lazy)(()=>lT)}),(0,T.object)({u16:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u32:(0,T.nullable)((0,T.literal)(!0))}),(0,T.object)({u256:(0,T.nullable)((0,T.literal)(!0))})]),lT=(0,T.object)({address:(0,T.string)(),module:(0,T.string)(),name:(0,T.string)(),typeParams:(0,T.array)(Gl)}),dT=(0,T.object)({budget:(0,T.optional)(rm),price:(0,T.optional)(rm),payment:(0,T.optional)((0,T.array)(Vl)),owner:(0,T.optional)((0,T.string)())}),pT=[nm,(0,T.object)({kind:(0,T.literal)("GasCoin")}),(0,T.object)({kind:(0,T.literal)("Result"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)())}),(0,T.object)({kind:(0,T.literal)("NestedResult"),index:(0,T.pipe)((0,T.number)(),(0,T.integer)()),resultIndex:(0,T.pipe)((0,T.number)(),(0,T.integer)())})],yn=(0,T.union)([...pT]),AT=(0,T.object)({kind:(0,T.literal)("MoveCall"),target:(0,T.pipe)((0,T.string)(),(0,T.check)(n=>n.split("::").length===3)),typeArguments:(0,T.array)((0,T.string)()),arguments:(0,T.array)(yn)}),fT=(0,T.object)({kind:(0,T.literal)("TransferObjects"),objects:(0,T.array)(yn),address:yn}),mT=(0,T.object)({kind:(0,T.literal)("SplitCoins"),coin:yn,amounts:(0,T.array)(yn)}),gT=(0,T.object)({kind:(0,T.literal)("MergeCoins"),destination:yn,sources:(0,T.array)(yn)}),hT=(0,T.object)({kind:(0,T.literal)("MakeMoveVec"),type:(0,T.union)([(0,T.object)({Some:Gl}),(0,T.object)({None:(0,T.nullable)((0,T.literal)(!0))})]),objects:(0,T.array)(yn)}),yT=(0,T.object)({kind:(0,T.literal)("Publish"),modules:(0,T.array)((0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))),dependencies:(0,T.array)((0,T.string)())}),bT=(0,T.object)({kind:(0,T.literal)("Upgrade"),modules:(0,T.array)((0,T.array)((0,T.pipe)((0,T.number)(),(0,T.integer)()))),dependencies:(0,T.array)((0,T.string)()),packageId:(0,T.string)(),ticket:yn}),TT=[AT,fT,mT,gT,yT,bT,hT],PT=(0,T.union)([...TT]),Vv=(0,T.object)({version:(0,T.literal)(1),sender:(0,T.optional)((0,T.string)()),expiration:(0,T.nullish)(uT),gasConfig:dT,inputs:(0,T.array)(nm),transactions:(0,T.array)(PT)});function Ll(n){let r=n.inputs.map((o,s)=>{if(o.Object)return{kind:"Input",index:s,value:{Object:o.Object.ImmOrOwnedObject?{ImmOrOwned:o.Object.ImmOrOwnedObject}:o.Object.Receiving?{Receiving:{digest:o.Object.Receiving.digest,version:o.Object.Receiving.version,objectId:o.Object.Receiving.objectId}}:{Shared:{mutable:o.Object.SharedObject.mutable,initialSharedVersion:o.Object.SharedObject.initialSharedVersion,objectId:o.Object.SharedObject.objectId}}},type:"object"};if(o.Pure)return{kind:"Input",index:s,value:{Pure:Array.from((0,_n.fromBase64)(o.Pure.bytes))},type:"pure"};if(o.UnresolvedPure)return{kind:"Input",type:"pure",index:s,value:o.UnresolvedPure.value};if(o.UnresolvedObject)return{kind:"Input",type:"object",index:s,value:o.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:n.sender??void 0,expiration:n.expiration?.$kind==="Epoch"?{Epoch:Number(n.expiration.Epoch)}:n.expiration?{None:!0}:null,gasConfig:{owner:n.gasData.owner??void 0,budget:n.gasData.budget??void 0,price:n.gasData.price??void 0,payment:n.gasData.payment??void 0},inputs:r,transactions:n.commands.map(o=>{if(o.MakeMoveVec)return{kind:"MakeMoveVec",type:o.MakeMoveVec.type===null?{None:!0}:{Some:mn.parseFromStr(o.MakeMoveVec.type)},objects:o.MakeMoveVec.elements.map(s=>gn(s,r))};if(o.MergeCoins)return{kind:"MergeCoins",destination:gn(o.MergeCoins.destination,r),sources:o.MergeCoins.sources.map(s=>gn(s,r))};if(o.MoveCall)return{kind:"MoveCall",target:`${o.MoveCall.package}::${o.MoveCall.module}::${o.MoveCall.function}`,typeArguments:o.MoveCall.typeArguments,arguments:o.MoveCall.arguments.map(s=>gn(s,r))};if(o.Publish)return{kind:"Publish",modules:o.Publish.modules.map(s=>Array.from((0,_n.fromBase64)(s))),dependencies:o.Publish.dependencies};if(o.SplitCoins)return{kind:"SplitCoins",coin:gn(o.SplitCoins.coin,r),amounts:o.SplitCoins.amounts.map(s=>gn(s,r))};if(o.TransferObjects)return{kind:"TransferObjects",objects:o.TransferObjects.objects.map(s=>gn(s,r)),address:gn(o.TransferObjects.address,r)};if(o.Upgrade)return{kind:"Upgrade",modules:o.Upgrade.modules.map(s=>Array.from((0,_n.fromBase64)(s))),dependencies:o.Upgrade.dependencies,packageId:o.Upgrade.package,ticket:gn(o.Upgrade.ticket,r)};throw new Error(`Unknown transaction ${Object.keys(o)}`)})}}function gn(n,r){if(n.$kind==="GasCoin")return{kind:"GasCoin"};if(n.$kind==="Result")return{kind:"Result",index:n.Result};if(n.$kind==="NestedResult")return{kind:"NestedResult",index:n.NestedResult[0],resultIndex:n.NestedResult[1]};if(n.$kind==="Input")return r[n.Input];throw new Error(`Invalid argument ${Object.keys(n)}`)}function om(n){return(0,T.parse)(is,{version:2,sender:n.sender??null,expiration:n.expiration?"Epoch"in n.expiration?{Epoch:n.expiration.Epoch}:{None:!0}:null,gasData:{owner:n.gasConfig.owner??null,budget:n.gasConfig.budget?.toString()??null,price:n.gasConfig.price?.toString()??null,payment:n.gasConfig.payment?.map(r=>({digest:r.digest,objectId:r.objectId,version:r.version.toString()}))??null},inputs:n.inputs.map(r=>{if(r.kind==="Input"){if((0,T.is)(tm,r.value)){let o=(0,T.parse)(tm,r.value);if(o.Object){if(o.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:o.Object.ImmOrOwned.objectId,version:String(o.Object.ImmOrOwned.version),digest:o.Object.ImmOrOwned.digest}}};if(o.Object.Shared)return{Object:{SharedObject:{mutable:o.Object.Shared.mutable??null,initialSharedVersion:o.Object.Shared.initialSharedVersion,objectId:o.Object.Shared.objectId}}};if(o.Object.Receiving)return{Object:{Receiving:{digest:o.Object.Receiving.digest,version:String(o.Object.Receiving.version),objectId:o.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:(0,_n.toBase64)(new Uint8Array(o.Pure))}}}return r.type==="object"?{UnresolvedObject:{objectId:r.value}}:{UnresolvedPure:{value:r.value}}}throw new Error("Invalid input")}),commands:n.transactions.map(r=>{switch(r.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in r.type?mn.tagToString(r.type.Some):null,elements:r.objects.map(o=>hn(o))}};case"MergeCoins":return{MergeCoins:{destination:hn(r.destination),sources:r.sources.map(o=>hn(o))}};case"MoveCall":{let[o,s,i]=r.target.split("::");return{MoveCall:{package:o,module:s,function:i,typeArguments:r.typeArguments,arguments:r.arguments.map(a=>hn(a))}}}case"Publish":return{Publish:{modules:r.modules.map(o=>(0,_n.toBase64)(Uint8Array.from(o))),dependencies:r.dependencies}};case"SplitCoins":return{SplitCoins:{coin:hn(r.coin),amounts:r.amounts.map(o=>hn(o))}};case"TransferObjects":return{TransferObjects:{objects:r.objects.map(o=>hn(o)),address:hn(r.address)}};case"Upgrade":return{Upgrade:{modules:r.modules.map(o=>(0,_n.toBase64)(Uint8Array.from(o))),dependencies:r.dependencies,package:r.packageId,ticket:hn(r.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(r)}`)})})}function hn(n){switch(n.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:n.index};case"NestedResult":return{NestedResult:[n.index,n.resultIndex]};case"Input":return{Input:n.index}}}var E=require("valibot");function ui(n){return(0,E.union)(Object.entries(n).map(([r,o])=>(0,E.object)({[r]:o})))}var xr=ui({GasCoin:(0,E.literal)(!0),Input:(0,E.pipe)((0,E.number)(),(0,E.integer)()),Result:(0,E.pipe)((0,E.number)(),(0,E.integer)()),NestedResult:(0,E.tuple)([(0,E.pipe)((0,E.number)(),(0,E.integer)()),(0,E.pipe)((0,E.number)(),(0,E.integer)())])}),wT=(0,E.object)({budget:(0,E.nullable)(Rt),price:(0,E.nullable)(Rt),owner:(0,E.nullable)(To),payment:(0,E.nullable)((0,E.array)(Or))}),CT=(0,E.object)({package:Ut,module:(0,E.string)(),function:(0,E.string)(),typeArguments:(0,E.array)((0,E.string)()),arguments:(0,E.array)(xr)}),BT=(0,E.object)({name:(0,E.string)(),inputs:(0,E.record)((0,E.string)(),(0,E.union)([xr,(0,E.array)(xr)])),data:(0,E.record)((0,E.string)(),(0,E.unknown)())}),WT=ui({MoveCall:CT,TransferObjects:(0,E.object)({objects:(0,E.array)(xr),address:xr}),SplitCoins:(0,E.object)({coin:xr,amounts:(0,E.array)(xr)}),MergeCoins:(0,E.object)({destination:xr,sources:(0,E.array)(xr)}),Publish:(0,E.object)({modules:(0,E.array)(Nn),dependencies:(0,E.array)(Ut)}),MakeMoveVec:(0,E.object)({type:(0,E.nullable)((0,E.string)()),elements:(0,E.array)(xr)}),Upgrade:(0,E.object)({modules:(0,E.array)(Nn),dependencies:(0,E.array)(Ut),package:Ut,ticket:xr}),$Intent:BT}),ST=ui({ImmOrOwnedObject:Or,SharedObject:(0,E.object)({objectId:Ut,initialSharedVersion:Rt,mutable:(0,E.boolean)()}),Receiving:Or}),vT=ui({Object:ST,Pure:(0,E.object)({bytes:Nn}),UnresolvedPure:(0,E.object)({value:(0,E.unknown)()}),UnresolvedObject:(0,E.object)({objectId:Ut,version:(0,E.optional)((0,E.nullable)(Rt)),digest:(0,E.optional)((0,E.nullable)((0,E.string)())),initialSharedVersion:(0,E.optional)((0,E.nullable)(Rt))})}),IT=ui({None:(0,E.literal)(!0),Epoch:Rt}),sm=(0,E.object)({version:(0,E.literal)(2),sender:(0,E.nullish)(To),expiration:(0,E.nullish)(IT),gasData:wT,inputs:(0,E.array)(vT),commands:(0,E.array)(WT)});var am=require("valibot");Pt();var MT=50,RT=1000n,FT=5e10;async function cm(n,r,o){return await DT(n,r),await xT(n,r),r.onlyTransactionKind||(await kT(n,r),await OT(n,r),await ET(n,r)),await NT(n),await o()}async function kT(n,r){n.gasConfig.price||(n.gasConfig.price=String(await Po(r).getReferenceGasPrice()))}async function OT(n,r){if(n.gasConfig.budget)return;let o=await Po(r).dryRunTransactionBlock({transactionBlock:n.build({overrides:{gasData:{budget:String(FT),payment:[]}}})});if(o.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${o.effects.status.error}`,{cause:o});let s=RT*BigInt(n.gasConfig.price||1n),i=BigInt(o.effects.gasUsed.computationCost)+s,a=i+BigInt(o.effects.gasUsed.storageCost)-BigInt(o.effects.gasUsed.storageRebate);n.gasConfig.budget=String(a>i?a:i)}async function ET(n,r){if(!n.gasConfig.payment){let s=(await Po(r).getCoins({owner:n.gasConfig.owner||n.sender,coinType:Nl})).data.filter(i=>!n.inputs.find(c=>c.Object?.ImmOrOwnedObject?i.coinObjectId===c.Object.ImmOrOwnedObject.objectId:!1)).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!s.length)throw new Error("No valid gas coins found for the transaction.");n.gasConfig.payment=s.map(i=>(0,am.parse)(Or,i))}}async function xT(n,r){let o=n.inputs.filter(A=>A.UnresolvedObject&&!(A.UnresolvedObject.version||A.UnresolvedObject?.initialSharedVersion)),s=[...new Set(o.map(A=>Zt(A.UnresolvedObject.objectId)))],i=s.length?zT(s,MT):[],a=(await Promise.all(i.map(A=>Po(r).multiGetObjects({ids:A,options:{showOwner:!0}})))).flat(),c=new Map(s.map((A,g)=>[A,a[g]])),u=Array.from(c).filter(([A,g])=>g.error).map(([A,g])=>JSON.stringify(g.error));if(u.length)throw new Error(`The following input objects are invalid: ${u.join(", ")}`);let l=a.map(A=>{if(A.error||!A.data)throw new Error(`Failed to fetch object: ${A.error}`);let g=A.data.owner,P=g&&typeof g=="object"&&"Shared"in g?g.Shared.initial_shared_version:null;return{objectId:A.data.objectId,digest:A.data.digest,version:A.data.version,initialSharedVersion:P}}),p=new Map(s.map((A,g)=>[A,l[g]]));for(let[A,g]of n.inputs.entries()){if(!g.UnresolvedObject)continue;let P,b=le(g.UnresolvedObject.objectId),S=p.get(b);g.UnresolvedObject.initialSharedVersion??S?.initialSharedVersion?P=Kt.SharedObjectRef({objectId:b,initialSharedVersion:g.UnresolvedObject.initialSharedVersion||S?.initialSharedVersion,mutable:UT(n,A)}):_T(n,A)&&(P=Kt.ReceivingRef({objectId:b,digest:g.UnresolvedObject.digest??S?.digest,version:g.UnresolvedObject.version??S?.version})),n.inputs[n.inputs.indexOf(g)]=P??Kt.ObjectRef({objectId:b,digest:g.UnresolvedObject.digest??S?.digest,version:g.UnresolvedObject.version??S?.version})}}async function DT(n,r){let{inputs:o,commands:s}=n,i=[],a=new Set;s.forEach(u=>{if(u.MoveCall){if(u.MoveCall._argumentTypes)return;if(u.MoveCall.arguments.map(A=>A.$kind==="Input"?n.inputs[A.Input]:null).some(A=>A?.UnresolvedPure||A?.UnresolvedObject)){let A=`${u.MoveCall.package}::${u.MoveCall.module}::${u.MoveCall.function}`;a.add(A),i.push(u.MoveCall)}}switch(u.$kind){case"SplitCoins":u.SplitCoins.amounts.forEach(l=>{im(l,R.U64,n)});break;case"TransferObjects":im(u.TransferObjects.address,R.Address,n);break}});let c=new Map;if(a.size>0){let u=Po(r);await Promise.all([...a].map(async l=>{let[p,A,g]=l.split("::"),P=await u.getNormalizedMoveFunction({package:p,module:A,function:g});c.set(l,P.parameters.map(b=>qf(b)))}))}i.length&&await Promise.all(i.map(async u=>{let l=c.get(`${u.package}::${u.module}::${u.function}`);if(!l)return;let A=l.length>0&&Yf(l.at(-1))?l.slice(0,l.length-1):l;u._argumentTypes=A})),s.forEach(u=>{if(!u.MoveCall)return;let l=u.MoveCall,p=`${l.package}::${l.module}::${l.function}`,A=l._argumentTypes;if(A){if(A.length!==u.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${p}`);A.forEach((g,P)=>{let b=l.arguments[P];if(b.$kind!=="Input")return;let S=o[b.Input];if(!S.UnresolvedPure&&!S.UnresolvedObject)return;let I=S.UnresolvedPure?.value??S.UnresolvedObject?.objectId,F=_a(g.body);if(F){b.type="pure",o[o.indexOf(S)]=Kt.Pure(F.serialize(I));return}if(typeof I!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(I,null,2)}`);b.type="object";let j=S.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:I}}:S;o[b.Input]=j})}})}function NT(n){n.inputs.forEach((r,o)=>{if(r.$kind!=="Object"&&r.$kind!=="Pure")throw new Error(`Input at index ${o} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(r)}`)})}function im(n,r,o){if(n.$kind!=="Input")return;let s=o.inputs[n.Input];s.$kind==="UnresolvedPure"&&(o.inputs[n.Input]=Kt.Pure(r.serialize(s.UnresolvedPure.value)))}function UT(n,r){let o=!1;return n.getInputUses(r,(s,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){let a=i.MoveCall.arguments.indexOf(s);o=i.MoveCall._argumentTypes[a].ref!=="&"||o}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(o=!0)}),o}function _T(n,r){let o=!1;return n.getInputUses(r,(s,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){let a=i.MoveCall.arguments.indexOf(s);o=jT(i.MoveCall._argumentTypes[a])||o}}),o}function jT(n){return typeof n.body!="object"||!("datatype"in n.body)?!1:n.body.datatype.package==="0x2"&&n.body.datatype.module==="transfer"&&n.body.datatype.type==="Receiving"}function Po(n){if(!n.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return n.client}function zT(n,r){return Array.from({length:Math.ceil(n.length/r)},(o,s)=>n.slice(s*r,s*r+r))}function um(n){function r(o){return n(o)}return r.system=()=>r("0x5"),r.clock=()=>r("0x6"),r.random=()=>r("0x8"),r.denyList=()=>r("0x403"),r.option=({type:o,value:s})=>i=>i.moveCall({typeArguments:[o],target:`0x1::option::${s===null?"none":"some"}`,arguments:s===null?[]:[i.object(s)]}),r}var lm=require("@mysten/bcs");Pt();function dm(n){function r(o,s){if(typeof o=="string")return n(li(o).serialize(s));if(o instanceof Uint8Array||(0,lm.isSerializedBcs)(o))return n(o);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return r.u8=o=>n(R.U8.serialize(o)),r.u16=o=>n(R.U16.serialize(o)),r.u32=o=>n(R.U32.serialize(o)),r.u64=o=>n(R.U64.serialize(o)),r.u128=o=>n(R.U128.serialize(o)),r.u256=o=>n(R.U256.serialize(o)),r.bool=o=>n(R.Bool.serialize(o)),r.string=o=>n(R.String.serialize(o)),r.address=o=>n(R.Address.serialize(o)),r.id=r.address,r.vector=(o,s)=>n(R.vector(li(o)).serialize(s)),r.option=(o,s)=>n(R.option(li(o)).serialize(s)),r}function li(n){switch(n){case"u8":return R.u8();case"u16":return R.u16();case"u32":return R.u32();case"u64":return R.u64();case"u128":return R.u128();case"u256":return R.u256();case"bool":return R.bool();case"string":return R.string();case"id":case"address":return R.Address}let r=n.match(/^(vector|option)<(.+)>$/);if(r){let[o,s]=r.slice(1);return o==="vector"?R.vector(li(s)):R.option(li(s))}throw new Error(`Invalid Pure type name: ${n}`)}var mm=require("@mysten/bcs"),ja=require("valibot");Pt();Jt();var pm=require("@noble/hashes/blake2b");function Am(n,r){let o=Array.from(`${n}::`).map(i=>i.charCodeAt(0)),s=new Uint8Array(o.length+r.length);return s.set(o),s.set(r,o.length),(0,pm.blake2b)(s,{dkLen:32})}function fm(n){return le(n).replace("0x","")}var jn=class n{constructor(r){this.version=2,this.sender=r?.sender??null,this.expiration=r?.expiration??null,this.inputs=r?.inputs??[],this.commands=r?.commands??[],this.gasData=r?.gasData??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(r){let s=R.TransactionKind.parse(r).ProgrammableTransaction;if(!s)throw new Error("Unable to deserialize from bytes.");return n.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:s.inputs,commands:s.commands})}static fromBytes(r){let s=R.TransactionData.parse(r)?.V1,i=s.kind.ProgrammableTransaction;if(!s||!i)throw new Error("Unable to deserialize from bytes.");return n.restore({version:2,sender:s.sender,expiration:s.expiration,gasData:s.gasData,inputs:i.inputs,commands:i.commands})}static restore(r){return r.version===2?new n((0,ja.parse)(is,r)):new n((0,ja.parse)(is,om(r)))}static getDigestFromBytes(r){let o=Am("TransactionData",r);return(0,mm.toBase58)(o)}get gasConfig(){return this.gasData}set gasConfig(r){this.gasData=r}build({maxSizeBytes:r=1/0,overrides:o,onlyTransactionKind:s}={}){let i=this.inputs,a=this.commands,c={ProgrammableTransaction:{inputs:i,commands:a}};if(s)return R.TransactionKind.serialize(c,{maxSize:r}).toBytes();let u=o?.expiration??this.expiration,l=o?.sender??this.sender,p={...this.gasData,...o?.gasConfig,...o?.gasData};if(!l)throw new Error("Missing transaction sender");if(!p.budget)throw new Error("Missing gas budget");if(!p.payment)throw new Error("Missing gas payment");if(!p.price)throw new Error("Missing gas price");let A={sender:fm(l),expiration:u||{None:!0},gasData:{payment:p.payment,owner:fm(this.gasData.owner??l),price:BigInt(p.price),budget:BigInt(p.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:a}}};return R.TransactionData.serialize({V1:A},{maxSize:r}).toBytes()}addInput(r,o){let s=this.inputs.length;return this.inputs.push(o),{Input:s,type:r,$kind:"Input"}}getInputUses(r,o){this.mapArguments((s,i)=>(s.$kind==="Input"&&s.Input===r&&o(s,i),s))}mapArguments(r){for(let o of this.commands)switch(o.$kind){case"MoveCall":o.MoveCall.arguments=o.MoveCall.arguments.map(i=>r(i,o));break;case"TransferObjects":o.TransferObjects.objects=o.TransferObjects.objects.map(i=>r(i,o)),o.TransferObjects.address=r(o.TransferObjects.address,o);break;case"SplitCoins":o.SplitCoins.coin=r(o.SplitCoins.coin,o),o.SplitCoins.amounts=o.SplitCoins.amounts.map(i=>r(i,o));break;case"MergeCoins":o.MergeCoins.destination=r(o.MergeCoins.destination,o),o.MergeCoins.sources=o.MergeCoins.sources.map(i=>r(i,o));break;case"MakeMoveVec":o.MakeMoveVec.elements=o.MakeMoveVec.elements.map(i=>r(i,o));break;case"Upgrade":o.Upgrade.ticket=r(o.Upgrade.ticket,o);break;case"$Intent":let s=o.$Intent.inputs;o.$Intent.inputs={};for(let[i,a]of Object.entries(s))o.$Intent.inputs[i]=Array.isArray(a)?a.map(c=>r(c,o)):r(a,o);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${o.$kind}`)}}replaceCommand(r,o){if(!Array.isArray(o)){this.commands[r]=o;return}let s=o.length-1;this.commands.splice(r,1,...o),s!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>r&&(i.Result+=s);break;case"NestedResult":i.NestedResult[0]>r&&(i.NestedResult[0]+=s);break}return i})}getDigest(){let r=this.build({onlyTransactionKind:!1});return n.getDigestFromBytes(r)}snapshot(){return(0,ja.parse)(is,this)}};Jt();function $l(n){if(typeof n=="string")return le(n);if(n.Object)return n.Object.ImmOrOwnedObject?le(n.Object.ImmOrOwnedObject.objectId):n.Object.Receiving?le(n.Object.Receiving.objectId):le(n.Object.SharedObject.objectId);if(n.UnresolvedObject)return le(n.UnresolvedObject.objectId)}var ym=n=>{throw TypeError(n)},Kl=(n,r,o)=>r.has(n)||ym("Cannot "+o),Pe=(n,r,o)=>(Kl(n,r,"read from private field"),o?o.call(n):r.get(n)),di=(n,r,o)=>r.has(n)?ym("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,o),wo=(n,r,o,s)=>(Kl(n,r,"write to private field"),s?s.call(n,o):r.set(n,o),o),bn=(n,r,o)=>(Kl(n,r,"access private method"),o),Ai,fi,Co,Se,Dr,za,Xl,Jl,Yl;function gm(n,r=1/0){let o={$kind:"Result",Result:n},s=[],i=a=>s[a]??(s[a]={$kind:"NestedResult",NestedResult:[n,a]});return new Proxy(o,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(a,c){if(c in a)return Reflect.get(a,c);if(c===Symbol.iterator)return function*(){let l=0;for(;l<r;)yield i(l),l++};if(typeof c=="symbol")return;let u=parseInt(c,10);if(!(Number.isNaN(u)||u<0))return i(u)}})}var bm=Symbol.for("@mysten/transaction");function Va(n){return!!n&&typeof n=="object"&&n[bm]===!0}var hm={buildPlugins:new Map,serializationPlugins:new Map},Zl=Symbol.for("@mysten/transaction/registry");function pi(){try{let n=globalThis;return n[Zl]||(n[Zl]=hm),n[Zl]}catch{return hm}}var VT=class Hl{constructor(){di(this,Dr),di(this,Ai),di(this,fi),di(this,Co,new Map),di(this,Se),this.object=um(o=>{if(typeof o=="function")return this.object(o(this));if(typeof o=="object"&&(0,en.is)(_e,o))return o;let s=$l(o),i=Pe(this,Se).inputs.find(a=>s===$l(a));return i?.Object?.SharedObject&&typeof o=="object"&&o.Object?.SharedObject&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||o.Object.SharedObject.mutable),i?{$kind:"Input",Input:Pe(this,Se).inputs.indexOf(i),type:"object"}:Pe(this,Se).addInput("object",typeof o=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:le(o)}}:o)});let r=pi();wo(this,Se,new jn),wo(this,fi,[...r.buildPlugins.values()]),wo(this,Ai,[...r.serializationPlugins.values()])}static fromKind(r){let o=new Hl;return wo(o,Se,jn.fromKindBytes(typeof r=="string"?(0,as.fromBase64)(r):r)),o}static from(r){let o=new Hl;return Va(r)?wo(o,Se,new jn(r.getData())):typeof r!="string"||!r.startsWith("{")?wo(o,Se,jn.fromBytes(typeof r=="string"?(0,as.fromBase64)(r):r)):wo(o,Se,jn.restore(JSON.parse(r))),o}static registerGlobalSerializationPlugin(r,o){pi().serializationPlugins.set(r,o??r)}static unregisterGlobalSerializationPlugin(r){pi().serializationPlugins.delete(r)}static registerGlobalBuildPlugin(r,o){pi().buildPlugins.set(r,o??r)}static unregisterGlobalBuildPlugin(r){pi().buildPlugins.delete(r)}addSerializationPlugin(r){Pe(this,Ai).push(r)}addBuildPlugin(r){Pe(this,fi).push(r)}addIntentResolver(r,o){if(Pe(this,Co).has(r)&&Pe(this,Co).get(r)!==o)throw new Error(`Intent resolver for ${r} already exists`);Pe(this,Co).set(r,o)}setSender(r){Pe(this,Se).sender=r}setSenderIfNotSet(r){Pe(this,Se).sender||(Pe(this,Se).sender=r)}setExpiration(r){Pe(this,Se).expiration=r?(0,en.parse)(jl,r):null}setGasPrice(r){Pe(this,Se).gasConfig.price=String(r)}setGasBudget(r){Pe(this,Se).gasConfig.budget=String(r)}setGasBudgetIfNotSet(r){Pe(this,Se).gasData.budget==null&&(Pe(this,Se).gasConfig.budget=String(r))}setGasOwner(r){Pe(this,Se).gasConfig.owner=r}setGasPayment(r){Pe(this,Se).gasConfig.payment=r.map(o=>(0,en.parse)(Or,o))}get blockData(){return Ll(Pe(this,Se).snapshot())}getData(){return Pe(this,Se).snapshot()}get[bm](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:dm(r=>(0,as.isSerializedBcs)(r)?Pe(this,Se).addInput("pure",{$kind:"Pure",Pure:{bytes:r.toBase64()}}):Pe(this,Se).addInput("pure",(0,en.is)(_l,r)?(0,en.parse)(_l,r):r instanceof Uint8Array?Kt.Pure(r):{$kind:"UnresolvedPure",UnresolvedPure:{value:r}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...r){return this.object(Kt.ObjectRef(...r))}receivingRef(...r){return this.object(Kt.ReceivingRef(...r))}sharedObjectRef(...r){return this.object(Kt.SharedObjectRef(...r))}add(r){if(typeof r=="function")return r(this);let o=Pe(this,Se).commands.push(r);return gm(o-1)}splitCoins(r,o){let s=ur.SplitCoins(typeof r=="string"?this.object(r):bn(this,Dr,Xl).call(this,r),o.map(a=>typeof a=="number"||typeof a=="bigint"||typeof a=="string"?this.pure.u64(a):bn(this,Dr,za).call(this,a))),i=Pe(this,Se).commands.push(s);return gm(i-1,o.length)}mergeCoins(r,o){return this.add(ur.MergeCoins(this.object(r),o.map(s=>this.object(s))))}publish({modules:r,dependencies:o}){return this.add(ur.Publish({modules:r,dependencies:o}))}upgrade({modules:r,dependencies:o,package:s,ticket:i}){return this.add(ur.Upgrade({modules:r,dependencies:o,package:s,ticket:this.object(i)}))}moveCall({arguments:r,...o}){return this.add(ur.MoveCall({...o,arguments:r?.map(s=>bn(this,Dr,za).call(this,s))}))}transferObjects(r,o){return this.add(ur.TransferObjects(r.map(s=>this.object(s)),typeof o=="string"?this.pure.address(o):bn(this,Dr,za).call(this,o)))}makeMoveVec({type:r,elements:o}){return this.add(ur.MakeMoveVec({type:r,elements:o.map(s=>this.object(s))}))}serialize(){return JSON.stringify(Ll(Pe(this,Se).snapshot()))}async toJSON(r={}){return await this.prepareForSerialization(r),JSON.stringify((0,en.parse)(sm,Pe(this,Se).snapshot()),(o,s)=>typeof s=="bigint"?s.toString():s,2)}async sign(r){let{signer:o,...s}=r,i=await this.build(s);return o.signTransaction(i)}async build(r={}){return await this.prepareForSerialization(r),await bn(this,Dr,Jl).call(this,r),Pe(this,Se).build({onlyTransactionKind:r.onlyTransactionKind})}async getDigest(r={}){return await bn(this,Dr,Jl).call(this,r),Pe(this,Se).getDigest()}async prepareForSerialization(r){let o=new Set;for(let i of Pe(this,Se).commands)i.$Intent&&o.add(i.$Intent.name);let s=[...Pe(this,Ai)];for(let i of o)if(!r.supportedIntents?.includes(i)){if(!Pe(this,Co).has(i))throw new Error(`Missing intent resolver for ${i}`);s.push(Pe(this,Co).get(i))}await bn(this,Dr,Yl).call(this,s,r)}};Ai=new WeakMap;fi=new WeakMap;Co=new WeakMap;Se=new WeakMap;Dr=new WeakSet;za=function(n){return(0,as.isSerializedBcs)(n)?this.pure(n):bn(this,Dr,Xl).call(this,n)};Xl=function(n){return typeof n=="function"?(0,en.parse)(_e,n(this)):(0,en.parse)(_e,n)};Jl=async function(n){if(!n.onlyTransactionKind&&!Pe(this,Se).sender)throw new Error("Missing transaction sender");await bn(this,Dr,Yl).call(this,[...Pe(this,fi),cm],n)};Yl=async function(n,r){let o=s=>{if(s>=n.length)return()=>{};let i=n[s];return async()=>{let a=o(s+1),c=!1,u=!1;if(await i(Pe(this,Se),r,async()=>{if(c)throw new Error(`next() was call multiple times in TransactionPlugin ${s}`);c=!0,await a(),u=!0}),!c)throw new Error(`next() was not called in TransactionPlugin ${s}`);if(!u)throw new Error(`next() was not awaited in TransactionPlugin ${s}`)}};await o(0)()};var Nr=VT;var zn=require("valibot");Pt();Jt();var Ga="CoinWithBalance",Tm=ai("0x2::sui::SUI");function Ze({type:n=Tm,balance:r,useGasCoin:o=!0}){return s=>{s.addIntentResolver(Ga,LT);let i=n==="gas"?n:ai(n);return s.add(ur.Intent({name:Ga,inputs:{},data:{type:i===Tm&&o?"gas":i,balance:BigInt(r)}}))}}var GT=(0,zn.object)({type:(0,zn.string)(),balance:(0,zn.bigint)()});async function LT(n,r,o){let s=new Set,i=new Map;if(!n.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(let p of n.commands)if(p.$kind==="$Intent"&&p.$Intent.name===Ga){let{type:A,balance:g}=(0,zn.parse)(GT,p.$Intent.data);A!=="gas"&&g>0n&&s.add(A),i.set(A,(i.get(A)??0n)+g)}let a=new Set;for(let p of n.inputs)p.Object?.ImmOrOwnedObject&&a.add(p.Object.ImmOrOwnedObject.objectId),p.UnresolvedObject?.objectId&&a.add(p.UnresolvedObject.objectId);let c=new Map,u=Po(r);await Promise.all([...s].map(async p=>{c.set(p,await $T({coinType:p,balance:i.get(p),client:u,owner:n.sender,usedIds:a}))}));let l=new Map;l.set("gas",{$kind:"GasCoin",GasCoin:!0});for(let[p,A]of n.commands.entries()){if(A.$kind!=="$Intent"||A.$Intent.name!==Ga)continue;let{type:g,balance:P}=A.$Intent.data;if(P===0n){n.replaceCommand(p,ur.MoveCall({target:"0x2::coin::zero",typeArguments:[g]}));continue}let b=[];if(!l.has(g)){let[S,...I]=c.get(g).map(F=>n.addInput("object",Kt.ObjectRef({objectId:F.coinObjectId,digest:F.digest,version:F.version})));I.length>0&&b.push(ur.MergeCoins(S,I)),l.set(g,S)}b.push(ur.SplitCoins(l.get(g),[n.addInput("pure",Kt.Pure(R.u64().serialize(P)))])),n.replaceCommand(p,b),n.mapArguments(S=>S.$kind==="Result"&&S.Result===p?{$kind:"NestedResult",NestedResult:[p+b.length-1,0]}:S)}return o()}async function $T({coinType:n,balance:r,client:o,owner:s,usedIds:i}){let a=r,c=[];return u();async function u(l=null){let{data:p,hasNextPage:A,nextCursor:g}=await o.getCoins({owner:s,coinType:n,cursor:l}),P=p.sort((b,S)=>Number(BigInt(S.balance)-BigInt(b.balance)));for(let b of P){if(i.has(b.coinObjectId))continue;let S=BigInt(b.balance);if(c.push(b),a-=S,a<=0)return c}if(A)return u(g);throw new Error(`Not enough coins of type ${n} to satisfy requested balance`)}}Jt();var ZT=Symbol.for("@mysten/SuiClient");var Pn=class{get[ZT](){return!0}constructor(r){this.transport=r.transport??new Oa({url:r.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[r.owner,r.coinType,r.cursor,r.limit]})}async getAllCoins(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[r.owner,r.cursor,r.limit]})}async getBalance(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[r.owner,r.coinType]})}async getAllBalances(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[r.owner]})}async getCoinMetadata(r){return await this.transport.request({method:"suix_getCoinMetadata",params:[r.coinType]})}async getTotalSupply(r){return await this.transport.request({method:"suix_getTotalSupply",params:[r.coinType]})}async call(r,o){return await this.transport.request({method:r,params:o})}async getMoveFunctionArgTypes(r){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[r.package,r.module,r.function]})}async getNormalizedMoveModulesByPackage(r){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[r.package]})}async getNormalizedMoveModule(r){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[r.package,r.module]})}async getNormalizedMoveFunction(r){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[r.package,r.module,r.function]})}async getNormalizedMoveStruct(r){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[r.package,r.module,r.struct]})}async getOwnedObjects(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[r.owner,{filter:r.filter,options:r.options},r.cursor,r.limit]})}async getObject(r){if(!r.id||!os(Zt(r.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[r.id,r.options]})}async tryGetPastObject(r){return await this.transport.request({method:"sui_tryGetPastObject",params:[r.id,r.version,r.options]})}async multiGetObjects(r){if(r.ids.forEach(s=>{if(!s||!os(Zt(s)))throw new Error(`Invalid Sui Object id ${s}`)}),r.ids.length!==new Set(r.ids).size)throw new Error(`Duplicate object ids in batch call ${r.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[r.ids,r.options]})}async queryTransactionBlocks(r){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:r.filter,options:r.options},r.cursor,r.limit,(r.order||"descending")==="descending"]})}async getTransactionBlock(r){if(!xa(r.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[r.digest,r.options]})}async multiGetTransactionBlocks(r){if(r.digests.forEach(s=>{if(!xa(s))throw new Error(`Invalid Transaction digest ${s}`)}),r.digests.length!==new Set(r.digests).size)throw new Error(`Duplicate digests in batch call ${r.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[r.digests,r.options]})}async executeTransactionBlock({transactionBlock:r,signature:o,options:s,requestType:i}){let a=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof r=="string"?r:(0,Tn.toBase64)(r),Array.isArray(o)?o:[o],s]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:a.digest})}catch{}return a}async signAndExecuteTransaction({transaction:r,signer:o,...s}){let i;r instanceof Uint8Array?i=r:(r.setSenderIfNotSet(o.toSuiAddress()),i=await r.build({client:this}));let{signature:a,bytes:c}=await o.signTransaction(i);return this.executeTransactionBlock({transactionBlock:c,signature:a,...s})}async getTotalTransactionBlocks(){let r=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(r)}async getReferenceGasPrice(){let r=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(r)}async getStakes(r){if(!r.owner||!ar(le(r.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[r.owner]})}async getStakesByIds(r){return r.stakedSuiIds.forEach(o=>{if(!o||!os(Zt(o)))throw new Error(`Invalid Sui Stake id ${o}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[r.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(r){return await this.transport.request({method:"suix_queryEvents",params:[r.query,r.cursor,r.limit,(r.order||"descending")==="descending"]})}async subscribeEvent(r){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[r.filter],onMessage:r.onMessage})}async subscribeTransaction(r){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[r.filter],onMessage:r.onMessage})}async devInspectTransactionBlock(r){let o;if(Va(r.transactionBlock))r.transactionBlock.setSenderIfNotSet(r.sender),o=(0,Tn.toBase64)(await r.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof r.transactionBlock=="string")o=r.transactionBlock;else if(r.transactionBlock instanceof Uint8Array)o=(0,Tn.toBase64)(r.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[r.sender,o,r.gasPrice?.toString(),r.epoch]})}async dryRunTransactionBlock(r){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof r.transactionBlock=="string"?r.transactionBlock:(0,Tn.toBase64)(r.transactionBlock)]})}async getDynamicFields(r){if(!r.parentId||!os(Zt(r.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[r.parentId,r.cursor,r.limit]})}async getDynamicFieldObject(r){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[r.parentId,r.name]})}async getLatestCheckpointSequenceNumber(){let r=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(r)}async getCheckpoint(r){return await this.transport.request({method:"sui_getCheckpoint",params:[r.id]})}async getCheckpoints(r){return await this.transport.request({method:"sui_getCheckpoints",params:[r.cursor,r?.limit,r.descendingOrder]})}async getCommitteeInfo(r){return await this.transport.request({method:"suix_getCommitteeInfo",params:[r?.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(r){return await this.transport.request({method:"suix_getEpochMetrics",params:[r?.cursor,r?.limit,r?.descendingOrder]})}async getAllEpochAddressMetrics(r){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[r?.descendingOrder]})}async getEpochs(r){return await this.transport.request({method:"suix_getEpochs",params:[r?.cursor,r?.limit,r?.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){let r=await this.getCheckpoint({id:"0"}),o=(0,Tn.fromBase58)(r.digest);return(0,Tn.toHex)(o.slice(0,4))}async resolveNameServiceAddress(r){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[r.name]})}async resolveNameServiceNames({format:r="dot",...o}){let{nextCursor:s,hasNextPage:i,data:a}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[o.address,o.cursor,o.limit]});return{hasNextPage:i,nextCursor:s,data:a.map(c=>Xf(c,r))}}async getProtocolConfig(r){return await this.transport.request({method:"sui_getProtocolConfig",params:[r?.version]})}async waitForTransaction({signal:r,timeout:o=60*1e3,pollInterval:s=2*1e3,...i}){let a=AbortSignal.timeout(o),c=new Promise((u,l)=>{a.addEventListener("abort",()=>l(a.reason))});for(c.catch(()=>{});!a.aborted;){r?.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(l=>setTimeout(l,s)),c])}}throw a.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}};var Ka=require("big.js");var ad=be(Vn());var wn=be(Vn());wt();function Cm(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::swap`,typeArguments:r,arguments:[ce(n,o.bridge),ce(n,o.coin),yr(n,o.receiveAmountMin,"u64")]})}function Bm(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::deposit`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit),ce(n,o.coin)]})}function Wm(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::withdraw`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit),yr(n,o.amountLp,"u64")]})}function Sm(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::claim_reward`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.userDeposit)]})}function vm(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::pool`,typeArguments:[r],arguments:[ce(n,o)]})}function Ql(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::swap_and_bridge_wormhole`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.messenger),ce(n,o.wormholeState),ce(n,o.theClock),ce(n,o.gasOracle),ce(n,o.amount),ce(n,o.recipient),yr(n,o.destinationChainId,"u8"),ce(n,o.receiveToken),yr(n,o.nonce,"u256"),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin)]})}function Im(n,r){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::new_user_deposit`,typeArguments:[r],arguments:[]})}function ed(n,r,o){return n.moveCall({target:`${wn.PUBLISHED_AT}::bridge_interface::swap_and_bridge`,typeArguments:[r],arguments:[ce(n,o.bridge),ce(n,o.messenger),ce(n,o.gasOracle),ce(n,o.amount),ce(n,o.recipient),yr(n,o.destinationChainId,"u8"),ce(n,o.receiveToken),yr(n,o.nonce,"u256"),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin)]})}var Em=be(rd());var Rm=be(rd());wt();function nd(n,r,o){return n.moveCall({target:`${Rm.PUBLISHED_AT}::cctp_bridge_interface::bridge`,typeArguments:[r],arguments:[ce(n,o.cctpBridge),ce(n,o.gasOracle),ce(n,o.tokenMessengerMinterState),ce(n,o.messageTransmitterState),ce(n,o.treasury),ce(n,o.denyList),ce(n,o.amount),ce(n,o.feeSuiCoin),ce(n,o.feeTokenCoin),yr(n,o.destinationChainId,"u8"),ce(n,o.recipient),ce(n,o.recipientWalletAddress)]})}var xm=be(sd());var Om=be(sd());Pt();wt();Pt();wt();var id=class n{__VectorClass=!0;static $typeName="vector";static $numTypeParams=1;static $isPhantom=[!1];$typeName="vector";$fullTypeName;$typeArgs;$isPhantom=[!1];elements;constructor(r,o){this.$fullTypeName=Ie(this.$typeName,...r),this.$typeArgs=r,this.elements=o}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs(mi(r)),fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),new:o=>new n([ue(r)],o),kind:"VectorClassReified"}}static get r(){return n.reified}static get bcs(){return R.vector}static fromFields(r,o){return n.reified(r).new(o.map(s=>we(r,s)))}static fromFieldsWithTypes(r,o){return n.reified(r).new(o.map(s=>he(r,s)))}static fromBcs(r,o){return n.fromFields(r,n.bcs(mi(r)).parse(o))}toJSONField(){return this.elements.map(r=>Bo(this.$typeArgs[0],r))}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,elements:this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new(o.map(s=>ye(r,s)))}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a vector json object");return n.fromJSONField(r,o.elements)}};function cs(n){return id.r(n)}function Qe(n){return typeof n=="string"?{phantomType:n,kind:"PhantomReified"}:{phantomType:n.fullTypeName,kind:"PhantomReified"}}var qT=R.bytes(32).transform({input:n=>(0,We.fromHEX)(n),output:n=>(0,We.toHEX)(n)});function mi(n){switch(n){case"bool":return R.bool();case"u8":return R.u8();case"u16":return R.u16();case"u32":return R.u32();case"u64":return R.u64();case"u128":return R.u128();case"u256":return R.u256();case"address":return qT;default:return n.bcs}}function ue(n){switch(n){case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":case"bool":case"address":return n}switch(n.kind){case"PhantomReified":return n.phantomType;case"StructClassReified":return n.fullTypeName;case"VectorClassReified":return n.fullTypeName}throw new Error("unreachable")}function we(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return`0x${r}`}if(n.kind==="VectorClassReified")return n.fromFields(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":return new TextDecoder().decode(Uint8Array.from(r.bytes)).toString();case"0x2::url::Url":return new TextDecoder().decode(Uint8Array.from(r.url.bytes)).toString();case"0x2::object::ID":return`0x${r.bytes}`;case"0x2::object::UID":return`0x${r.id.bytes}`;case"0x1::option::Option":return r.vec.length===0?null:n.fromFields(r).vec[0];default:return n.fromFields(r)}}function he(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return r}if(n.kind==="VectorClassReified")return n.fromFieldsWithTypes(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":return r;case"0x2::object::UID":return r.id;case"0x2::balance::Balance":return n.fromFields({value:BigInt(r)});case"0x1::option::Option":return r===null?null:he(n.reifiedTypeArgs[0],r);default:return n.fromFieldsWithTypes(r)}}function Ur(n,r,o){if(o.length!==r.length)throw new Error(`provided item has mismatching number of type argments ${n} (expected ${o.length}, got ${r.length}))`);for(let s=0;s<r.length;s++)if(ne(r[s])!==ne(ue(o[s])))throw new Error(`provided item has mismatching type argments ${n} (expected ${ue(o[s])}, got ${r[s]}))`)}function tn(n,r){let{typeArgs:o}=Ft(n.type);Ur(n.type,o,r)}function Bo(n,r){let{typeName:o,typeArgs:s}=Ft(n);switch(o){case"bool":return r;case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return r.toString();case"address":case"signer":return r;case"vector":return r.map(i=>Bo(s[0],i));case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":case"0x2::object::UID":return r;case"0x1::option::Option":return r===null?null:Bo(s[0],r);default:return r.toJSONField()}}function ye(n,r){switch(n){case"bool":case"u8":case"u16":case"u32":return r;case"u64":case"u128":case"u256":return BigInt(r);case"address":return r}if(n.kind==="VectorClassReified")return n.fromJSONField(r).elements;switch(n.typeName){case"0x1::string::String":case"0x1::ascii::String":case"0x2::url::Url":case"0x2::object::ID":case"0x2::object::UID":return r;case"0x1::option::Option":return r===null?null:ye(n.reifiedTypeArgs[0],r);default:return n.fromJSONField(r)}}wt();var La="0x1";wt();Pt();function $a(n){return n=ne(n),n===`${La}::string::String`}var Za=class n{__StructClass=!0;static get $typeName(){return`${La}::string::String`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;bytes;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.bytes=o.bytes}static reified(){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return Qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("String",{bytes:R.vector(R.u8())})}static fromFields(r){return n.reified().new({bytes:we(cs("u8"),r.bytes)})}static fromFieldsWithTypes(r){if(!$a(r.type))throw new Error("not a String type");return n.reified().new({bytes:he(cs("u8"),r.fields.bytes)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{bytes:Bo("vector<u8>",this.bytes)}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({bytes:ye(cs("u8"),r.bytes)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!$a(r.type))throw new Error(`object at ${r.fields.id} is not a String object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!$a(r.bcs.type))throw new Error("object at is not a String object");return n.fromBcs((0,We.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching String object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!$a(s.data.bcs.type))throw new Error(`object at id ${o} is not a String object`);return n.fromSuiObjectData(s.data)}};wt();wt();var Gn="0x2";Pt();function Ja(n){return n=ne(n),n===`${Gn}::object::ID`}var Wo=class n{__StructClass=!0;static get $typeName(){return`${Gn}::object::ID`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;bytes;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.bytes=o.bytes}static reified(){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return Qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("ID",{bytes:R.bytes(32).transform({input:r=>(0,We.fromHEX)(r),output:r=>(0,We.toHEX)(r)})})}static fromFields(r){return n.reified().new({bytes:we("address",r.bytes)})}static fromFieldsWithTypes(r){if(!Ja(r.type))throw new Error("not a ID type");return n.reified().new({bytes:he("address",r.fields.bytes)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{bytes:this.bytes}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({bytes:ye("address",r.bytes)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!Ja(r.type))throw new Error(`object at ${r.fields.id} is not a ID object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!Ja(r.bcs.type))throw new Error("object at is not a ID object");return n.fromBcs((0,We.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching ID object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!Ja(s.data.bcs.type))throw new Error(`object at id ${o} is not a ID object`);return n.fromSuiObjectData(s.data)}};function Ha(n){return n=ne(n),n===`${Gn}::object::UID`}var br=class n{__StructClass=!0;static get $typeName(){return`${Gn}::object::UID`}static $numTypeParams=0;static $isPhantom=[];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.id=o.id}static reified(){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName),typeArgs:[],isPhantom:n.$isPhantom,reifiedTypeArgs:[],fromFields:r=>n.fromFields(r),fromFieldsWithTypes:r=>n.fromFieldsWithTypes(r),fromBcs:r=>n.fromBcs(r),bcs:n.bcs,fromJSONField:r=>n.fromJSONField(r),fromJSON:r=>n.fromJSON(r),fromSuiParsedData:r=>n.fromSuiParsedData(r),fromSuiObjectData:r=>n.fromSuiObjectData(r),fetch:async(r,o)=>n.fetch(r,o),new:r=>new n([],r),kind:"StructClassReified"}}static get r(){return n.reified()}static phantom(){return Qe(n.reified())}static get p(){return n.phantom()}static get bcs(){return R.struct("UID",{id:Wo.bcs})}static fromFields(r){return n.reified().new({id:we(Wo.reified(),r.id)})}static fromFieldsWithTypes(r){if(!Ha(r.type))throw new Error("not a UID type");return n.reified().new({id:he(Wo.reified(),r.fields.id)})}static fromBcs(r){return n.fromFields(n.bcs.parse(r))}toJSONField(){return{id:this.id}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r){return n.reified().new({id:ye(Wo.reified(),r.id)})}static fromJSON(r){if(r.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return n.fromJSONField(r)}static fromSuiParsedData(r){if(r.dataType!=="moveObject")throw new Error("not an object");if(!Ha(r.type))throw new Error(`object at ${r.fields.id} is not a UID object`);return n.fromFieldsWithTypes(r)}static fromSuiObjectData(r){if(r.bcs){if(r.bcs.dataType!=="moveObject"||!Ha(r.bcs.type))throw new Error("object at is not a UID object");return n.fromBcs((0,We.fromB64)(r.bcs.bcsBytes))}if(r.content)return n.fromSuiParsedData(r.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o){let s=await r.getObject({id:o,options:{showBcs:!0}});if(s.error)throw new Error(`error fetching UID object at id ${o}: ${s.error.code}`);if(s.data?.bcs?.dataType!=="moveObject"||!Ha(s.data.bcs.type))throw new Error(`object at id ${o} is not a UID object`);return n.fromSuiObjectData(s.data)}};function _r(n,r){return n.moveCall({target:`${Om.PUBLISHED_AT}::bytes32::from_hex`,arguments:[yr(n,r,`${Za.$typeName}`)]})}async function rn(n,r,o=[]){let s=await n(r),i=o.concat(s.data);return s.hasNextPage&&s.nextCursor?rn(n,s.nextCursor,i):i}var Xa=class extends sr{constructor(o,s){super();this.nodeRpcUrlsConfig=o;this.api=s;this.client=new Pn({url:o.getNodeRpcUrl(this.chainSymbol)})}chainType="SUI";chainSymbol="SUI";client;send(){throw new U("Method send not implemented.")}async buildRawTransactionSwap(o){let s=o.sourceToken.suiAddresses;if(!s)throw new U("SUI token must contain 'suiAddresses'");(0,ad.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin);let i=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(i,s)}async buildRawTransactionSwapFromParams(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toTokenAddress:u,minimumReceiveAmount:l}=o,p=new Nr;p.setSender(a);let A={bridge:s.bridgeObjectAddress,coin:Ze({balance:BigInt(i),type:c}),receiveAmountMin:BigInt(l)},g=Cm(p,[c,u],A),P=await rn(b=>this.client.getCoins({owner:o.toAccountAddress,coinType:u,cursor:b}));return P.length===0||!P[0]?p.transferObjects([g],o.toAccountAddress):p.mergeCoins(P[0].coinObjectId,[g]),await p.toJSON({client:this.client})}async buildRawTransactionSend(o){let s=await Mr(this.chainType,o,this.api),{messenger:i}=s,a=o.sourceToken.suiAddresses;if(!a)throw new U("SUI token must contain 'suiAddresses'");switch((0,ad.setAddress)(a.bridgeAddress,a.bridgeAddressOrigin),(0,xm.setAddress)(a.utilsAddress),i){case 1:return this.buildRawTransactionAllbridgeSend(s,a);case 2:return this.buildRawTransactionWormholeSend(s,a);case 3:case 4:return this.buildRawTransactionCctpSend(o,s,a)}}async buildRawTransactionAllbridgeSend(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,Ka.Big)(b).plus(P).toFixed());let S=new Nr;if(S.setSender(a),g==="stablecoin"){let I=BigInt(i)-BigInt(b),F={bridge:s.bridgeObjectAddress,messenger:s.allbridgeMessengerObjectAddress,amount:Ze({balance:I,type:c}),destinationChainId:u,nonce:qr(),recipient:_r(S,Ir(l)),receiveToken:_r(S,Ir(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(b),type:c}),feeSuiCoin:Ze({balance:BigInt(0),useGasCoin:!1})};ed(S,c,F)}else{let I=b==="0"?Ze({balance:BigInt(b),useGasCoin:!1}):Ze({balance:BigInt(b)}),F={bridge:s.bridgeObjectAddress,messenger:s.allbridgeMessengerObjectAddress,amount:Ze({balance:BigInt(i),type:c}),destinationChainId:u,nonce:qr(),recipient:_r(S,Ir(l)),receiveToken:_r(S,Ir(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(0),type:c}),feeSuiCoin:I};ed(S,c,F)}return await S.toJSON({client:this.client})}async buildRawTransactionWormholeSend(o,s){let{amount:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=o,b=A;P&&(b=(0,Ka.Big)(b).plus(P).toFixed());let S=new Nr;if(S.setSender(a),g==="stablecoin"){let I=BigInt(i)-BigInt(b),F={bridge:s.bridgeObjectAddress,messenger:s.wormholeMessengerObjectAddress,wormholeState:s.wormholeStateObjectAddress,theClock:Ua,amount:Ze({balance:I,type:c}),destinationChainId:u,nonce:qr(),recipient:_r(S,Ir(l)),receiveToken:_r(S,Ir(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(b),type:c}),feeSuiCoin:Ze({balance:BigInt(0),useGasCoin:!1})};Ql(S,c,F)}else{let I=b==="0"?Ze({balance:BigInt(b),useGasCoin:!1}):Ze({balance:BigInt(b)}),F={bridge:s.bridgeObjectAddress,messenger:s.wormholeMessengerObjectAddress,wormholeState:s.wormholeStateObjectAddress,theClock:Ua,amount:Ze({balance:BigInt(i),type:c}),destinationChainId:u,nonce:qr(),recipient:_r(S,Ir(l)),receiveToken:_r(S,Ir(p)),gasOracle:s.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(0),type:c}),feeSuiCoin:I};Ql(S,c,F)}return await S.toJSON({client:this.client})}async buildRawTransactionCctpSend(o,s,i){let{amount:a,fromAccountAddress:c,fromTokenAddress:u,toChainId:l,toAccountAddress:p,fee:A,gasFeePaymentMethod:g,extraGas:P}=s;(0,Em.setAddress)(i.cctpAddress,i.cctpAddressOrigin);let b=A;P&&(b=(0,Ka.Big)(b).plus(P).toFixed());let S=new Nr;S.setSender(c);let I=_r(S,Ir(p)),F;if(o.destinationToken.chainType==="SOLANA"){let j=await Ta(this.chainType,o.toAccountAddress,o.destinationToken.tokenAddress,this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"));F=_r(S,Ir(j))}else F=I;if(g==="stablecoin"){let j=BigInt(a)-BigInt(b),G={cctpBridge:i.cctpObjectAddress,tokenMessengerMinterState:i.cctpTokenMessengerMinterStateObjectAddress,messageTransmitterState:i.cctpMessageTransmitterStateObjectAddress,treasury:i.cctpTreasuryObjectAddress,denyList:i.cctpDenyListObjectAddress,amount:Ze({balance:j,type:u}),destinationChainId:l,recipient:F,recipientWalletAddress:I,gasOracle:i.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(b),type:u}),feeSuiCoin:Ze({balance:BigInt(0),useGasCoin:!1})};nd(S,u,G)}else{let j=b==="0"?Ze({balance:BigInt(b),useGasCoin:!1}):Ze({balance:BigInt(b)}),G={cctpBridge:i.cctpObjectAddress,tokenMessengerMinterState:i.cctpTokenMessengerMinterStateObjectAddress,messageTransmitterState:i.cctpMessageTransmitterStateObjectAddress,treasury:i.cctpTreasuryObjectAddress,denyList:i.cctpDenyListObjectAddress,amount:Ze({balance:BigInt(a),type:u}),destinationChainId:l,recipient:F,recipientWalletAddress:I,gasOracle:i.gasOracleObjectAddress,feeTokenCoin:Ze({balance:BigInt(0),type:u}),feeSuiCoin:j};nd(S,u,G)}return await S.toJSON({client:this.client})}};var Um=require("big.js");var Dm=be(require("bn.js"));function Ya(n){return"0x"+new Dm.default(n).toString("hex")}function Nm(n){return new Promise(r=>setTimeout(()=>r(),n))}async function qa(n,r){let o=await n.trx.sign(r);if(!o.signature)throw new $n("Transaction was not signed properly");let i=(await n.trx.sendRawTransaction(o)).transaction.txID;return await QT(n,i),{txId:i}}async function QT(n,r,o=1e4){let s=Date.now();for(;;){if(Date.now()-s>o)throw new Ro("Transaction not found");let i=await n.trx.getUnconfirmedTransactionInfo(r);if(!i?.receipt){await Nm(2e3);continue}if(i.receipt.result==="SUCCESS")return i;throw new Ro(`Transaction status is ${i.receipt.result}`)}}var gi=class extends sr{constructor(o,s){super();this.tronWeb=o;this.api=s}chainType="TRX";async send(o){let s=await Mr(this.chainType,o,this.api),i=await this.buildRawTransactionSendFromParams(s);return await qa(this.tronWeb,i)}async buildRawTransactionSwap(o){let s=await Qr(this.chainType,o);return await this.buildRawTransactionSwapFromParams(s)}async buildRawTransactionSwapFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toAccountAddress:u,toTokenAddress:l,minimumReceiveAmount:p}=o,A=[{type:"uint256",value:s},{type:"bytes32",value:c},{type:"bytes32",value:l},{type:"address",value:u},{type:"uint256",value:p}];return this.buildRawTransaction(i,"swap(uint256,bytes32,bytes32,address,uint256)",A,"0",a)}async buildRawTransactionSend(o){let s=await Mr(this.chainType,o,this.api);return this.buildRawTransactionSendFromParams(s)}async buildRawTransactionSendFromParams(o){let{amount:s,contractAddress:i,fromAccountAddress:a,fromTokenAddress:c,toChainId:u,toAccountAddress:l,toTokenAddress:p,messenger:A,fee:g,gasFeePaymentMethod:P,extraGas:b}=o,S=g;b&&(S=(0,Um.Big)(S).plus(b).toFixed());let I=qr().toString(),F,j,G;return A==3||A==4?(P==="stablecoin"?(F=[{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"uint256",value:S}],j="0"):(F=[{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"uint256",value:0}],j=S),G="bridge(uint256,bytes32,uint256,uint256)"):(P==="stablecoin"?(F=[{type:"bytes32",value:c},{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"bytes32",value:p},{type:"uint256",value:I},{type:"uint8",value:A},{type:"uint256",value:S}],j="0"):(F=[{type:"bytes32",value:c},{type:"uint256",value:s},{type:"bytes32",value:l},{type:"uint256",value:u},{type:"bytes32",value:p},{type:"uint256",value:I},{type:"uint8",value:A},{type:"uint256",value:0}],j=S),G="swapAndBridge(bytes32,uint256,bytes32,uint256,bytes32,uint256,uint8,uint256)"),this.buildRawTransaction(i,G,F,j,a)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new U("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}};var Qa=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i;this.rawTxBuilder=new Pa(r,o,s,i)}rawTxBuilder;async getAllowance(r,o){let s,i;o?(s=r,i=o):i=r;let a=qs(i.token,i.messenger);return await this.tokenService.getAllowance({...i,spender:a},s)}async checkAllowance(r,o){let s,i;o?(s=r,i=o):i=r;let a=qs(i.token,i.messenger);return this.tokenService.checkAllowance({...i,spender:a},s)}async approve(r,o){let s=qs(o.token,o.messenger);return this.tokenService.approve(r,{...o,spender:s})}async send(r,o){return ze(o.amount),$e("amount",o.amount,o.sourceToken.decimals),(await wa(o.sourceToken.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,r)).send(o)}};function qs(n,r){if(r&&r==3){if(n.cctpAddress)return n.cctpAddress;throw new Ct("Such route does not support CCTP protocol")}else if(r&&r==4){if(n.cctpV2Address)return n.cctpV2Address;throw new Ct("Such route does not support CCTP V2 protocol")}else return n.bridgeAddress}async function wa(n,r,o,s,i){switch(Re.getChainProperty(n).chainType){case"EVM":{if(i)return new Ys(i,r,o);{let a=o.getNodeRpcUrl(n);return new Ys(new _m.Web3(a),r,o)}}case"TRX":if(i){let{TronWeb:a}=await Sr();return new gi(i,r)}else{let a=o.getNodeRpcUrl(n),{TronWeb:c}=await Sr();return new gi(new c({fullHost:a,solidityNode:a,eventServer:a}),r)}case"SOLANA":return new Wa(o.getNodeRpcUrl("SOL"),{wormholeMessengerProgramId:s.wormholeMessengerProgramId,solanaLookUpTable:s.solanaLookUpTable,cctpParams:s.cctpParams,jupiterParams:{jupiterUrl:s.jupiterUrl,jupiterApiKeyHeader:s.jupiterApiKeyHeader,jupiterMaxAccounts:s.jupiterMaxAccounts}},r);case"SRB":return new va(o,s,r);case"SUI":return new Xa(o,r)}}var Jm=require("big.js");var As=require("web3");var nn=require("big.js");function jm(n,r,o,s,i){let a=xe(n,3),c=(0,nn.Big)(a),u=(0,nn.Big)(o),l=(0,nn.Big)(s).plus(i),p,A;if(u.eq(0)||l.eq(0)){let P=c.div(2);p=(0,nn.Big)(s).plus(P),A=(0,nn.Big)(i).plus(P)}else p=(0,nn.Big)(s).plus(c.mul(s).div(l)),A=(0,nn.Big)(i).plus(c.mul(i).div(l));return(0,nn.Big)(Bd(r,p.toFixed(),A.toFixed())).minus(u).toFixed()}function zm(n){let r=xe(n,3);return(0,nn.Big)(r).round().toFixed()}var Cn=require("web3");var eP={abi:[{inputs:[{internalType:"address",name:"_router",type:"address"},{internalType:"uint256",name:"_a",type:"uint256"},{internalType:"contract ERC20",name:"_token",type:"address"},{internalType:"uint16",name:"_feeShareBP",type:"uint16"},{internalType:"uint256",name:"_balanceRatioMinBP",type:"uint256"},{internalType:"string",name:"lpName",type:"string"},{internalType:"string",name:"lpSymbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"vUsdAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SwappedFromVUsd",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vUsdAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SwappedToVUsd",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdraw",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"a",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"accRewardPerShareP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"adjustTotalLpAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"adminFeeAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"adminFeeShareBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"balanceRatioMinBP",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"canDeposit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"canWithdraw",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"claimAdminFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"d",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"feeShareBP",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"getY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"reserves",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"router",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_adminFeeShareBP",type:"uint256"}],name:"setAdminFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_balanceRatioMinBP",type:"uint256"}],name:"setBalanceRatioMinBP",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"_feeShareBP",type:"uint16"}],name:"setFeeShare",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_router",type:"address"}],name:"setRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_stopAuthority",type:"address"}],name:"setStopAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"startWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stopWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"receiveAmountMin",type:"uint256"},{internalType:"bool",name:"zeroFee",type:"bool"}],name:"swapFromVUsd",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"zeroFee",type:"bool"}],name:"swapToVUsd",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"contract ERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"userRewardDebt",outputs:[{internalType:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"vUsdBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amountLp",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]},hi=eP;var _t=class{lpAmount;rewardDebt;constructor(r){this.lpAmount=r.lpAmount,this.rewardDebt=r.rewardDebt}get userLiquidity(){return Ce(this.lpAmount,3).toFixed()}earned(r,o){let s=wd(this.lpAmount,this.rewardDebt,r.accRewardPerShareP,r.p);return o?Ce(s,o).toFixed():s}};var lr=class{};var yi=class extends lr{constructor(o,s){super();this.web3=o;this.api=s}chainType="EVM";P=52;async getUserBalanceInfo(o,s){let i;try{i=await ga(this.getUserBalanceInfoByBatch(o,s),`Cannot get UserBalanceInfo for ${s.name} on ${s.chainSymbol}`,5e3)}catch{i=await Ju(()=>this.getUserBalanceInfoPerProperty(o,s),`Cannot get UserBalanceInfo for ${s.name} on ${s.chainSymbol}`,5,2e3)}return i}async getPoolInfoFromChain(o){let s;try{s=await ga(this.getPoolInfoByBatch(o),`Cannot get PoolInfo for ${o.name} on ${o.chainSymbol}`,5e3)}catch{s=await Ju(()=>this.getPoolInfoPerProperty(o),`Cannot get PoolInfo for ${o.name} on ${o.chainSymbol}`,5,2e3)}return s}async getUserBalanceInfoByBatch(o,s){let i=new this.web3.eth.BatchRequest,a=this.getPoolContract(s.poolAddress),c=a.methods.userRewardDebt(o).encodeABI(),u=a.methods.balanceOf(o).encodeABI();i.add({method:"eth_call",params:[{to:s.poolAddress,data:c},"latest"]}),i.add({method:"eth_call",params:[{to:s.poolAddress,data:u},"latest"]});let[l,p]=await i.execute();if(l&&p&&!l.error&&!p.error)return new _t({lpAmount:Cn.Web3.utils.toBigInt(p.result).toString(),rewardDebt:Cn.Web3.utils.toBigInt(l.result).toString()});throw new Error("Batched failed")}async getUserBalanceInfoPerProperty(o,s){let i=(await this.getPoolContract(s.poolAddress).methods.userRewardDebt(o).call()).toString(),a=(await this.getPoolContract(s.poolAddress).methods.balanceOf(o).call()).toString();return new _t({lpAmount:a,rewardDebt:i})}async getPoolInfoByBatch(o){let s=new this.web3.eth.BatchRequest,i=this.getPoolContract(o.poolAddress),a=i.methods.a().encodeABI(),c=i.methods.d().encodeABI(),u=i.methods.tokenBalance().encodeABI(),l=i.methods.vUsdBalance().encodeABI(),p=i.methods.totalSupply().encodeABI(),A=i.methods.accRewardPerShareP().encodeABI();s.add({method:"eth_call",params:[{to:o.poolAddress,data:a},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:c},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:u},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:l},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:p},"latest"]}),s.add({method:"eth_call",params:[{to:o.poolAddress,data:A},"latest"]});let[g,P,b,S,I,F]=await s.execute();if(g&&P&&b&&S&&I&&F&&!g.error&&!P.error&&!b.error&&!S.error&&!I.error&&!F.error){let j=Cn.Web3.utils.toBigInt(b.result).toString(),G=Cn.Web3.utils.toBigInt(S.result).toString(),$=Et({tokenBalance:j,vUsdBalance:G});return{aValue:Cn.Web3.utils.toBigInt(g.result).toString(),dValue:Cn.Web3.utils.toBigInt(P.result).toString(),tokenBalance:j,vUsdBalance:G,totalLpAmount:Cn.Web3.utils.toBigInt(I.result).toString(),accRewardPerShareP:Cn.Web3.utils.toBigInt(F.result).toString(),p:this.P,imbalance:$}}throw new Error("Batched failed")}async getPoolInfoPerProperty(o){let s=this.getPoolContract(o.poolAddress),i=(await s.methods.a().call()).toString(),a=(await s.methods.d().call()).toString(),c=(await s.methods.tokenBalance().call()).toString(),u=(await s.methods.vUsdBalance().call()).toString(),l=(await s.methods.totalSupply().call()).toString(),p=(await s.methods.accRewardPerShareP().call()).toString(),A=Et({tokenBalance:c,vUsdBalance:u});return{aValue:i,dValue:a,tokenBalance:c,vUsdBalance:u,totalLpAmount:l,accRewardPerShareP:p,p:this.P,imbalance:A}}async buildRawTransactionDeposit(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.deposit(o.amount).encodeABI()})}async buildRawTransactionWithdraw(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.withdraw(o.amount).encodeABI()})}async buildRawTransactionClaimRewards(o){return Promise.resolve({...this.buildTxParams(o),data:this.getPoolContract(o.token.poolAddress).methods.claimRewards().encodeABI()})}buildTxParams(o){return{from:o.accountAddress,to:o.token.poolAddress,value:"0"}}getPoolContract(o){return new this.web3.eth.Contract(hi.abi,o)}};var ec=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i}async approve(r,o){if(o){let s=r,i=o;return this.tokenService.buildRawTransactionApprove({...i,spender:i.token.poolAddress},s)}else{let s=r;return this.tokenService.buildRawTransactionApprove({...s,spender:s.token.poolAddress})}}async deposit(r,o){return ze(r.amount),$e("amount",r.amount,r.token.decimals),r.amount=xe(r.amount,r.token.decimals).toFixed(),(await us(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionDeposit(r)}async withdraw(r,o){return ze(r.amount),$e("amount",r.amount,r.token.decimals),r.amount=xe(r.amount,3).toFixed(),(await us(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionWithdraw(r)}async claimRewards(r,o){return(await us(r.token.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).buildRawTransactionClaimRewards(r)}};var zr=require("@project-serum/anchor"),jr=require("@solana/web3.js");var tc=class extends lr{constructor(o,s){super();this.solanaRpcUrl=o;this.api=s}chainType="SOLANA";P=48;async getUserBalanceInfo(o,s){let i=this.buildAnchorProvider(o),a=this.getBridge(s.bridgeAddress,i),c=new jr.PublicKey(s.poolAddress),u=await a.account.pool.fetch(c);try{let l=await Xu(new jr.PublicKey(o),u.mint,a.programId),{lpAmount:p,rewardDebt:A}=await a.account.userDeposit.fetch(l);return new _t({lpAmount:p.toString(),rewardDebt:A.toString()})}catch{return new _t({lpAmount:"0",rewardDebt:"0"})}}async getPoolInfoFromChain(o){let s=this.buildAnchorProvider(o.bridgeAddress),i=await this.getBridge(o.bridgeAddress,s).account.pool.fetch(o.poolAddress),a=i.vUsdBalance.toString(),c=i.tokenBalance.toString(),u=Et({tokenBalance:c,vUsdBalance:a});return{dValue:i.d.toString(),aValue:i.a.toString(),totalLpAmount:i.totalLpAmount.toString(),vUsdBalance:a,tokenBalance:c,accRewardPerShareP:i.accRewardPerShareP.toString(),p:this.P,imbalance:u}}async buildRawTransactionDeposit(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.deposit(new zr.BN(o.amount)).accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new jr.PublicKey(o.accountAddress),await Qo(c,o.txFeeParams,this.solanaRpcUrl),c}async buildRawTransactionWithdraw(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.withdraw(new zr.BN(o.amount)).accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new jr.PublicKey(o.accountAddress),await Qo(c,o.txFeeParams,this.solanaRpcUrl),c}async buildRawTransactionClaimRewards(o){let{bridge:s,accounts:i,preInstructions:a}=await this.prepareDataForTransaction(o),c=await s.methods.claimRewards().accounts(i).preInstructions(a).transaction();return c.recentBlockhash=(await this.buildAnchorProvider(o.accountAddress).connection.getLatestBlockhash()).blockhash,c.feePayer=new jr.PublicKey(o.accountAddress),await Qo(c,o.txFeeParams,this.solanaRpcUrl),c}async prepareDataForTransaction(o){let s=this.buildAnchorProvider(o.accountAddress),i=this.getBridge(o.token.bridgeAddress,s),{accounts:a,preInstructions:c}=await this._getLPTransactionData(i,o.token.poolAddress,o.accountAddress,s);return{bridge:i,accounts:a,preInstructions:c}}getBridge(o,s){return new zr.Program(Qs,o,s)}buildAnchorProvider(o){let s=new jr.Connection(this.solanaRpcUrl,"confirmed"),i=new jr.PublicKey(o);return new zr.AnchorProvider(s,{publicKey:i},{preflightCommitment:"confirmed",commitment:"confirmed"})}async _getLPTransactionData(o,s,i,a){let c=new jr.PublicKey(i),u=await En(o.programId),l=await Xo(o.programId),p=new jr.PublicKey(s),g=(await o.account.pool.fetch(p)).mint,P=await vr(c,g),b=await Yo(g,o.programId),S=await Xu(c,g,o.programId),I=[zr.web3.ComputeBudgetProgram.setComputeUnitLimit({units:1e6})];try{await qo(P,a)}catch{let $=await zr.Spl.associatedToken(a).methods.create().accounts({mint:g,owner:c,associatedAccount:P}).instruction();I.push($)}try{await o.account.userDeposit.fetch(S)}catch{let G=await o.methods.initDepositAccount().accounts({mint:g,user:c,userDeposit:S}).instruction();I.push(G)}return{accounts:{mint:g,user:c,config:u,pool:p,bridgeAuthority:l,userDeposit:S,userToken:P,bridgeToken:b},preInstructions:I}}};var GF=require("@stellar/stellar-sdk");var e=require("@stellar/stellar-sdk"),tP=e.contract.Spec,rP=e.contract.Client;var rc=class extends rP{constructor(o){super(new tP(["AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABwAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAZicmlkZ2UAAAAAABMAAAAAAAAAAWEAAAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAADGZlZV9zaGFyZV9icAAAAAoAAAAAAAAAFGJhbGFuY2VfcmF0aW9fbWluX2JwAAAACgAAAAAAAAASYWRtaW5fZmVlX3NoYXJlX2JwAAAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAHZGVwb3NpdAAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABmFtb3VudAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAId2l0aGRyYXcAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAACWFtb3VudF9scAAAAAAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc3dhcF90b192X3VzZAAAAAAAAAMAAAAAAAAABHVzZXIAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAAPc3dhcF9mcm9tX3ZfdXNkAAAAAAQAAAAAAAAABHVzZXIAAAATAAAAAAAAAAt2dXNkX2Ftb3VudAAAAAAKAAAAAAAAABJyZWNlaXZlX2Ftb3VudF9taW4AAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=","AAAAAAAAAAAAAAANY2xhaW1fcmV3YXJkcwAAAAAAAAEAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAdgYWRtaW5gAAAAAA1zZXRfZmVlX3NoYXJlAAAAAAAAAQAAAAAAAAAMZmVlX3NoYXJlX2JwAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAWYWRqdXN0X3RvdGFsX2xwX2Ftb3VudAAAAAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAYc2V0X2JhbGFuY2VfcmF0aW9fbWluX2JwAAAAAQAAAAAAAAAUYmFsYW5jZV9yYXRpb19taW5fYnAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAMc3RvcF9kZXBvc2l0AAAAAAAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAANc3RhcnRfZGVwb3NpdAAAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAANc3RvcF93aXRoZHJhdwAAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAOc3RhcnRfd2l0aGRyYXcAAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAASc2V0X3N0b3BfYXV0aG9yaXR5AAAAAAABAAAAAAAAAA5zdG9wX2F1dGhvcml0eQAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAAKc2V0X2JyaWRnZQAAAAAAAQAAAAAAAAAGYnJpZGdlAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=","AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAJbmV3X2FkbWluAAAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD","AAAAAAAAAAAAAAATc2V0X2FkbWluX2ZlZV9zaGFyZQAAAAABAAAAAAAAABJhZG1pbl9mZWVfc2hhcmVfYnAAAAAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAAAAAAPY2xhaW1fYWRtaW5fZmVlAAAAAAAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAAAAAAZgdmlld2AAAAAAAA5wZW5kaW5nX3Jld2FyZAAAAAAAAQAAAAAAAAAEdXNlcgAAABMAAAABAAAD6QAAAAoAAAAD","AAAAAAAAAAAAAAAIZ2V0X3Bvb2wAAAAAAAAAAQAAA+kAAAfQAAAABFBvb2wAAAAD","AAAAAAAAAAAAAAAJZ2V0X2FkbWluAAAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAASZ2V0X3N0b3BfYXV0aG9yaXR5AAAAAAAAAAAAAQAAA+kAAAATAAAAAw==","AAAAAAAAAAAAAAAKZ2V0X2JyaWRnZQAAAAAAAAAAAAEAAAPpAAAAEwAAAAM=","AAAAAAAAAAAAAAAQZ2V0X3VzZXJfZGVwb3NpdAAAAAEAAAAAAAAABHVzZXIAAAATAAAAAQAAA+kAAAfQAAAAC1VzZXJEZXBvc2l0AAAAAAM=","AAAAAAAAAAAAAAAHdXBncmFkZQAAAAABAAAAAAAAAA1uZXdfd2FzbV9oYXNoAAAAAAAD7gAAACAAAAABAAAD6QAAA+0AAAAAAAAAAw==","AAAAAQAAAAAAAAAAAAAAD1N3YXBwZWRGcm9tVlVzZAAAAAAFAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAA2ZlZQAAAAAKAAAAAAAAAAlyZWNpcGllbnQAAAAAAAATAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAAC3Z1c2RfYW1vdW50AAAAAAo=","AAAAAQAAAAAAAAAAAAAADVN3YXBwZWRUb1ZVc2QAAAAAAAAFAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAAA2ZlZQAAAAAKAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABXRva2VuAAAAAAAAEwAAAAAAAAALdnVzZF9hbW91bnQAAAAACg==","AAAAAQAAAAAAAAAAAAAAB0RlcG9zaXQAAAAAAgAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAR1c2VyAAAAEw==","AAAAAQAAAAAAAAAAAAAACFdpdGhkcmF3AAAAAgAAAAAAAAAGYW1vdW50AAAAAAAKAAAAAAAAAAR1c2VyAAAAEw==","AAAAAQAAAAAAAAAAAAAADlJld2FyZHNDbGFpbWVkAAAAAAACAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAABHVzZXIAAAAT","AAAAAQAAAAAAAAAAAAAABkJyaWRnZQAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAgAAAAAAAAAAAAAAB0RhdGFLZXkAAAAAAQAAAAEAAAAAAAAAC1VzZXJEZXBvc2l0AAAAAAEAAAAT","AAAAAQAAAAAAAAAAAAAABFBvb2wAAAAPAAAAAAAAAAFhAAAAAAAACgAAAAAAAAAWYWNjX3Jld2FyZF9wZXJfc2hhcmVfcAAAAAAACgAAAAAAAAAQYWRtaW5fZmVlX2Ftb3VudAAAAAoAAAAAAAAAEmFkbWluX2ZlZV9zaGFyZV9icAAAAAAACgAAAAAAAAAUYmFsYW5jZV9yYXRpb19taW5fYnAAAAAKAAAAAAAAAAtjYW5fZGVwb3NpdAAAAAABAAAAAAAAAAxjYW5fd2l0aGRyYXcAAAABAAAAAAAAAAFkAAAAAAAACgAAAAAAAAAIZGVjaW1hbHMAAAAEAAAAAAAAAAxmZWVfc2hhcmVfYnAAAAAKAAAAAAAAAAhyZXNlcnZlcwAAAAoAAAAAAAAABXRva2VuAAAAAAAAEwAAAAAAAAANdG9rZW5fYmFsYW5jZQAAAAAAAAoAAAAAAAAAD3RvdGFsX2xwX2Ftb3VudAAAAAAKAAAAAAAAAA12X3VzZF9iYWxhbmNlAAAAAAAACg==","AAAAAQAAAAAAAAAAAAAAC1VzZXJEZXBvc2l0AAAAAAIAAAAAAAAACWxwX2Ftb3VudAAAAAAAAAoAAAAAAAAAC3Jld2FyZF9kZWJ0AAAAAAo=","AAAAAQAAAAAAAAAAAAAABUFkbWluAAAAAAAAAQAAAAAAAAABMAAAAAAAABM=","AAAAAQAAAAAAAAAAAAAAEEdhc09yYWNsZUFkZHJlc3MAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAAAQAAAAAAAAAAAAAACEdhc1VzYWdlAAAAAQAAAAAAAAABMAAAAAAAA+wAAAAEAAAACg==","AAAAAQAAAAAAAAAAAAAAC05hdGl2ZVRva2VuAAAAAAEAAAAAAAAAATAAAAAAAAAT","AAAAAQAAAAAAAAAAAAAADVN0b3BBdXRob3JpdHkAAAAAAAABAAAAAAAAAAEwAAAAAAAAEw==","AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAKAAAAAAAAAANVW5pbXBsZW1lbnRlZAAAAAAAAAAAAAAAAAAAC0luaXRpYWxpemVkAAAAAAEAAAAAAAAADVVuaW5pdGlhbGl6ZWQAAAAAAAACAAAAAAAAAAxVbmF1dGhvcml6ZWQAAAADAAAAAAAAAApJbnZhbGlkQXJnAAAAAAAEAAAAAAAAAA5JbnZhbGlkQ2hhaW5JZAAAAAAABQAAAAAAAAATSW52YWxpZE90aGVyQ2hhaW5JZAAAAAAGAAAAAAAAAA5HYXNVc2FnZU5vdFNldAAAAAAABwAAAAAAAAANQnJva2VuQWRkcmVzcwAAAAAAAAgAAAAAAAAACE5vdEZvdW5kAAAACQAAAAAAAAAYVG9rZW5JbnN1ZmZpY2llbnRCYWxhbmNlAAAACgAAAAAAAAAKQ2FzdEZhaWxlZAAAAAAACwAAAAAAAAAMVTI1Nk92ZXJmbG93AAAADAAAAAAAAAAKWmVyb0Ftb3VudAAAAAAAZwAAAAAAAAAMUG9vbE92ZXJmbG93AAAAaAAAAAAAAAALWmVyb0NoYW5nZXMAAAAAaQAAAAAAAAARUmVzZXJ2ZXNFeGhhdXN0ZWQAAAAAAABqAAAAAAAAABpJbnN1ZmZpY2llbnRSZWNlaXZlZEFtb3VudAAAAAAAawAAAAAAAAAUQmFsYW5jZVJhdGlvRXhjZWVkZWQAAABsAAAAAAAAAAlGb3JiaWRkZW4AAAAAAABtAAAAAAAAABlVbmF1dGhvcml6ZWRTdG9wQXV0aG9yaXR5AAAAAAAAywAAAAAAAAAOU3dhcFByb2hpYml0ZWQAAAAAAMwAAAAAAAAAEkFtb3VudFRvb0xvd0ZvckZlZQAAAAAAzQAAAAAAAAAWQnJpZGdlVG9UaGVaZXJvQWRkcmVzcwAAAAAAzgAAAAAAAAAORW1wdHlSZWNpcGllbnQAAAAAAM8AAAAAAAAAE1NvdXJjZU5vdFJlZ2lzdGVyZWQAAAAA0AAAAAAAAAAVV3JvbmdEZXN0aW5hdGlvbkNoYWluAAAAAAAA0QAAAAAAAAATVW5rbm93bkFub3RoZXJDaGFpbgAAAADSAAAAAAAAABFUb2tlbnNBbHJlYWR5U2VudAAAAAAAANMAAAAAAAAAEE1lc3NhZ2VQcm9jZXNzZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ"]),o);this.options=o}fromJSON={initialize:this.txFromJSON,deposit:this.txFromJSON,withdraw:this.txFromJSON,swap_to_v_usd:this.txFromJSON,swap_from_v_usd:this.txFromJSON,claim_rewards:this.txFromJSON,set_fee_share:this.txFromJSON,adjust_total_lp_amount:this.txFromJSON,set_balance_ratio_min_bp:this.txFromJSON,stop_deposit:this.txFromJSON,start_deposit:this.txFromJSON,stop_withdraw:this.txFromJSON,start_withdraw:this.txFromJSON,set_stop_authority:this.txFromJSON,set_bridge:this.txFromJSON,set_admin:this.txFromJSON,set_admin_fee_share:this.txFromJSON,claim_admin_fee:this.txFromJSON,pending_reward:this.txFromJSON,get_pool:this.txFromJSON,get_admin:this.txFromJSON,get_stop_authority:this.txFromJSON,get_bridge:this.txFromJSON,get_user_deposit:this.txFromJSON,upgrade:this.txFromJSON}};var cd=require("@stellar/stellar-sdk"),Vm=cd.rpc.Api;function ls(n){let{simulation:r,options:o}=n;if(!r)throw new Error("Soroban assembled transaction does not have simulation");if(Vm.isSimulationSuccess(r))return r.result==null?void 0:o.parseResultXdr(r.result.retval);throw new Error(r.error)}function ds(n){let{simulation:r}=n;if(!r)throw new Error("Soroban assembled transaction does not have simulation");return Vm.isSimulationError(r)}var nc=class extends lr{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";P=48;async getUserBalanceInfo(o,s){let a=await this.getContract(s.poolAddress).get_user_deposit({user:o});if(ds(a))throw new U;let c=ls(a);if(!c)throw new U;let u=c.unwrap();return new _t({lpAmount:u.lp_amount.toString(),rewardDebt:u.reward_debt.toString()})}async getPoolInfoFromChain(o){let i=await this.getContract(o.poolAddress).get_pool();if(ds(i))throw new U;let a=ls(i);if(!a)throw new U;let c=a.unwrap();return{aValue:c.a.toString(),accRewardPerShareP:c.acc_reward_per_share_p.toString(),dValue:c.d.toString(),tokenBalance:c.token_balance.toString(),p:this.P,totalLpAmount:c.total_lp_amount.toString(),vUsdBalance:c.v_usd_balance.toString(),imbalance:Et({tokenBalance:c.token_balance.toString(),vUsdBalance:c.v_usd_balance.toString()})}}async buildRawTransactionDeposit(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).deposit({sender:o.accountAddress,amount:BigInt(o.amount)})).toXDR()}async buildRawTransactionWithdraw(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).withdraw({sender:o.accountAddress,amount_lp:BigInt(o.amount)})).toXDR()}async buildRawTransactionClaimRewards(o){return(await this.getContract(o.token.poolAddress,o.accountAddress).claim_rewards({sender:o.accountAddress})).toXDR()}getContract(o,s){let i={publicKey:s,contractId:o,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new rc(i)}};var ps=be(Vn());wt();wt();Pt();function oc(n){return n=ne(n),n.startsWith(`${Gn}::balance::Balance<`)}var kt=class n{__StructClass=!0;static get $typeName(){return`${Gn}::balance::Balance`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;value;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.value=o.value}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return Qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("Balance",{value:R.u64()})}static fromFields(r,o){return n.reified(r).new({value:we("u64",o.value)})}static fromFieldsWithTypes(r,o){if(!oc(o.type))throw new Error("not a Balance type");return tn(o,[r]),n.reified(r).new({value:he("u64",o.fields.value)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{value:this.value.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({value:ye("u64",o.value)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return Ur(Ie(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!oc(o.type))throw new Error(`object at ${o.fields.id} is not a Balance object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!oc(o.bcs.type))throw new Error("object at is not a Balance object");let s=Ft(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,We.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching Balance object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!oc(i.data.bcs.type))throw new Error(`object at id ${s} is not a Balance object`);return n.fromSuiObjectData(o,i.data)}};var dd=be(Vn());wt();var ud=be(Vn());Pt();function sc(n){return n=ne(n),n.startsWith(`${ud.PKG_V1}::pool_rewards::PoolRewards<`)}var So=class n{__StructClass=!0;static get $typeName(){return`${ud.PKG_V1}::pool_rewards::PoolRewards`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;accRewardPerShareP;adminFeeShareBp;adminFee;rewards;lpSupply;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.accRewardPerShareP=o.accRewardPerShareP,this.adminFeeShareBp=o.adminFeeShareBp,this.adminFee=o.adminFee,this.rewards=o.rewards,this.lpSupply=o.lpSupply}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return Qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("PoolRewards",{acc_reward_per_share_p:R.u128(),admin_fee_share_bp:R.u64(),admin_fee:kt.bcs,rewards:kt.bcs,lp_supply:R.u64()})}static fromFields(r,o){return n.reified(r).new({accRewardPerShareP:we("u128",o.acc_reward_per_share_p),adminFeeShareBp:we("u64",o.admin_fee_share_bp),adminFee:we(kt.reified(r),o.admin_fee),rewards:we(kt.reified(r),o.rewards),lpSupply:we("u64",o.lp_supply)})}static fromFieldsWithTypes(r,o){if(!sc(o.type))throw new Error("not a PoolRewards type");return tn(o,[r]),n.reified(r).new({accRewardPerShareP:he("u128",o.fields.acc_reward_per_share_p),adminFeeShareBp:he("u64",o.fields.admin_fee_share_bp),adminFee:he(kt.reified(r),o.fields.admin_fee),rewards:he(kt.reified(r),o.fields.rewards),lpSupply:he("u64",o.fields.lp_supply)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{accRewardPerShareP:this.accRewardPerShareP.toString(),adminFeeShareBp:this.adminFeeShareBp.toString(),adminFee:this.adminFee.toJSONField(),rewards:this.rewards.toJSONField(),lpSupply:this.lpSupply.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({accRewardPerShareP:ye("u128",o.accRewardPerShareP),adminFeeShareBp:ye("u64",o.adminFeeShareBp),adminFee:ye(kt.reified(r),o.adminFee),rewards:ye(kt.reified(r),o.rewards),lpSupply:ye("u64",o.lpSupply)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return Ur(Ie(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!sc(o.type))throw new Error(`object at ${o.fields.id} is not a PoolRewards object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!sc(o.bcs.type))throw new Error("object at is not a PoolRewards object");let s=Ft(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,We.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching PoolRewards object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!sc(i.data.bcs.type))throw new Error(`object at id ${s} is not a PoolRewards object`);return n.fromSuiObjectData(o,i.data)}};wt();var ld=be(Vn());Pt();function ic(n){return n=ne(n),n.startsWith(`${ld.PKG_V1}::pool_state::PoolState<`)}var vo=class n{__StructClass=!0;static get $typeName(){return`${ld.PKG_V1}::pool_state::PoolState`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;tokenBalance;vusdBalance;d;a;balanceRatioMinBp;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.tokenBalance=o.tokenBalance,this.vusdBalance=o.vusdBalance,this.d=o.d,this.a=o.a,this.balanceRatioMinBp=o.balanceRatioMinBp}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return Qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("PoolState",{token_balance:R.u64(),vusd_balance:R.u64(),d:R.u64(),a:R.u64(),balance_ratio_min_bp:R.u64()})}static fromFields(r,o){return n.reified(r).new({tokenBalance:we("u64",o.token_balance),vusdBalance:we("u64",o.vusd_balance),d:we("u64",o.d),a:we("u64",o.a),balanceRatioMinBp:we("u64",o.balance_ratio_min_bp)})}static fromFieldsWithTypes(r,o){if(!ic(o.type))throw new Error("not a PoolState type");return tn(o,[r]),n.reified(r).new({tokenBalance:he("u64",o.fields.token_balance),vusdBalance:he("u64",o.fields.vusd_balance),d:he("u64",o.fields.d),a:he("u64",o.fields.a),balanceRatioMinBp:he("u64",o.fields.balance_ratio_min_bp)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{tokenBalance:this.tokenBalance.toString(),vusdBalance:this.vusdBalance.toString(),d:this.d.toString(),a:this.a.toString(),balanceRatioMinBp:this.balanceRatioMinBp.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({tokenBalance:ye("u64",o.tokenBalance),vusdBalance:ye("u64",o.vusdBalance),d:ye("u64",o.d),a:ye("u64",o.a),balanceRatioMinBp:ye("u64",o.balanceRatioMinBp)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return Ur(Ie(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!ic(o.type))throw new Error(`object at ${o.fields.id} is not a PoolState object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!ic(o.bcs.type))throw new Error("object at is not a PoolState object");let s=Ft(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,We.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching PoolState object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!ic(i.data.bcs.type))throw new Error(`object at id ${s} is not a PoolState object`);return n.fromSuiObjectData(o,i.data)}};Pt();function ac(n){return n=ne(n),n.startsWith(`${dd.PKG_V1}::pool::Pool<`)}var cc=class n{__StructClass=!0;static get $typeName(){return`${dd.PKG_V1}::pool::Pool`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;state;rewards;feeShareBp;canDeposit;canWithdraw;decimals;balance;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.id=o.id,this.state=o.state,this.rewards=o.rewards,this.feeShareBp=o.feeShareBp,this.canDeposit=o.canDeposit,this.canWithdraw=o.canWithdraw,this.decimals=o.decimals,this.balance=o.balance}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return Qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("Pool",{id:br.bcs,state:vo.bcs,rewards:So.bcs,fee_share_bp:R.u64(),can_deposit:R.bool(),can_withdraw:R.bool(),decimals:R.u8(),balance:kt.bcs})}static fromFields(r,o){return n.reified(r).new({id:we(br.reified(),o.id),state:we(vo.reified(r),o.state),rewards:we(So.reified(r),o.rewards),feeShareBp:we("u64",o.fee_share_bp),canDeposit:we("bool",o.can_deposit),canWithdraw:we("bool",o.can_withdraw),decimals:we("u8",o.decimals),balance:we(kt.reified(r),o.balance)})}static fromFieldsWithTypes(r,o){if(!ac(o.type))throw new Error("not a Pool type");return tn(o,[r]),n.reified(r).new({id:he(br.reified(),o.fields.id),state:he(vo.reified(r),o.fields.state),rewards:he(So.reified(r),o.fields.rewards),feeShareBp:he("u64",o.fields.fee_share_bp),canDeposit:he("bool",o.fields.can_deposit),canWithdraw:he("bool",o.fields.can_withdraw),decimals:he("u8",o.fields.decimals),balance:he(kt.reified(r),o.fields.balance)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{id:this.id,state:this.state.toJSONField(),rewards:this.rewards.toJSONField(),feeShareBp:this.feeShareBp.toString(),canDeposit:this.canDeposit,canWithdraw:this.canWithdraw,decimals:this.decimals,balance:this.balance.toJSONField()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({id:ye(br.reified(),o.id),state:ye(vo.reified(r),o.state),rewards:ye(So.reified(r),o.rewards),feeShareBp:ye("u64",o.feeShareBp),canDeposit:ye("bool",o.canDeposit),canWithdraw:ye("bool",o.canWithdraw),decimals:ye("u8",o.decimals),balance:ye(kt.reified(r),o.balance)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return Ur(Ie(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!ac(o.type))throw new Error(`object at ${o.fields.id} is not a Pool object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!ac(o.bcs.type))throw new Error("object at is not a Pool object");let s=Ft(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,We.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching Pool object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!ac(i.data.bcs.type))throw new Error(`object at id ${s} is not a Pool object`);return n.fromSuiObjectData(o,i.data)}};wt();var pd=be(Vn());Pt();function uc(n){return n=ne(n),n.startsWith(`${pd.PKG_V1}::user_deposit::UserDeposit<`)}var lc=class n{__StructClass=!0;static get $typeName(){return`${pd.PKG_V1}::user_deposit::UserDeposit`}static $numTypeParams=1;static $isPhantom=[!0];$typeName=n.$typeName;$fullTypeName;$typeArgs;$isPhantom=n.$isPhantom;id;lpAmount;rewardDebt;constructor(r,o){this.$fullTypeName=Ie(n.$typeName,...r),this.$typeArgs=r,this.id=o.id,this.lpAmount=o.lpAmount,this.rewardDebt=o.rewardDebt}static reified(r){return{typeName:n.$typeName,fullTypeName:Ie(n.$typeName,ue(r)),typeArgs:[ue(r)],isPhantom:n.$isPhantom,reifiedTypeArgs:[r],fromFields:o=>n.fromFields(r,o),fromFieldsWithTypes:o=>n.fromFieldsWithTypes(r,o),fromBcs:o=>n.fromBcs(r,o),bcs:n.bcs,fromJSONField:o=>n.fromJSONField(r,o),fromJSON:o=>n.fromJSON(r,o),fromSuiParsedData:o=>n.fromSuiParsedData(r,o),fromSuiObjectData:o=>n.fromSuiObjectData(r,o),fetch:async(o,s)=>n.fetch(o,r,s),new:o=>new n([ue(r)],o),kind:"StructClassReified"}}static get r(){return n.reified}static phantom(r){return Qe(n.reified(r))}static get p(){return n.phantom}static get bcs(){return R.struct("UserDeposit",{id:br.bcs,lp_amount:R.u64(),reward_debt:R.u64()})}static fromFields(r,o){return n.reified(r).new({id:we(br.reified(),o.id),lpAmount:we("u64",o.lp_amount),rewardDebt:we("u64",o.reward_debt)})}static fromFieldsWithTypes(r,o){if(!uc(o.type))throw new Error("not a UserDeposit type");return tn(o,[r]),n.reified(r).new({id:he(br.reified(),o.fields.id),lpAmount:he("u64",o.fields.lp_amount),rewardDebt:he("u64",o.fields.reward_debt)})}static fromBcs(r,o){return n.fromFields(r,n.bcs.parse(o))}toJSONField(){return{id:this.id,lpAmount:this.lpAmount.toString(),rewardDebt:this.rewardDebt.toString()}}toJSON(){return{$typeName:this.$typeName,$typeArgs:this.$typeArgs,...this.toJSONField()}}static fromJSONField(r,o){return n.reified(r).new({id:ye(br.reified(),o.id),lpAmount:ye("u64",o.lpAmount),rewardDebt:ye("u64",o.rewardDebt)})}static fromJSON(r,o){if(o.$typeName!==n.$typeName)throw new Error("not a WithTwoGenerics json object");return Ur(Ie(n.$typeName,ue(r)),o.$typeArgs,[r]),n.fromJSONField(r,o)}static fromSuiParsedData(r,o){if(o.dataType!=="moveObject")throw new Error("not an object");if(!uc(o.type))throw new Error(`object at ${o.fields.id} is not a UserDeposit object`);return n.fromFieldsWithTypes(r,o)}static fromSuiObjectData(r,o){if(o.bcs){if(o.bcs.dataType!=="moveObject"||!uc(o.bcs.type))throw new Error("object at is not a UserDeposit object");let s=Ft(o.bcs.type).typeArgs;if(s.length!==1)throw new Error(`type argument mismatch: expected 1 type argument but got '${s.length}'`);let i=ne(s[0]),a=ne(ue(r));if(i!==ne(ue(r)))throw new Error(`type argument mismatch: expected '${a}' but got '${i}'`);return n.fromBcs(r,(0,We.fromB64)(o.bcs.bcsBytes))}if(o.content)return n.fromSuiParsedData(r,o.content);throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.")}static async fetch(r,o,s){let i=await r.getObject({id:s,options:{showBcs:!0}});if(i.error)throw new Error(`error fetching UserDeposit object at id ${s}: ${i.error.code}`);if(i.data?.bcs?.dataType!=="moveObject"||!uc(i.data.bcs.type))throw new Error(`object at id ${s} is not a UserDeposit object`);return n.fromSuiObjectData(o,i.data)}};function Lm(n,r,o){if(r.length===0||!r[0])return[];let s=r[0],i=n.reduce((u,l)=>u+BigInt(l),BigInt(0)),a=BigInt(s.balance),c=[];for(let u of r.slice(1)){if(a>i)return Gm(o,s,c,n);a+=BigInt(u.balance),c.push(u)}return a>=i?Gm(o,s,c,n):[]}function Gm(n,r,o,s){let i=s.map(a=>n.pure.u64(a));return o.length>0&&n.mergeCoins(r.coinObjectId,o.map(a=>a.coinObjectId)),n.splitCoins(r.coinObjectId,i)}var nP="0x0000000000000000000000000000000000000000000000000000000000000000";async function $m(n,r,o){let s=await n.devInspectTransactionBlock({sender:nP,transactionBlock:r});if(s.effects.status.status!=="success")throw new Error(`inspectionResult failed. ${JSON.stringify(s,null,2)}`);let i=s.results?.pop()?.returnValues?.pop();if(!i)throw new Error(`Something with inspectionResult went wrong. ${JSON.stringify(s,null,2)}`);let[a,c]=i;return typeof o=="object"?o.fromBcs(Uint8Array.from(a)).toJSONField():mi(o).parse(Uint8Array.from(a))}var dc=class extends lr{constructor(o,s){super();this.suiRpcUrl=o;this.api=s;this.client=new Pn({url:o})}chainType="SUI";client;async getUserBalanceInfo(o,s){if(!s.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let i=s.suiAddresses;if(!i)throw new U("SUI token must contain 'suiAddresses'");(0,ps.setAddress)(i.bridgeAddress,i.bridgeAddressOrigin);let c=(await this.fetchDeposits(o,s.originTokenAddress)).reduce((u,l)=>{if(l.data)return u.lpAmount+=BigInt(l.data.content.fields.lp_amount),u.rewardDebt+=BigInt(l.data.content.fields.reward_debt),u;throw new U("Deposits fetch failed")},{lpAmount:BigInt(0),rewardDebt:BigInt(0)});return new _t({lpAmount:c.lpAmount.toString(),rewardDebt:c.rewardDebt.toString()})}async fetchDeposits(o,s){return await rn(i=>this.client.getOwnedObjects({owner:o,filter:{StructType:lc.phantom(Qe(s)).phantomType},options:{showContent:!0},cursor:i}))}async getPoolInfoFromChain(o){let s=o.suiAddresses;if(!s)throw new U("SUI token must contain 'suiAddresses'");if((0,ps.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let i=48,a=new Nr;vm(a,o.originTokenAddress,s.bridgeObjectAddress);let c=await $m(this.client,a,cc.reified(Qe(o.originTokenAddress))),u=c.state.tokenBalance,l=c.state.vusdBalance,p=Et({tokenBalance:u,vUsdBalance:l});return{dValue:c.state.d,aValue:c.state.a,totalLpAmount:c.rewards.lpSupply,vUsdBalance:l,tokenBalance:u,accRewardPerShareP:c.rewards.accRewardPerShareP,p:i,imbalance:p}}async buildRawTransactionDeposit(o){let s=o.token.suiAddresses;if(!s)throw new U("SUI token must contain 'suiAddresses'");if((0,ps.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let i=await rn(g=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:g}));if(i.length===0||!i[0])throw new Vr("No coins to deposit");let a=i[0],c=new Nr;c.setSender(o.accountAddress);let{depositObj:u,isNewDeposit:l}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,c),[p]=Lm([o.amount],i,c);if(!p)throw new Vr("No coins to deposit");if(!o.token.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let A=Bm(c,o.token.originTokenAddress,{bridge:s.bridgeObjectAddress,userDeposit:u,coin:p});return c.mergeCoins(a.coinObjectId,[A]),l&&c.transferObjects([u],o.accountAddress),await c.toJSON({client:this.client})}async getDepositObject(o,s,i){let a=await this.fetchDeposits(o,s);if(a.length===0||!a[0]){let c=Qe(s).phantomType;return{depositObj:Im(i,c),isNewDeposit:!0}}else{if(a[0].data?.objectId)return{depositObj:a[0].data.objectId,isNewDeposit:!1};throw new U("Something went wrong while deposit")}}async buildRawTransactionWithdraw(o){let s=o.token.suiAddresses;if(!s)throw new U("SUI token must contain 'suiAddresses'");if((0,ps.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let i=Qe(o.token.originTokenAddress).phantomType,a=new Nr;a.setSender(o.accountAddress);let{depositObj:c,isNewDeposit:u}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,a);if(u)throw new Vr("No deposit found");let l=Wm(a,i,{bridge:s.bridgeObjectAddress,userDeposit:c,amountLp:BigInt(o.amount)}),p=await rn(A=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:A}));if(!l[0]||!l[1])throw new U("No rewards found");return p[0]?a.mergeCoins(p[0].coinObjectId,[l[0],l[1]]):(a.mergeCoins(l[0],[l[1]]),a.transferObjects([l[0]],o.accountAddress)),await a.toJSON({client:this.client})}async buildRawTransactionClaimRewards(o){let s=o.token.suiAddresses;if(!s)throw new U("SUI token must contain 'suiAddresses'");if((0,ps.setAddress)(s.bridgeAddress,s.bridgeAddressOrigin),!o.token.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");let i=Qe(o.token.originTokenAddress).phantomType,a=new Nr;a.setSender(o.accountAddress);let{depositObj:c,isNewDeposit:u}=await this.getDepositObject(o.accountAddress,o.token.originTokenAddress,a);if(u)throw new Vr("No deposit found");let l=Sm(a,i,{bridge:s.bridgeObjectAddress,userDeposit:c}),p=await rn(A=>this.client.getCoins({owner:o.accountAddress,coinType:o.token.originTokenAddress,cursor:A}));return p[0]?a.mergeCoins(p[0].coinObjectId,[l]):a.transferObjects([l],o.accountAddress),await a.toJSON({client:this.client})}};var bi=require("web3"),Zm=require("web3-eth-abi");var Ti=class extends lr{constructor(o,s,i){super();this.tronWeb=o;this.api=s;this.tronJsonRpc=i}chainType="TRX";P=52;async getUserBalanceInfo(o,s){let i;if(this.tronJsonRpc)try{i=await this.getUserBalanceInfoByBatch(this.tronJsonRpc,o,s)}catch{i=await this.getUserBalanceInfoPerProperty(o,s)}else i=await this.getUserBalanceInfoPerProperty(o,s);return i}async getUserBalanceInfoByBatch(o,s,i){let a=await Ks(i.poolAddress),c=await Ks(s),u=[{jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:a,data:this.getFunctionAbi("userRewardDebt",c)},"latest"]},{jsonrpc:"2.0",id:2,method:"eth_call",params:[{to:a,data:this.getFunctionAbi("balanceOf",c)},"latest"]}],p=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).json();if(Array.isArray(p)&&p.length===2){let A=g=>{let P=p.find(b=>b.id===g);if(!P||!P.result)throw new Error(`Missing or invalid result for id ${g}`);return bi.Web3.utils.toBigInt(P.result).toString()};return new _t({lpAmount:bi.Web3.utils.toBigInt(A(2)).toString(),rewardDebt:bi.Web3.utils.toBigInt(A(1)).toString()})}throw new Error("Batched HTTP call failed")}async getUserBalanceInfoPerProperty(o,s){this.tronWeb.defaultAddress.base58||this.tronWeb.setAddress(o);let i=this.getContract(s.poolAddress),a=(await i.methods.userRewardDebt(o).call()).toString(),c=(await i.methods.balanceOf(o).call()).toString();return new _t({lpAmount:c,rewardDebt:a})}async getPoolInfoFromChain(o){let s;if(this.tronJsonRpc)try{s=await this.getPoolInfoByBatch(this.tronJsonRpc,o)}catch{s=await this.getPoolInfoPerProperty(o)}else s=await this.getPoolInfoPerProperty(o);return s}async getPoolInfoByBatch(o,s){let i=await Ks(s.poolAddress),a=[{jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("a")},"latest"]},{jsonrpc:"2.0",id:2,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("d")},"latest"]},{jsonrpc:"2.0",id:3,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("tokenBalance")},"latest"]},{jsonrpc:"2.0",id:4,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("vUsdBalance")},"latest"]},{jsonrpc:"2.0",id:5,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("totalSupply")},"latest"]},{jsonrpc:"2.0",id:6,method:"eth_call",params:[{to:i,data:this.getFunctionAbi("accRewardPerShareP")},"latest"]}],u=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(Array.isArray(u)&&u.length===6){let l=P=>{let b=u.find(S=>S.id===P);if(!b||!b.result)throw new Error(`Missing or invalid result for id ${P}`);return bi.Web3.utils.toBigInt(b.result).toString()},p=l(3),A=l(4),g=Et({tokenBalance:p,vUsdBalance:A});return{aValue:l(1),dValue:l(2),tokenBalance:p,vUsdBalance:A,totalLpAmount:l(5),accRewardPerShareP:l(6),p:this.P,imbalance:g}}throw new Error("Batched pool info call failed")}async getPoolInfoPerProperty(o){this.tronWeb.defaultAddress.base58||this.tronWeb.setAddress(o.poolAddress);let s=this.getContract(o.poolAddress),[i,a,c,u,l,p]=await Promise.all([s.methods.a().call(),s.methods.d().call(),s.methods.tokenBalance().call(),s.methods.vUsdBalance().call(),s.methods.totalSupply().call(),s.methods.accRewardPerShareP().call()]),A=c.toString(),g=u.toString(),P=Et({tokenBalance:A,vUsdBalance:g});return{aValue:i.toString(),dValue:a.toString(),tokenBalance:A,vUsdBalance:g,totalLpAmount:l.toString(),accRewardPerShareP:p.toString(),p:this.P,imbalance:P}}buildRawTransactionDeposit(o){let{amount:s,accountAddress:i}=o,a=[{type:"uint256",value:s}];return this.buildRawTransaction(o.token.poolAddress,"deposit(uint256)",a,"0",i)}buildRawTransactionWithdraw(o){let{amount:s,accountAddress:i}=o,a=[{type:"uint256",value:s}];return this.buildRawTransaction(o.token.poolAddress,"withdraw(uint256)",a,"0",i)}buildRawTransactionClaimRewards(o){let{accountAddress:s}=o,i=[];return this.buildRawTransaction(o.token.poolAddress,"claimRewards()",i,"0",s)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new U("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}getContract(o){return this.tronWeb.contract(hi.abi,o)}getFunctionAbi(o,...s){let i=hi.abi.find(a=>a.type==="function"&&"name"in a&&a.name===o);if(!i)throw new Error(`${o} method not found in Pool ABI`);return(0,Zm.encodeFunctionCall)(i,s)}};var pc=class{constructor(r,o,s,i){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s;this.tokenService=i;this.rawTxBuilder=new ec(r,o,this.params,i);let a=s.cachePoolInfoChainSec>0?s.cachePoolInfoChainSec*1e3:20*1e3;this.cache=new on({defaultTtl:a})}rawTxBuilder;cache;async getAllowance(r,o){if(o){let s=r,i=o;return await this.tokenService.getAllowance({...i,spender:i.token.poolAddress},s)}else{let s=r;return await this.tokenService.getAllowance({...s,spender:s.token.poolAddress})}}async checkAllowance(r,o){if(o){let s=r,i=o;return this.tokenService.checkAllowance({...i,spender:i.token.poolAddress},s)}else{let s=r;return this.tokenService.checkAllowance({...s,spender:s.token.poolAddress})}}async approve(r,o){return this.tokenService.approve(r,{...o,spender:o.token.poolAddress})}async getAmountToBeDeposited(r,o,s){ze(r),$e("amount",r,o.decimals);let i=await this.getPoolInfoFromChain(o,s),{vUsdBalance:a,tokenBalance:c,aValue:u,dValue:l}=i,p=jm(r,u,l,c,a);return Ce(p,3).toFixed()}async getAmountToBeWithdrawn(r,o,s,i){ze(r),$e("amount",r,s.decimals);let a=await this.getPoolInfoFromChain(s,i),c=zm(r),u=Yt(c,s.decimals),p=(await this.getUserBalanceInfo(o,s,i)).earned(a)||"0",A=(0,Jm.Big)(u).plus(p).toFixed();return Ce(A,s.decimals).toFixed()}async getUserBalanceInfo(r,o,s){return(await us(o.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,s)).getUserBalanceInfo(r,o)}async getPoolInfoFromChain(r,o){let s={chainSymbol:r.chainSymbol,poolAddress:r.poolAddress},i=this.cache.get(s);if(i)return i;{let a=await(await us(r.chainSymbol,this.api,this.nodeRpcUrlsConfig,this.params,o)).getPoolInfoFromChain(r);return this.cache.put(s,a),this.api.cachePut({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress},a),a}}};async function us(n,r,o,s,i){switch(Re.getChainProperty(n).chainType){case"EVM":{if(i)return new yi(i,r);{let a=o.getNodeRpcUrl(n),c=new As.Web3(a);return c.defaultReturnFormat={number:As.FMT_NUMBER.STR,bytes:As.FMT_BYTES.HEX},new yi(c,r)}}case"TRX":{let a=o.getNodeRpcUrl(n),c=s.tronJsonRpc;if(i){let{TronWeb:u}=await Sr();return new Ti(i,r,c)}else{let{TronWeb:u}=await Sr(),l=new u({fullHost:a});return new Ti(l,r,c)}}case"SOLANA":{let a=o.getNodeRpcUrl(n);return new tc(a,r)}case"SRB":return new nc(o,s,r);case"SUI":return new dc(o.getNodeRpcUrl(n),r)}}var et=require("big.js");function Xm(n,r,o){let s=oP(n,{decimals:r.decimals,feeShare:r.feeShare},r.poolInfo),i=sP(s.amountIncludingCommissionInSystemPrecision,{decimals:o.decimals,feeShare:o.feeShare},o.poolInfo);return{swapToVUsdCalcResult:s,swapFromVUsdCalcResult:i}}function Ym(n,r,o){let s=iP(n,{decimals:o.decimals,feeShare:o.feeShare},o.poolInfo),i=aP(s.amountIncludingCommissionInSystemPrecision,{decimals:r.decimals,feeShare:r.feeShare},r.poolInfo);return{swapToVUsdCalcResult:s,swapFromVUsdCalcResult:i}}function oP(n,{feeShare:r,decimals:o},s){let i=(0,et.Big)(n),a=i.times(r),c=i.minus(a);return{bridgeFeeInTokenPrecision:a.round().toFixed(),amountIncludingCommissionInSystemPrecision:Hm(Zn(c,o),s),amountExcludingCommissionInSystemPrecision:Hm(Zn(i,o),s)}}function Hm(n,r){if(n.eq(0))return"0";let o=(0,et.Big)(r.tokenBalance).plus(n),s=Zr(o.toFixed(),r.aValue,r.dValue);return(0,et.Big)(r.vUsdBalance).minus(s).round().toFixed()}function sP(n,{feeShare:r,decimals:o},s){if((0,et.Big)(n).eq(0))return{bridgeFeeInTokenPrecision:"0",amountIncludingCommissionInTokenPrecision:"0",amountExcludingCommissionInTokenPrecision:"0"};let a=(0,et.Big)(n).plus(s.vUsdBalance),c=Zr(a,s.aValue,s.dValue),u=Yt((0,et.Big)(s.tokenBalance).minus(c),o),l=(0,et.Big)(u).times(r),p=(0,et.Big)(u).minus(l).round();return{bridgeFeeInTokenPrecision:l.round().toFixed(),amountIncludingCommissionInTokenPrecision:p.toFixed(),amountExcludingCommissionInTokenPrecision:u.toFixed()}}function iP(n,{feeShare:r,decimals:o},s){let i=(0,et.Big)(r).div((0,et.Big)(1).minus(r)),a=(0,et.Big)(n).times(i),c=(0,et.Big)(n).plus(a);return{bridgeFeeInTokenPrecision:a.round().toFixed(),amountIncludingCommissionInSystemPrecision:Km(Zn(c,o),s),amountExcludingCommissionInSystemPrecision:Km(Zn(n,o),s)}}function Km(n,r){let o=(0,et.Big)(r.tokenBalance).minus(n),s=Zr(o.toFixed(),r.aValue,r.dValue);return(0,et.Big)(s).minus(r.vUsdBalance).round().toFixed()}function aP(n,{feeShare:r,decimals:o},s){if((0,et.Big)(n).eq(0))return{bridgeFeeInTokenPrecision:"0",amountIncludingCommissionInTokenPrecision:"0",amountExcludingCommissionInTokenPrecision:"0"};let i=(0,et.Big)(s.vUsdBalance).minus(n),a=Zr(i.toFixed(),s.aValue,s.dValue),c=(0,et.Big)(a).minus(s.tokenBalance),u=Yt(c.toFixed(),o),l=(0,et.Big)(r).div((0,et.Big)(1).minus(r)),p=(0,et.Big)(u).times(l),A=(0,et.Big)(u).plus(p);return{bridgeFeeInTokenPrecision:p.round().toFixed(),amountIncludingCommissionInTokenPrecision:A.round().toFixed(),amountExcludingCommissionInTokenPrecision:u.toFixed()}}var Bn=require("big.js");function qm(n,r,o,s,i){let a=$r(n,r,o),c=Yt(a,r.decimals),u=Ps(a,s,i),l=(0,Bn.Big)(n).times(r.feeShare),p=(0,Bn.Big)(u).div((0,Bn.Big)(1).minus(s.feeShare)).minus(u);return{sourceLPSwap:{fee:Ce(l,r.decimals).neg().round(r.decimals,Bn.Big.roundUp).toFixed(),swap:Ce((0,Bn.Big)(n).minus(c).minus(l),r.decimals).neg().round(r.decimals,Bn.Big.roundUp).toFixed()},destLPSwap:{fee:Ce(p,s.decimals).neg().round(s.decimals,Bn.Big.roundUp).toFixed(),swap:Ce(Yt(a,s.decimals).minus(u).minus(p),s.decimals).neg().round(s.decimals,Bn.Big.roundUp).toFixed()}}}var fs=require("@solana/web3.js");var Ac=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.params=o}async addMemoToTx(r,o){if(o.length>28)throw new U("InvalidArgumentException memo cannot be more than 28 characters");let s=new fs.Connection(this.nodeRpcUrlsConfig.getNodeRpcUrl("SOL"),"confirmed"),i=await mo(r,s),a=fs.TransactionMessage.decompile(r.message,{addressLookupTableAccounts:i}),c=a.instructions[a.instructions.length-1];if(!c?.keys)throw new U("Last instruction or its keys are invalid.");c.keys.push({pubkey:new fs.PublicKey(Buffer.from(o)),isSigner:!1,isWritable:!1}),r.message=a.compileToV0Message(i)}};var je=require("@stellar/stellar-sdk");var L2=require("@stellar/stellar-sdk"),cP=L2.contract.Spec,uP=L2.contract.Client;var Pi=class extends uP{constructor(o){super(new cP(["AAAAAAAAAYlSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW4gdGhlIHNwZW5kZXIgdHJhbnNmZXJzIGFtb3VudHMsIHRoZSBhbGxvd2FuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQgdHJhbnNmZXJlZC4KCiMgQXJndW1lbnRzCgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHRvIGJlIGRyYXduIGZyb20uCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3Mgc3BlbmRpbmcgdGhlIHRva2VucyBoZWxkIGJ5IGBmcm9tYC4AAAAAAAAJYWxsb3dhbmNlAAAAAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEwAAAAEAAAAL","AAAAAAAAAIlSZXR1cm5zIHRydWUgaWYgYGlkYCBpcyBhdXRob3JpemVkIHRvIHVzZSBpdHMgYmFsYW5jZS4KCiMgQXJndW1lbnRzCgoqIGBpZGAgLSBUaGUgYWRkcmVzcyBmb3Igd2hpY2ggdG9rZW4gYXV0aG9yaXphdGlvbiBpcyBiZWluZyBjaGVja2VkLgAAAAAAAAphdXRob3JpemVkAAAAAAABAAAAAAAAAAJpZAAAAAAAEwAAAAEAAAAB","AAAAAAAAA55TZXQgdGhlIGFsbG93YW5jZSBieSBgYW1vdW50YCBmb3IgYHNwZW5kZXJgIHRvIHRyYW5zZmVyL2J1cm4gZnJvbQpgZnJvbWAuCgpUaGUgYW1vdW50IHNldCBpcyB0aGUgYW1vdW50IHRoYXQgc3BlbmRlciBpcyBhcHByb3ZlZCB0byB0cmFuc2ZlciBvdXQgb2YKZnJvbSdzIGJhbGFuY2UuIFRoZSBzcGVuZGVyIHdpbGwgYmUgYWxsb3dlZCB0byB0cmFuc2ZlciBhbW91bnRzLCBhbmQKd2hlbiBhbiBhbW91bnQgaXMgdHJhbnNmZXJyZWQgdGhlIGFsbG93YW5jZSB3aWxsIGJlIHJlZHVjZWQgYnkgdGhlCmFtb3VudCB0cmFuc2ZlcmVkLgoKIyBBcmd1bWVudHMKCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgdG8gYmUgZHJhd24gZnJvbS4KKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBiZWluZyBhdXRob3JpemVkIHRvIHNwZW5kIHRoZSB0b2tlbnMgaGVsZCBieQpgZnJvbWAuCiogYGFtb3VudGAgLSBUaGUgdG9rZW5zIHRvIGJlIG1hZGUgYXZhaWxhYmxlIHRvIGBzcGVuZGVyYC4KKiBgZXhwaXJhdGlvbl9sZWRnZXJgIC0gVGhlIGxlZGdlciBudW1iZXIgd2hlcmUgdGhpcyBhbGxvd2FuY2UgZXhwaXJlcy4gQ2Fubm90CmJlIGxlc3MgdGhhbiB0aGUgY3VycmVudCBsZWRnZXIgbnVtYmVyIHVubGVzcyB0aGUgYW1vdW50IGlzIGJlaW5nIHNldCB0byAwLgpBbiBleHBpcmVkIGVudHJ5ICh3aGVyZSBleHBpcmF0aW9uX2xlZGdlciA8IHRoZSBjdXJyZW50IGxlZGdlciBudW1iZXIpCnNob3VsZCBiZSB0cmVhdGVkIGFzIGEgMCBhbW91bnQgYWxsb3dhbmNlLgoKIyBFdmVudHMKCkVtaXRzIGFuIGV2ZW50IHdpdGggdG9waWNzIGBbImFwcHJvdmUiLCBmcm9tOiBBZGRyZXNzLApzcGVuZGVyOiBBZGRyZXNzXSwgZGF0YSA9IFthbW91bnQ6IGkxMjgsIGV4cGlyYXRpb25fbGVkZ2VyOiB1MzJdYAAAAAAAB2FwcHJvdmUAAAAABAAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAAAAABFleHBpcmF0aW9uX2xlZGdlcgAAAAAAAAQAAAAA","AAAAAAAAAJhSZXR1cm5zIHRoZSBiYWxhbmNlIG9mIGBpZGAuCgojIEFyZ3VtZW50cwoKKiBgaWRgIC0gVGhlIGFkZHJlc3MgZm9yIHdoaWNoIGEgYmFsYW5jZSBpcyBiZWluZyBxdWVyaWVkLiBJZiB0aGUKYWRkcmVzcyBoYXMgbm8gZXhpc3RpbmcgYmFsYW5jZSwgcmV0dXJucyAwLgAAAAdiYWxhbmNlAAAAAAEAAAAAAAAAAmlkAAAAAAATAAAAAQAAAAs=","AAAAAAAAAWRCdXJuIGBhbW91bnRgIGZyb20gYGZyb21gLgoKUmVkdWNlcyBmcm9tJ3MgYmFsYW5jZSBieSB0aGUgYW1vdW50LCB3aXRob3V0IHRyYW5zZmVycmluZyB0aGUgYmFsYW5jZQp0byBhbm90aGVyIGhvbGRlcidzIGJhbGFuY2UuCgojIEFyZ3VtZW50cwoKKiBgZnJvbWAgLSBUaGUgYWRkcmVzcyBob2xkaW5nIHRoZSBiYWxhbmNlIG9mIHRva2VucyB3aGljaCB3aWxsIGJlCmJ1cm5lZCBmcm9tLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgYnVybmVkLgoKIyBFdmVudHMKCkVtaXRzIGFuIGV2ZW50IHdpdGggdG9waWNzIGBbImJ1cm4iLCBmcm9tOiBBZGRyZXNzXSwgZGF0YSA9IFthbW91bnQ6CmkxMjhdYAAAAARidXJuAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAtxCdXJuIGBhbW91bnRgIGZyb20gYGZyb21gLCBjb25zdW1pbmcgdGhlIGFsbG93YW5jZSBvZiBgc3BlbmRlcmAuCgpSZWR1Y2VzIGZyb20ncyBiYWxhbmNlIGJ5IHRoZSBhbW91bnQsIHdpdGhvdXQgdHJhbnNmZXJyaW5nIHRoZSBiYWxhbmNlCnRvIGFub3RoZXIgaG9sZGVyJ3MgYmFsYW5jZS4KClRoZSBzcGVuZGVyIHdpbGwgYmUgYWxsb3dlZCB0byBidXJuIHRoZSBhbW91bnQgZnJvbSBmcm9tJ3MgYmFsYW5jZSwgaWYKdGhlIGFtb3VudCBpcyBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gdGhlIGFsbG93YW5jZSB0aGF0IHRoZSBzcGVuZGVyIGhhcwpvbiB0aGUgZnJvbSdzIGJhbGFuY2UuIFRoZSBzcGVuZGVyJ3MgYWxsb3dhbmNlIG9uIGZyb20ncyBiYWxhbmNlIHdpbGwgYmUKcmVkdWNlZCBieSB0aGUgYW1vdW50LgoKIyBBcmd1bWVudHMKCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3MgYXV0aG9yaXppbmcgdGhlIGJ1cm4sIGFuZCBoYXZpbmcgaXRzIGFsbG93YW5jZQpjb25zdW1lZCBkdXJpbmcgdGhlIGJ1cm4uCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgd2hpY2ggd2lsbCBiZQpidXJuZWQgZnJvbS4KKiBgYW1vdW50YCAtIFRoZSBhbW91bnQgb2YgdG9rZW5zIHRvIGJlIGJ1cm5lZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJidXJuIiwgZnJvbTogQWRkcmVzc10sIGRhdGEgPSBbYW1vdW50OgppMTI4XWAAAAAJYnVybl9mcm9tAAAAAAAAAwAAAAAAAAAHc3BlbmRlcgAAAAATAAAAAAAAAARmcm9tAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==","AAAAAAAAAVNDbGF3YmFjayBgYW1vdW50YCBmcm9tIGBmcm9tYCBhY2NvdW50LiBgYW1vdW50YCBpcyBidXJuZWQgaW4gdGhlCmNsYXdiYWNrIHByb2Nlc3MuCgojIEFyZ3VtZW50cwoKKiBgZnJvbWAgLSBUaGUgYWRkcmVzcyBob2xkaW5nIHRoZSBiYWxhbmNlIGZyb20gd2hpY2ggdGhlIGNsYXdiYWNrIHdpbGwKdGFrZSB0b2tlbnMuCiogYGFtb3VudGAgLSBUaGUgYW1vdW50IG9mIHRva2VucyB0byBiZSBjbGF3ZWQgYmFjay4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJjbGF3YmFjayIsIGFkbWluOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAACGNsYXdiYWNrAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAIBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZGVjaW1hbHMgdXNlZCB0byByZXByZXNlbnQgYW1vdW50cyBvZiB0aGlzIHRva2VuLgoKIyBQYW5pY3MKCklmIHRoZSBjb250cmFjdCBoYXMgbm90IHlldCBiZWVuIGluaXRpYWxpemVkLgAAAAhkZWNpbWFscwAAAAAAAAABAAAABA==","AAAAAAAAAPVNaW50cyBgYW1vdW50YCB0byBgdG9gLgoKIyBBcmd1bWVudHMKCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgbWludGVkIHRva2Vucy4KKiBgYW1vdW50YCAtIFRoZSBhbW91bnQgb2YgdG9rZW5zIHRvIGJlIG1pbnRlZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJtaW50IiwgYWRtaW46IEFkZHJlc3MsIHRvOiBBZGRyZXNzXSwgZGF0YQo9IFthbW91bnQ6IGkxMjhdYAAAAAAAAARtaW50AAAAAgAAAAAAAAACdG8AAAAAABMAAAAAAAAABmFtb3VudAAAAAAACwAAAAA=","AAAAAAAAAFlSZXR1cm5zIHRoZSBuYW1lIGZvciB0aGlzIHRva2VuLgoKIyBQYW5pY3MKCklmIHRoZSBjb250cmFjdCBoYXMgbm90IHlldCBiZWVuIGluaXRpYWxpemVkLgAAAAAAAARuYW1lAAAAAAAAAAEAAAAQ","AAAAAAAAAQxTZXRzIHRoZSBhZG1pbmlzdHJhdG9yIHRvIHRoZSBzcGVjaWZpZWQgYWRkcmVzcyBgbmV3X2FkbWluYC4KCiMgQXJndW1lbnRzCgoqIGBuZXdfYWRtaW5gIC0gVGhlIGFkZHJlc3Mgd2hpY2ggd2lsbCBoZW5jZWZvcnRoIGJlIHRoZSBhZG1pbmlzdHJhdG9yCm9mIHRoaXMgdG9rZW4gY29udHJhY3QuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsic2V0X2FkbWluIiwgYWRtaW46IEFkZHJlc3NdLCBkYXRhID0KW25ld19hZG1pbjogQWRkcmVzc11gAAAACXNldF9hZG1pbgAAAAAAAAEAAAAAAAAACW5ld19hZG1pbgAAAAAAABMAAAAA","AAAAAAAAAEZSZXR1cm5zIHRoZSBhZG1pbiBvZiB0aGUgY29udHJhY3QuCgojIFBhbmljcwoKSWYgdGhlIGFkbWluIGlzIG5vdCBzZXQuAAAAAAAFYWRtaW4AAAAAAAAAAAAAAQAAABM=","AAAAAAAAAVBTZXRzIHdoZXRoZXIgdGhlIGFjY291bnQgaXMgYXV0aG9yaXplZCB0byB1c2UgaXRzIGJhbGFuY2UuIElmCmBhdXRob3JpemVkYCBpcyB0cnVlLCBgaWRgIHNob3VsZCBiZSBhYmxlIHRvIHVzZSBpdHMgYmFsYW5jZS4KCiMgQXJndW1lbnRzCgoqIGBpZGAgLSBUaGUgYWRkcmVzcyBiZWluZyAoZGUtKWF1dGhvcml6ZWQuCiogYGF1dGhvcml6ZWAgLSBXaGV0aGVyIG9yIG5vdCBgaWRgIGNhbiB1c2UgaXRzIGJhbGFuY2UuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsic2V0X2F1dGhvcml6ZWQiLCBpZDogQWRkcmVzc10sIGRhdGEgPQpbYXV0aG9yaXplOiBib29sXWAAAAAOc2V0X2F1dGhvcml6ZWQAAAAAAAIAAAAAAAAAAmlkAAAAAAATAAAAAAAAAAlhdXRob3JpemUAAAAAAAABAAAAAA==","AAAAAAAAAFtSZXR1cm5zIHRoZSBzeW1ib2wgZm9yIHRoaXMgdG9rZW4uCgojIFBhbmljcwoKSWYgdGhlIGNvbnRyYWN0IGhhcyBub3QgeWV0IGJlZW4gaW5pdGlhbGl6ZWQuAAAAAAZzeW1ib2wAAAAAAAAAAAABAAAAEA==","AAAAAAAAAWRUcmFuc2ZlciBgYW1vdW50YCBmcm9tIGBmcm9tYCB0byBgdG9gLgoKIyBBcmd1bWVudHMKCiogYGZyb21gIC0gVGhlIGFkZHJlc3MgaG9sZGluZyB0aGUgYmFsYW5jZSBvZiB0b2tlbnMgd2hpY2ggd2lsbCBiZQp3aXRoZHJhd24gZnJvbS4KKiBgdG9gIC0gVGhlIGFkZHJlc3Mgd2hpY2ggd2lsbCByZWNlaXZlIHRoZSB0cmFuc2ZlcnJlZCB0b2tlbnMuCiogYGFtb3VudGAgLSBUaGUgYW1vdW50IG9mIHRva2VucyB0byBiZSB0cmFuc2ZlcnJlZC4KCiMgRXZlbnRzCgpFbWl0cyBhbiBldmVudCB3aXRoIHRvcGljcyBgWyJ0cmFuc2ZlciIsIGZyb206IEFkZHJlc3MsIHRvOiBBZGRyZXNzXSwKZGF0YSA9IFthbW91bnQ6IGkxMjhdYAAAAAh0cmFuc2ZlcgAAAAMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==","AAAAAAAAAzNUcmFuc2ZlciBgYW1vdW50YCBmcm9tIGBmcm9tYCB0byBgdG9gLCBjb25zdW1pbmcgdGhlIGFsbG93YW5jZSB0aGF0CmBzcGVuZGVyYCBoYXMgb24gYGZyb21gJ3MgYmFsYW5jZS4gQXV0aG9yaXplZCBieSBzcGVuZGVyCihgc3BlbmRlci5yZXF1aXJlX2F1dGgoKWApLgoKVGhlIHNwZW5kZXIgd2lsbCBiZSBhbGxvd2VkIHRvIHRyYW5zZmVyIHRoZSBhbW91bnQgZnJvbSBmcm9tJ3MgYmFsYW5jZQppZiB0aGUgYW1vdW50IGlzIGxlc3MgdGhhbiBvciBlcXVhbCB0byB0aGUgYWxsb3dhbmNlIHRoYXQgdGhlIHNwZW5kZXIKaGFzIG9uIHRoZSBmcm9tJ3MgYmFsYW5jZS4gVGhlIHNwZW5kZXIncyBhbGxvd2FuY2Ugb24gZnJvbSdzIGJhbGFuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQuCgojIEFyZ3VtZW50cwoKKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBhdXRob3JpemluZyB0aGUgdHJhbnNmZXIsIGFuZCBoYXZpbmcgaXRzCmFsbG93YW5jZSBjb25zdW1lZCBkdXJpbmcgdGhlIHRyYW5zZmVyLgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHdoaWNoIHdpbGwgYmUKd2l0aGRyYXduIGZyb20uCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA=="]),o);this.options=o}fromJSON={allowance:this.txFromJSON,authorized:this.txFromJSON,approve:this.txFromJSON,balance:this.txFromJSON,burn:this.txFromJSON,burn_from:this.txFromJSON,clawback:this.txFromJSON,decimals:this.txFromJSON,mint:this.txFromJSON,name:this.txFromJSON,set_admin:this.txFromJSON,admin:this.txFromJSON,set_authorized:this.txFromJSON,symbol:this.txFromJSON,transfer:this.txFromJSON,transfer_from:this.txFromJSON}};var lP=100,dP=180,fc=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.params=o}async buildChangeTrustLineXdrTx(r){let s=await new je.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")).loadAccount(r.sender),a=await this.getContract(Pi,r.tokenAddress).name();if(ds(a))throw new U;let c=ls(a);if(!c)throw new U;let[u,l]=c.split(":");if(u===void 0||l===void 0)throw new U("Invalid token name format. Expected format 'symbol:srbTokenAddress'");let p=new je.Asset(u,l),A=je.Operation.changeTrust({asset:p,limit:r.limit});return new je.TransactionBuilder(s,{fee:lP.toString(10),networkPassphrase:this.params.sorobanNetworkPassphrase}).addOperation(A).setTimeout(dP).build().toXDR()}async getBalanceLine(r,o){let i=await this.getContract(Pi,o).name();if(ds(i))throw new U;let a=ls(i);if(!a)throw new U;let[c,u]=a.split(":"),l=this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR");return(await new je.Horizon.Server(l).loadAccount(r)).balances.find(P=>(P.asset_type==="credit_alphanum4"||P.asset_type==="credit_alphanum12")&&P.asset_code==c&&P.asset_issuer==u)}async submitTransactionStellar(r){let o=new je.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")),s=je.TransactionBuilder.fromXDR(r,this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR"));return await o.submitTransaction(s)}async simulateAndCheckRestoreTxRequiredSoroban(r,o){let s=new je.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),i=await s.getAccount(o),a=je.TransactionBuilder.fromXDR(r,this.params.sorobanNetworkPassphrase),c=await s.simulateTransaction(a);if(je.rpc.Api.isSimulationRestore(c))return new je.TransactionBuilder(i,{fee:(+je.BASE_FEE+ +c.restorePreamble.minResourceFee).toString(),networkPassphrase:this.params.sorobanNetworkPassphrase}).setSorobanData(c.restorePreamble.transactionData.build()).addOperation(je.Operation.restoreFootprint({})).setTimeout(je.TimeoutInfinite).build().toXDR()}async sendTransactionSoroban(r){let o=new je.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),s=je.TransactionBuilder.fromXDR(r,this.params.sorobanNetworkPassphrase);return o.sendTransaction(s)}async confirmTx(r,o=15){let s=new je.rpc.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")),i=await nf(()=>s.getTransaction(r),c=>c.status===je.rpc.Api.GetTransactionStatus.NOT_FOUND,o);if(i.length===0)throw new U("No transaction responses found.");let a=i[i.length-1];if(!a)throw new U("Unexpected error: last response is undefined.");return a}getContract(r,o){let s={contractId:o,networkPassphrase:this.params.sorobanNetworkPassphrase,rpcUrl:this.nodeRpcUrlsConfig.getNodeRpcUrl("SRB")};return new r(s)}};var mc=class{constructor(r,o){this.nodeRpcUrlsConfig=r;this.srb=new fc(r,o),this.sol=new Ac(r,o)}srb;sol};var Dn=(o=>(o.WITH_NATIVE_CURRENCY="native",o.WITH_STABLECOIN="stablecoin",o))(Dn||{}),Xs=(o=>(o.INT="int",o.FLOAT="float",o))(Xs||{});var eg=require("big.js"),tg=require("web3");var pP={abi:[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}]},gc=pP;var Ad=require("big.js"),dr=class{async checkAllowance(r){let o=await this.getAllowance(r);return(0,Ad.Big)(o).gte((0,Ad.Big)(r.amount))}};var AP="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",fP="0xdac17f958d2ee523a2206206994597c13d831ec7",mP=1e5,wi=class extends dr{constructor(o,s){super();this.web3=o;this.api=s}chainType="EVM";getAllowance(o){let s=o.token.tokenAddress,i=o.owner,a=o.spender;return this.getAllowanceByTokenAddress(s,i,a)}getAllowanceByTokenAddress(o,s,i){return this.getERC20Contract(o).methods.allowance(s,i).call()}async getTokenBalance(o){return await this.getERC20Contract(o.token.tokenAddress).methods.balanceOf(o.account).call()}async getNativeTokenBalance(o){return(await this.web3.eth.getBalance(o.account)).toString()}async approve(o){if(this.isUsdt(o.tokenAddress)&&await this.getAllowanceByTokenAddress(o.tokenAddress,o.owner,o.spender)!=="0"){let a=await this.buildRawTransactionApprove({...o,amount:"0"});await this.sendRawTransaction(a,o.chainSymbol)}let s=await this.buildRawTransactionApprove(o);return await this.sendRawTransaction(s,o.chainSymbol)}isUsdt(o){return o.toLowerCase()===fP}buildRawTransactionApprove(o){let{tokenAddress:s,spender:i,owner:a,amount:c}=o,l=this.getERC20Contract(s).methods.approve(i,c==null?AP:Ya(c));return Promise.resolve({from:a,to:s,value:"0",data:l.encodeABI()})}async sendRawTransaction(o,s){let i=o,a={maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};s==="POL"?i.gas=mP:i.gas=await this.web3.eth.estimateGas(o);let{transactionHash:c}=await this.web3.eth.sendTransaction({...i,...a});return{txId:c.toString()}}getERC20Contract(o){return new this.web3.eth.Contract(gc.abi,o)}};var Qm=require("@project-serum/anchor"),Io=require("@solana/web3.js");var hc=class extends dr{constructor(o,s){super();this.solanaRpcUrl=o;this.api=s}chainType="SOLANA";approve(o){throw new st}buildRawTransactionApprove(o){throw new st}buildAnchorProvider(o){let s=new Io.Connection(this.solanaRpcUrl,"confirmed"),i=new Io.PublicKey(o);return new Qm.AnchorProvider(s,{publicKey:i},{preflightCommitment:"confirmed",commitment:"confirmed"})}getAllowance(o){throw new st}async getTokenBalance(o){let{account:s,token:i}=o;try{let a=await vr(new Io.PublicKey(s),new Io.PublicKey(i.tokenAddress));return(await qo(a,this.buildAnchorProvider(s))).amount.toString()}catch(a){if(a instanceof Error)return a.message.startsWith("Account does not exist"),"0";throw a}}async getNativeTokenBalance(o){return(await this.buildAnchorProvider(o.account).connection.getBalance(new Io.PublicKey(o.account))).toString()}};var fd=require("@stellar/stellar-sdk");var yc=class extends dr{constructor(o,s,i){super();this.nodeRpcUrlsConfig=o;this.params=s;this.api=i}chainType="SRB";getAllowance(){throw new st}async getTokenBalance(o){if(!o.token.originTokenAddress)throw new U("OriginTokenAddress missing");let[s,i]=o.token.originTokenAddress.split(":"),a=new fd.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")),c;try{c=await a.loadAccount(o.account)}catch(p){if(p instanceof fd.NotFoundError)return"0";throw p}let l=c.balances.find(p=>(p.asset_type==="credit_alphanum4"||p.asset_type==="credit_alphanum12")&&p.asset_code==s&&p.asset_issuer==i);return l?.balance?xe(l.balance,Re.getChainDecimalsByType(Re.getChainProperty(o.token.chainSymbol).chainType)).toFixed():"0"}async getNativeTokenBalance(o){let c=(await new fd.Horizon.Server(this.nodeRpcUrlsConfig.getNodeRpcUrl("STLR")).loadAccount(o.account)).balances.find(u=>u.asset_type==="native");return c?.balance?xe(c.balance,Re.getChainDecimalsByType(Re.getChainProperty(o.chainSymbol).chainType)).toFixed():"0"}approve(){throw new st}buildRawTransactionApprove(){throw new st}};var bc=class extends dr{constructor(o,s){super();this.suiRpcUrl=o;this.api=s;this.suiClient=new Pn({url:this.suiRpcUrl})}chainType="SUI";suiClient;approve(o){throw new st}buildRawTransactionApprove(o){throw new st}getAllowance(o){throw new st}async getTokenBalance(o){if(!o.token.originTokenAddress)throw new U("SUI token must contain 'originTokenAddress'");return(await this.suiClient.getBalance({owner:o.account,coinType:o.token.originTokenAddress})).totalBalance}async getNativeTokenBalance(o){let s=await rn(i=>this.suiClient.getCoins({owner:o.account,cursor:i}));return s.length===0?"0":s.reduce((i,a)=>i+BigInt(a.balance),BigInt(0)).toString()}};var gP="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",Ci=class extends dr{constructor(o,s){super();this.tronWeb=o;this.api=s}chainType="TRX";async getAllowance(o){let{token:{tokenAddress:s},owner:i}=o;return(await(await this.getContract(s)).methods.allowance(i,o.spender).call()).toString()}async getTokenBalance(o){return(await(await this.getContract(o.token.tokenAddress)).balanceOf(o.account).call()).toString()}async getNativeTokenBalance(o){return(await this.tronWeb.trx.getBalance(o.account)).toString()}async approve(o){let s=await this.buildRawTransactionApprove(o);return await qa(this.tronWeb,s)}async buildRawTransactionApprove(o){let{tokenAddress:s,spender:i,owner:a,amount:c}=o,u=c==null?gP:Ya(c),l=[{type:"address",value:i},{type:"uint256",value:u}];return this.buildRawTransaction(s,"approve(address,uint256)",l,"0",a)}getContract(o){return this.tronWeb.contract(gc.abi,o)}async buildRawTransaction(o,s,i,a,c){let u=await this.tronWeb.transactionBuilder.triggerSmartContract(o,s,{callValue:+a},i,c);if(!u?.result?.result)throw new U("Unknown error: "+JSON.stringify(u,null,2));return u.transaction}};var Tc=class{constructor(r,o,s){this.api=r;this.nodeRpcUrlsConfig=o;this.params=s}async getAllowance(r,o){let s=await(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).getAllowance(r);return Ce(s,r.token.decimals).toFixed()}async checkAllowance(r,o){return ze(r.amount),$e("amount",r.amount,r.token.decimals),(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).checkAllowance(this.prepareCheckAllowanceParams(r))}async approve(r,o){return o.amount&&(ze(o.amount),$e("amount",o.amount,o.token.decimals)),(await this.getChainTokenService(o.token.chainSymbol,o.owner,r)).approve(this.prepareApproveParams(o))}async buildRawTransactionApprove(r,o){return r.amount&&(ze(r.amount),$e("amount",r.amount,r.token.decimals)),(await this.getChainTokenService(r.token.chainSymbol,r.owner,o)).buildRawTransactionApprove(this.prepareApproveParams(r))}async getTokenBalance(r,o){let s=await(await this.getChainTokenService(r.token.chainSymbol,r.account,o)).getTokenBalance(r);return r.token.decimals?Ce(s,r.token.decimals).toFixed():s}async getNativeTokenBalance(r,o){let s=await(await this.getChainTokenService(r.chainSymbol,r.account,o)).getNativeTokenBalance(r);return{int:s,float:Ce(s,Re.getChainDecimalsByType(Re.getChainProperty(r.chainSymbol).chainType)).toFixed()}}async getChainTokenService(r,o,s){switch(Re.getChainProperty(r).chainType){case"EVM":{if(s)return new wi(s,this.api);{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r);return new wi(new tg.Web3(i),this.api)}}case"TRX":if(s){let{TronWeb:i}=await Sr();return new Ci(s,this.api)}else{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r),{TronWeb:a}=await Sr(),c=new a({fullHost:i});return c.setAddress(o),new Ci(c,this.api)}case"SOLANA":{let i=this.nodeRpcUrlsConfig.getNodeRpcUrl(r);return new hc(i,this.api)}case"SRB":return new yc(this.nodeRpcUrlsConfig,this.params,this.api);case"SUI":return new bc(this.nodeRpcUrlsConfig.getNodeRpcUrl(r),this.api)}}prepareCheckAllowanceParams(r){return{...r,amount:xe(r.amount,r.token.decimals)}}prepareApproveParams(r){return{tokenAddress:r.token.tokenAddress,owner:r.owner,spender:r.spender,chainSymbol:r.token.chainSymbol,amount:r.amount==null?void 0:(0,eg.Big)(r.amount).toFixed()}}};var Bi=class{constructor(r){this.nodeRpcUrls=r}getNodeRpcUrl(r){let o=this.nodeRpcUrls[r];if(o!==void 0)return o;throw new ys(r)}},Pc=class{api;tokenService;params;bridge;pool;constructor(r,o=ms){Re.addChainsProperties(o.additionalChainsProperties);let s=new Mi(o),i=new Ri(s),a=new Fi(i),c=new Oi(a);this.api=new ki(c,o),this.tokenService=new Tc(this.api,r,o),this.bridge=new Qa(this.api,r,o,this.tokenService),this.pool=new pc(this.api,r,o,this.tokenService),this.params=o}async chainDetailsMap(r){return this.api.getChainDetailsMap(r)}async tokens(r){return this.api.tokens(r)}async tokensByChain(r,o){let i=(await this.api.getChainDetailsMap(o))[r];return i?i.tokens:[]}async getTransferStatus(r,o){return this.api.getTransferStatus(r,o)}async getGasBalance(r,o){return this.api.getGasBalance(r,o)}async checkAddress(){return new Promise(r=>{r({status:"OK",gasBalance:null})})}async getPendingStatusInfo(r,o,s,i){ze(r);let a;o=="float"?($e("amount",r,s.decimals),a=xe(r,s.decimals).toFixed()):a=r;let c=$r(a,s,await dt(this.api,s)),u=await dt(this.api,i),l=this.getAmountFromVUsdFormatted(c,i,u),p,A=await this.api.getPendingInfo();for(let g in A[i.chainSymbol]){let P=A[i.chainSymbol];if(!P)throw new U("Cannot find pending info for "+i.chainSymbol);p=P[g]}if(p){let g=bd(p.totalSentAmount,u),P=this.getAmountFromVUsdFormatted(c,i,g),b;return(0,jt.Big)(P.int).gt(l.int)?b={min:l,max:P}:b={min:P,max:l},{pendingTxs:p.pendingTxs,pendingAmount:{int:Lr(p.totalSentAmount,3,i.decimals).toFixed(0),float:Ce(p.totalSentAmount,3).toFixed()},estimatedAmount:b}}return{pendingTxs:0,pendingAmount:{int:"0",float:"0"},estimatedAmount:{min:l,max:l}}}async getTokenBalance(r,o){return this.tokenService.getTokenBalance(r,o)}async getNativeTokenBalance(r,o){return this.tokenService.getNativeTokenBalance(r,o)}async calculateFeePercentOnSourceChain(r,o){ze(r),$e("amountFloat",r,o.decimals);let s=xe(r,o.decimals);if(s.eq(0))return 0;let i=$r(s,o,await dt(this.api,o)),a=Yt(i,o.decimals);return Cc(s,a)}async calculateFeePercentOnDestinationChain(r,o,s){ze(r),$e("amountFloat",r,o.decimals);let i=xe(r,o.decimals);if(i.eq(0))return 0;let a=$r(i,o,await dt(this.api,o)),c=Ps(a,s,await dt(this.api,s)),u=Yt(a,s.decimals);return Cc(u,c)}async getAmountToBeReceivedAndGasFeeOptions(r,o,s,i){return ze(r),$e("amountToSendFloat",r,o.decimals),{amountToSendFloat:(0,jt.Big)(r).toFixed(),amountToBeReceivedFloat:await this.getAmountToBeReceived(r,o,s,i),gasFeeOptions:await this.getGasFeeOptions(o,s,i)}}async getAmountToSendAndGasFeeOptions(r,o,s,i){return ze(r),$e("amountToBeReceivedFloat",r,s.decimals),{amountToSendFloat:await this.getAmountToSend(r,o,s,i),amountToBeReceivedFloat:(0,jt.Big)(r).toFixed(),gasFeeOptions:await this.getGasFeeOptions(o,s,i)}}async getAmountToBeReceived(r,o,s,i){let a=await dt(this.api,o),c=await dt(this.api,s);return this.getAmountToBeReceivedFromPools(r,o,s,a,c,i)}async getAmountToBeReceivedFromChain(r,o,s,i,a,c){let u=await this.pool.getPoolInfoFromChain(o,a),l=await this.pool.getPoolInfoFromChain(s,c);return this.getAmountToBeReceivedFromPools(r,o,s,u,l,i)}getAmountToBeReceivedFromPools(r,o,s,i,a,c){ze(r),$e("amountToSendFloat",r,o.decimals);let u=xe(r,o.decimals);if(c&&c==3){if(!o.cctpAddress||!s.cctpAddress||!o.cctpFeeShare)throw new Ct("Such route does not support CCTP protocol");let p=u.mul((0,jt.Big)(1).minus(o.cctpFeeShare)).round(0,jt.Big.roundUp),A=Lr(p,o.decimals,s.decimals).round(0);return Ce(A,s.decimals).toFixed()}if(c&&c==4){if(!o.cctpV2Address||!s.cctpV2Address||!o.cctpV2FeeShare)throw new Ct("Such route does not support CCTP V2 protocol");let p=u.mul((0,jt.Big)(1).minus(o.cctpV2FeeShare)).round(0,jt.Big.roundUp),A=Lr(p,o.decimals,s.decimals).round(0);return Ce(A,s.decimals).toFixed()}let l=$r(u,o,i);return this.getAmountFromVUsdFormatted(l,s,a).float}async getAmountToSend(r,o,s,i){let a=await dt(this.api,o),c=await dt(this.api,s);return this.getAmountToSendFromPools(r,o,s,a,c,i)}async getAmountToSendFromChain(r,o,s,i,a,c){let u=await this.pool.getPoolInfoFromChain(o,a),l=await this.pool.getPoolInfoFromChain(s,c);return this.getAmountToSendFromPools(r,o,s,u,l,i)}getAmountToSendFromPools(r,o,s,i,a,c){ze(r),$e("amountToBeReceivedFloat",r,s.decimals);let u=xe(r,s.decimals);if(c&&c==3){if(!o.cctpAddress||!s.cctpAddress||!o.cctpFeeShare)throw new Ct("Such route does not support CCTP protocol");let A=u.div((0,jt.Big)(1).minus(o.cctpFeeShare)).round(0,jt.Big.roundDown),g=Lr(A,s.decimals,o.decimals).round(0);return Ce(g,o.decimals).toFixed()}if(c&&c==4){if(!o.cctpV2Address||!s.cctpV2Address||!o.cctpV2FeeShare)throw new Ct("Such route does not support CCTP V2 protocol");let A=u.div((0,jt.Big)(1).minus(o.cctpV2FeeShare)).round(0,jt.Big.roundDown),g=Lr(A,s.decimals,o.decimals).round(0);return Ce(g,o.decimals).toFixed()}let l=Pd(u,s,a),p=Td(l,o,i);if((0,jt.Big)(p).lte(0))throw new Gr;return Ce(p,o.decimals).toFixed()}async getGasFeeOptions(r,o,s){return qu(r.allbridgeChainId,r.chainType,o.allbridgeChainId,r.decimals,s,this.api)}getAverageTransferTime(r,o,s){return r.transferTime?.[o.chainSymbol]?.[s]??null}async getPoolInfoByToken(r){return await this.api.getPoolInfoByKey({chainSymbol:r.chainSymbol,poolAddress:r.poolAddress})}async refreshPoolInfo(r){if(r){let s=(r instanceof Array?r:[r]).map(i=>({chainSymbol:i.chainSymbol,poolAddress:i.poolAddress}));return this.api.refreshPoolInfo(s)}return this.api.refreshPoolInfo()}aprInPercents(r){return Cd(r)}async getExtraGasMaxLimits(r,o){return await Qu(r,o,this.api)}async getVUsdFromAmount(r,o,s){ze(r);let i;o=="float"?($e("amount",r,s.decimals),i=xe(r,s.decimals).toFixed()):i=r;let a=$r(i,s,await dt(this.api,s));return{int:a,float:Ce(a,3).toFixed()}}async getAmountFromVUsd(r,o){return this.getAmountFromVUsdFormatted(r,o,await dt(this.api,o))}getAmountFromVUsdFormatted(r,o,s){ze(r);let i=Ps(r,o,s);if((0,jt.Big)(i).lt(0))throw new Gr;return{int:i,float:Ce(i,o.decimals).toFixed()}}async swapAndBridgeFeeCalculation(r,o,s){return Xm(r,{decimals:o.decimals,feeShare:o.feeShare,poolInfo:await dt(this.api,o)},{decimals:s.decimals,feeShare:s.feeShare,poolInfo:await dt(this.api,s)})}async swapAndBridgeFeeCalculationReverse(r,o,s){let i=Ym(r,{decimals:o.decimals,feeShare:o.feeShare,poolInfo:await dt(this.api,o)},{decimals:s.decimals,feeShare:s.feeShare,poolInfo:await dt(this.api,s)}),a=i.swapFromVUsdCalcResult.amountIncludingCommissionInTokenPrecision;if((0,jt.Big)(a).lt(0))throw new Gr;return i}async getSendAmountDetails(r,o,s,i){ze(r);let a;return o=="float"?($e("amount",r,s.decimals),a=xe(r,s.decimals).toFixed()):a=r,qm(a,s,await dt(this.api,s),i,await dt(this.api,i))}};function hP(n){return"solanaRpcUrl"in n}var md=class{params;bridge;pool;utils;service;constructor(r,o=ms){let s;hP(r)?s=new Bi({SOL:r.solanaRpcUrl,TRX:r.tronRpcUrl}):s=new Bi(r),this.service=new Pc(s,o),this.bridge=this.service.bridge,this.pool=this.service.pool,this.utils=new mc(s,o),this.params=o}async chainDetailsMap(r="swap"){return this.service.chainDetailsMap(r)}async tokens(r="swap"){return this.service.tokens(r)}async tokensByChain(r,o="swap"){return this.service.tokensByChain(r,o)}async getTransferStatus(r,o){return this.service.getTransferStatus(r,o)}async getGasBalance(r,o){return this.service.getGasBalance(r,o)}async checkAddress(r,o,s){return await this.service.checkAddress()}async getPendingStatusInfo(r,o,s,i){return this.service.getPendingStatusInfo(r,o,s,i)}async getTokenBalance(r,o){return this.service.getTokenBalance(r,o)}async getNativeTokenBalance(r,o){return this.service.getNativeTokenBalance(r,o)}async calculateFeePercentOnSourceChain(r,o){return this.service.calculateFeePercentOnSourceChain(r,o)}async calculateFeePercentOnDestinationChain(r,o,s){return this.service.calculateFeePercentOnDestinationChain(r,o,s)}async getAmountToBeReceivedAndGasFeeOptions(r,o,s,i){return this.service.getAmountToBeReceivedAndGasFeeOptions(r,o,s,i)}async getAmountToSendAndGasFeeOptions(r,o,s,i){return this.service.getAmountToSendAndGasFeeOptions(r,o,s,i)}async getAmountToBeReceived(r,o,s,i){return this.service.getAmountToBeReceived(r,o,s,i)}async getAmountToBeReceivedFromChain(r,o,s,i,a,c){return this.service.getAmountToBeReceivedFromChain(r,o,s,i,a,c)}getAmountToBeReceivedFromPools(r,o,s,i,a,c){return this.service.getAmountToBeReceivedFromPools(r,o,s,i,a,c)}async getAmountToSend(r,o,s,i){return this.service.getAmountToSend(r,o,s,i)}async getAmountToSendFromChain(r,o,s,i,a,c){return this.service.getAmountToSendFromChain(r,o,s,i,a,c)}getAmountToSendFromPools(r,o,s,i,a,c){return this.service.getAmountToSendFromPools(r,o,s,i,a,c)}async getGasFeeOptions(r,o,s){return this.service.getGasFeeOptions(r,o,s)}getAverageTransferTime(r,o,s){return this.service.getAverageTransferTime(r,o,s)}async getPoolInfoByToken(r){return this.service.getPoolInfoByToken(r)}async refreshPoolInfo(r){return this.service.refreshPoolInfo(r)}aprInPercents(r){return this.service.aprInPercents(r)}async getExtraGasMaxLimits(r,o){return this.service.getExtraGasMaxLimits(r,o)}async getVUsdFromAmount(r,o,s){return this.service.getVUsdFromAmount(r,o,s)}async getAmountFromVUsd(r,o){return this.service.getAmountFromVUsd(r,o)}async swapAndBridgeFeeCalculation(r,o,s){return this.service.swapAndBridgeFeeCalculation(r,o,s)}async swapAndBridgeFeeCalculationReverse(r,o,s){return this.service.swapAndBridgeFeeCalculationReverse(r,o,s)}async getSendAmountDetails(r,o,s,i){return this.service.getSendAmountDetails(r,o,s,i)}};0&&(module.exports={AddressStatus,AllbridgeCoreSdk,AmountFormat,AmountNotEnoughError,ArgumentInvalidDecimalsError,CCTPDoesNotSupportedError,ChainSymbol,ChainType,ErrorCode,ExtraGasMaxLimitExceededError,FeePaymentMethod,InsufficientPoolLiquidityError,InvalidAmountError,InvalidGasFeePaymentOptionError,InvalidMessengerOptionError,InvalidTxError,JupiterError,Messenger,MethodNotSupportedError,NodeRpcUrlNotInitializedError,SdkError,SdkRootError,SolanaAutoTxFee,TimeoutError,TxTooLargeError,VerifyTxError,mainnet,nodeRpcUrlsDefault,nodeUrlsDefault});
|
|
6
6
|
//# sourceMappingURL=index.js.map
|