"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { XClient: () => XClient, XContract: () => XContract, XWallet: () => XWallet, utils: () => utils_exports }); module.exports = __toCommonJS(src_exports); // src/XWallet.ts var import_niljs3 = require("@nilfoundation/niljs"); var import_viem2 = require("viem"); // src/abi/XWallet.json var XWallet_default = { _format: "hh-sol-artifact-1", contractName: "XWallet", sourceName: "contracts/XWallet.sol", abi: [ { inputs: [ { internalType: "bytes", name: "_pubkey", type: "bytes" } ], stateMutability: "payable", type: "constructor" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "spender", type: "address" }, { indexed: true, internalType: "CurrencyId", name: "tokenId", type: "address" }, { indexed: false, internalType: "uint256", name: "amount", type: "uint256" } ], name: "Approval", type: "event" }, { inputs: [ { internalType: "address", name: "_spender", type: "address" }, { internalType: "CurrencyId", name: "_token", type: "address" } ], name: "allowance", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "_spender", type: "address" }, { components: [ { internalType: "CurrencyId", name: "id", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" } ], internalType: "struct Nil.Token[]", name: "_tokens", type: "tuple[]" } ], name: "approve", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { components: [ { internalType: "CurrencyId", name: "id", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" } ], internalType: "struct Nil.Token[]", name: "_tokens", type: "tuple[]" }, { internalType: "address", name: "_recepient", type: "address" } ], name: "approvedTransfer", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "dst", type: "address" }, { internalType: "address", name: "refundTo", type: "address" }, { internalType: "address", name: "bounceTo", type: "address" }, { internalType: "uint256", name: "feeCredit", type: "uint256" }, { internalType: "bool", name: "deploy", type: "bool" }, { components: [ { internalType: "CurrencyId", name: "id", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" } ], internalType: "struct Nil.Token[]", name: "tokens", type: "tuple[]" }, { internalType: "uint256", name: "value", type: "uint256" }, { internalType: "bytes", name: "callData", type: "bytes" } ], name: "asyncCall", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "string", name: "err", type: "string" } ], name: "bounce", outputs: [], stateMutability: "payable", type: "function" }, { inputs: [ { internalType: "uint256", name: "amount", type: "uint256" } ], name: "burnCurrency", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "account", type: "address" } ], name: "getCurrencyBalanceOf", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "getCurrencyId", outputs: [ { internalType: "CurrencyId", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "getCurrencyName", outputs: [ { internalType: "string", name: "", type: "string" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "getCurrencyTotalSupply", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "getOwnCurrencyBalance", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "uint256", name: "amount", type: "uint256" } ], name: "mintCurrency", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "bytes", name: "message", type: "bytes" } ], name: "send", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "to", type: "address" }, { internalType: "CurrencyId", name: "currencyId", type: "address" }, { internalType: "uint256", name: "amount", type: "uint256" } ], name: "sendCurrency", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "string", name: "name", type: "string" } ], name: "setCurrencyName", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "dst", type: "address" }, { internalType: "uint256", name: "feeCredit", type: "uint256" }, { internalType: "uint256", name: "value", type: "uint256" }, { internalType: "bytes", name: "call_data", type: "bytes" } ], name: "syncCall", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "uint256", name: "hash", type: "uint256" }, { internalType: "bytes", name: "signature", type: "bytes" } ], name: "verifyExternal", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { stateMutability: "payable", type: "receive" } ], bytecode: "0x608060405260405162002f4a38038062002f4a8339818101604052810190620000299190620001d7565b8080600290816200003b919062000473565b5050506200055a565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620000ad8262000062565b810181811067ffffffffffffffff82111715620000cf57620000ce62000073565b5b80604052505050565b6000620000e462000044565b9050620000f28282620000a2565b919050565b600067ffffffffffffffff82111562000115576200011462000073565b5b620001208262000062565b9050602081019050919050565b60005b838110156200014d57808201518184015260208101905062000130565b60008484015250505050565b6000620001706200016a84620000f7565b620000d8565b9050828152602081018484840111156200018f576200018e6200005d565b5b6200019c8482856200012d565b509392505050565b600082601f830112620001bc57620001bb62000058565b5b8151620001ce84826020860162000159565b91505092915050565b600060208284031215620001f057620001ef6200004e565b5b600082015167ffffffffffffffff81111562000211576200021062000053565b5b6200021f84828501620001a4565b91505092915050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200027b57607f821691505b60208210810362000291576200029062000233565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620002fb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002bc565b620003078683620002bc565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003546200034e62000348846200031f565b62000329565b6200031f565b9050919050565b6000819050919050565b620003708362000333565b620003886200037f826200035b565b848454620002c9565b825550505050565b600090565b6200039f62000390565b620003ac81848462000365565b505050565b5b81811015620003d457620003c860008262000395565b600181019050620003b2565b5050565b601f8211156200042357620003ed8162000297565b620003f884620002ac565b8101602085101562000408578190505b620004206200041785620002ac565b830182620003b1565b50505b505050565b600082821c905092915050565b6000620004486000198460080262000428565b1980831691505092915050565b600062000463838362000435565b9150826002028217905092915050565b6200047e8262000228565b67ffffffffffffffff8111156200049a576200049962000073565b5b620004a6825462000262565b620004b3828285620003d8565b600060209050601f831160018114620004eb5760008415620004d6578287015190505b620004e2858262000455565b86555062000552565b601f198416620004fb8662000297565b60005b828110156200052557848901518255600182019150602085019450602081019050620004fe565b8683101562000545578489015162000541601f89168262000435565b8355505b6001600288020188555050505b505050505050565b6129e0806200056a6000396000f3fe6080604052600436106101025760003560e01c8063add29c6d11610095578063dd62ed3e11610064578063dd62ed3e1461032a578063e2f5df8c14610367578063eae02e6814610383578063eed20631146103ac578063fd2410de146103d557610109565b8063add29c6d14610280578063ae98ed1a146102ab578063cf387fed146102d4578063d064d784146102ff57610109565b80635e38b66c116100d15780635e38b66c146101b2578063796d7f56146101ef578063978563081461022c5780639cb99c8b1461025757610109565b80630677d9c71461010e5780631072b91f146101375780632bb1ae7c146101605780634f7d1d581461018957610109565b3661010957005b600080fd5b34801561011a57600080fd5b50610135600480360381019061013091906116e4565b6103fe565b005b34801561014357600080fd5b5061015e600480360381019061015991906117d6565b6104a7565b005b34801561016c57600080fd5b5061018760048036038101906101829190611803565b6104fb565b005b34801561019557600080fd5b506101b060048036038101906101ab9190611905565b610594565b005b3480156101be57600080fd5b506101d960048036038101906101d49190611988565b610694565b6040516101e691906119c4565b60405180910390f35b3480156101fb57600080fd5b50610216600480360381019061021191906119df565b6106ae565b6040516102239190611a4e565b60405180910390f35b34801561023857600080fd5b50610241610792565b60405161024e91906119c4565b60405180910390f35b34801561026357600080fd5b5061027e60048036038101906102799190611a69565b6107aa565b005b34801561028c57600080fd5b50610295610802565b6040516102a291906119c4565b60405180910390f35b3480156102b757600080fd5b506102d260048036038101906102cd9190611abc565b61080b565b005b3480156102e057600080fd5b506102e9610a1a565b6040516102f69190611b77565b60405180910390f35b34801561030b57600080fd5b50610314610a22565b6040516103219190611c11565b60405180910390f35b34801561033657600080fd5b50610351600480360381019061034c9190611c33565b610ab4565b60405161035e91906119c4565b60405180910390f35b610381600480360381019061037c9190611cc9565b610b3b565b005b34801561038f57600080fd5b506103aa60048036038101906103a591906117d6565b610b3f565b005b3480156103b857600080fd5b506103d360048036038101906103ce9190611db7565b610b93565b005b3480156103e157600080fd5b506103fc60048036038101906103f79190611e00565b610bee565b005b610406610d70565b15610446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043d90611ece565b60405180910390fd5b61049c8989898960038a898b8a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e82565b505050505050505050565b6104af610d70565b156104ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e690611ece565b60405180910390fd5b6104f881610f1a565b50565b610503610d70565b15610543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053a90611ece565b60405180910390fd5b61059082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610ffa565b5050565b61059c610d70565b156105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d390611ece565b60405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff16838590846040516106069190611f35565b600060405180830381858888f193505050503d8060008114610644576040519150601f19603f3d011682016040523d82523d6000602084013e610649565b606091505b505090508061068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068490611f98565b60405180910390fd5b5050505050565b60006106a7826106a2610a1a565b61101b565b9050919050565b6000610789600280546106c090611fe7565b80601f01602080910402602001604051908101604052809291908181526020018280546106ec90611fe7565b80156107395780601f1061070e57610100808354040283529160200191610739565b820191906000526020600020905b81548152906001019060200180831161071c57829003601f168201915b50505050508585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a2565b90509392505050565b60006107a5306107a0610a1a565b61101b565b905090565b6107b2610d70565b156107f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e990611ece565b60405180910390fd5b6107fd8383836111ae565b505050565b60008054905090565b610813610d70565b610852576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108499061208a565b60405180910390fd5b60008251905060005b818110156109f2576000848281518110610878576108776120aa565b5b602002602001015190508060200151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610949576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094090612125565b60405180910390fd5b8060200151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109dd9190612174565b9250508190555050808060010191505061085b565b50610a158230305a60036000808a60405180602001604052806000815250610e82565b505050565b600030905090565b606060018054610a3190611fe7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5d90611fe7565b8015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b5050505050905090565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b5050565b610b47610d70565b15610b87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7e90611ece565b60405180910390fd5b610b908161127a565b50565b610b9b610d70565b15610bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd290611ece565b60405180910390fd5b8060019081610bea919061234a565b5050565b610bf6610d70565b15610c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2d90611ece565b60405180910390fd5b60008151905060005b81811015610d6a576000838281518110610c5c57610c5b6120aa565b5b602002602001015190508060200151600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806000015173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360200151604051610d5491906119c4565b60405180910390a3508080600101915050610c3f565b50505050565b6000606060008060ff73ffffffffffffffffffffffffffffffffffffffff1683604051610d9d9190611f35565b600060405180830381855afa9150503d8060008114610dd8576040519150601f19603f3d011682016040523d82523d6000602084013e610ddd565b606091505b509150915081610e22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1990612468565b60405180910390fd5b6000815111610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906124fa565b60405180910390fd5b80806020019051810190610e7a919061252f565b935050505090565b60fd73ffffffffffffffffffffffffffffffffffffffff1663f69756538486888d8d8d8d8a8a6040518a63ffffffff1660e01b8152600401610ecb9897969594939291906126cd565b60206040518083038185885af1158015610ee9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f0e919061252f565b50505050505050505050565b600060d073ffffffffffffffffffffffffffffffffffffffff1663505c91718360016040518363ffffffff1660e01b8152600401610f59929190612759565b6020604051808303816000875af1158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c919061252f565b905080610fde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd5906127ce565b60405180910390fd5b81600080828254610fef91906127ee565b925050819055505050565b6000815190506000808260208501600060fc5af161101757600080fd5b5050565b600060d173ffffffffffffffffffffffffffffffffffffffff1663e83d49ee83856040518363ffffffff1660e01b8152600401611059929190612822565b602060405180830381865afa158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612860565b905092915050565b6000808484846040516020016110ba9392919061288d565b6040516020818303038152906040529050600080606060fe73ffffffffffffffffffffffffffffffffffffffff16846040516110f69190611f35565b600060405180830381855afa9150503d8060008114611131576040519150601f19603f3d011682016040523d82523d6000602084013e611136565b606091505b5080925081945050508261117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612468565b60405180910390fd5b6000815111156111a0578080602001905181019061119d919061252f565b91505b819450505050509392505050565b6000600167ffffffffffffffff8111156111cb576111ca6114c5565b5b60405190808252806020026020018201604052801561120457816020015b6111f161139f565b8152602001906001900390816111e95790505b50905060405180604001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018381525081600081518110611246576112456120aa565b5b6020026020010181905250611274846000806000806000808860405180602001604052806000815250610e82565b50505050565b8060005410156112bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b69061291e565b60405180910390fd5b600060d073ffffffffffffffffffffffffffffffffffffffff1663505c91718360006040518363ffffffff1660e01b81526004016112fe929190612759565b6020604051808303816000875af115801561131d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611341919061252f565b905080611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137a9061298a565b60405180910390fd5b816000808282546113949190612174565b925050819055505050565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061140e826113e3565b9050919050565b61141e81611403565b811461142957600080fd5b50565b60008135905061143b81611415565b92915050565b6000819050919050565b61145481611441565b811461145f57600080fd5b50565b6000813590506114718161144b565b92915050565b60008115159050919050565b61148c81611477565b811461149757600080fd5b50565b6000813590506114a981611483565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6114fd826114b4565b810181811067ffffffffffffffff8211171561151c5761151b6114c5565b5b80604052505050565b600061152f6113cf565b905061153b82826114f4565b919050565b600067ffffffffffffffff82111561155b5761155a6114c5565b5b602082029050602081019050919050565b600080fd5b600080fd5b61157f81611403565b811461158a57600080fd5b50565b60008135905061159c81611576565b92915050565b6000604082840312156115b8576115b7611571565b5b6115c26040611525565b905060006115d28482850161158d565b60008301525060206115e684828501611462565b60208301525092915050565b600061160561160084611540565b611525565b905080838252602082019050604084028301858111156116285761162761156c565b5b835b81811015611651578061163d88826115a2565b84526020840193505060408101905061162a565b5050509392505050565b600082601f8301126116705761166f6114af565b5b81356116808482602086016115f2565b91505092915050565b600080fd5b60008083601f8401126116a4576116a36114af565b5b8235905067ffffffffffffffff8111156116c1576116c0611689565b5b6020830191508360018202830111156116dd576116dc61156c565b5b9250929050565b60008060008060008060008060006101008a8c031215611707576117066113d9565b5b60006117158c828d0161142c565b99505060206117268c828d0161142c565b98505060406117378c828d0161142c565b97505060606117488c828d01611462565b96505060806117598c828d0161149a565b95505060a08a013567ffffffffffffffff81111561177a576117796113de565b5b6117868c828d0161165b565b94505060c06117978c828d01611462565b93505060e08a013567ffffffffffffffff8111156117b8576117b76113de565b5b6117c48c828d0161168e565b92509250509295985092959850929598565b6000602082840312156117ec576117eb6113d9565b5b60006117fa84828501611462565b91505092915050565b6000806020838503121561181a576118196113d9565b5b600083013567ffffffffffffffff811115611838576118376113de565b5b6118448582860161168e565b92509250509250929050565b600080fd5b600067ffffffffffffffff8211156118705761186f6114c5565b5b611879826114b4565b9050602081019050919050565b82818337600083830152505050565b60006118a86118a384611855565b611525565b9050828152602081018484840111156118c4576118c3611850565b5b6118cf848285611886565b509392505050565b600082601f8301126118ec576118eb6114af565b5b81356118fc848260208601611895565b91505092915050565b6000806000806080858703121561191f5761191e6113d9565b5b600061192d8782880161142c565b945050602061193e87828801611462565b935050604061194f87828801611462565b925050606085013567ffffffffffffffff8111156119705761196f6113de565b5b61197c878288016118d7565b91505092959194509250565b60006020828403121561199e5761199d6113d9565b5b60006119ac8482850161142c565b91505092915050565b6119be81611441565b82525050565b60006020820190506119d960008301846119b5565b92915050565b6000806000604084860312156119f8576119f76113d9565b5b6000611a0686828701611462565b935050602084013567ffffffffffffffff811115611a2757611a266113de565b5b611a338682870161168e565b92509250509250925092565b611a4881611477565b82525050565b6000602082019050611a636000830184611a3f565b92915050565b600080600060608486031215611a8257611a816113d9565b5b6000611a908682870161142c565b9350506020611aa18682870161158d565b9250506040611ab286828701611462565b9150509250925092565b60008060408385031215611ad357611ad26113d9565b5b600083013567ffffffffffffffff811115611af157611af06113de565b5b611afd8582860161165b565b9250506020611b0e8582860161142c565b9150509250929050565b6000819050919050565b6000611b3d611b38611b33846113e3565b611b18565b6113e3565b9050919050565b6000611b4f82611b22565b9050919050565b6000611b6182611b44565b9050919050565b611b7181611b56565b82525050565b6000602082019050611b8c6000830184611b68565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611bcc578082015181840152602081019050611bb1565b60008484015250505050565b6000611be382611b92565b611bed8185611b9d565b9350611bfd818560208601611bae565b611c06816114b4565b840191505092915050565b60006020820190508181036000830152611c2b8184611bd8565b905092915050565b60008060408385031215611c4a57611c496113d9565b5b6000611c588582860161142c565b9250506020611c698582860161158d565b9150509250929050565b60008083601f840112611c8957611c886114af565b5b8235905067ffffffffffffffff811115611ca657611ca5611689565b5b602083019150836001820283011115611cc257611cc161156c565b5b9250929050565b60008060208385031215611ce057611cdf6113d9565b5b600083013567ffffffffffffffff811115611cfe57611cfd6113de565b5b611d0a85828601611c73565b92509250509250929050565b600067ffffffffffffffff821115611d3157611d306114c5565b5b611d3a826114b4565b9050602081019050919050565b6000611d5a611d5584611d16565b611525565b905082815260208101848484011115611d7657611d75611850565b5b611d81848285611886565b509392505050565b600082601f830112611d9e57611d9d6114af565b5b8135611dae848260208601611d47565b91505092915050565b600060208284031215611dcd57611dcc6113d9565b5b600082013567ffffffffffffffff811115611deb57611dea6113de565b5b611df784828501611d89565b91505092915050565b60008060408385031215611e1757611e166113d9565b5b6000611e258582860161142c565b925050602083013567ffffffffffffffff811115611e4657611e456113de565b5b611e528582860161165b565b9150509250929050565b7f547279696e6720746f2063616c6c2065787465726e616c2066756e6374696f6e60008201527f207769746820696e7465726e616c206d65737361676500000000000000000000602082015250565b6000611eb8603683611b9d565b9150611ec382611e5c565b604082019050919050565b60006020820190508181036000830152611ee781611eab565b9050919050565b600081519050919050565b600081905092915050565b6000611f0f82611eee565b611f198185611ef9565b9350611f29818560208601611bae565b80840191505092915050565b6000611f418284611f04565b915081905092915050565b7f43616c6c206661696c6564000000000000000000000000000000000000000000600082015250565b6000611f82600b83611b9d565b9150611f8d82611f4c565b602082019050919050565b60006020820190508181036000830152611fb181611f75565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611fff57607f821691505b60208210810361201257612011611fb8565b5b50919050565b7f547279696e6720746f2063616c6c20696e7465726e616c2066756e6374696f6e60008201527f20776974682065787465726e616c206d65737361676500000000000000000000602082015250565b6000612074603683611b9d565b915061207f82612018565b604082019050919050565b600060208201905081810360008301526120a381612067565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f5472616e73666572206d6f7265207468616e20616c6c6f776564000000000000600082015250565b600061210f601a83611b9d565b915061211a826120d9565b602082019050919050565b6000602082019050818103600083015261213e81612102565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061217f82611441565b915061218a83611441565b92508282039050818111156121a2576121a1612145565b5b92915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261220a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826121cd565b61221486836121cd565b95508019841693508086168417925050509392505050565b600061224761224261223d84611441565b611b18565b611441565b9050919050565b6000819050919050565b6122618361222c565b61227561226d8261224e565b8484546121da565b825550505050565b600090565b61228a61227d565b612295818484612258565b505050565b5b818110156122b9576122ae600082612282565b60018101905061229b565b5050565b601f8211156122fe576122cf816121a8565b6122d8846121bd565b810160208510156122e7578190505b6122fb6122f3856121bd565b83018261229a565b50505b505050565b600082821c905092915050565b600061232160001984600802612303565b1980831691505092915050565b600061233a8383612310565b9150826002028217905092915050565b61235382611b92565b67ffffffffffffffff81111561236c5761236b6114c5565b5b6123768254611fe7565b6123818282856122bd565b600060209050601f8311600181146123b457600084156123a2578287015190505b6123ac858261232e565b865550612414565b601f1984166123c2866121a8565b60005b828110156123ea578489015182556001820191506020850194506020810190506123c5565b868310156124075784890151612403601f891682612310565b8355505b6001600288020188555050505b505050505050565b7f507265636f6d70696c656420636f6e74726163742063616c6c206661696c6564600082015250565b6000612452602083611b9d565b915061245d8261241c565b602082019050919050565b6000602082019050818103600083015261248181612445565b9050919050565b7f2749535f494e5445524e414c5f4d455353414745272072657475726e7320696e60008201527f76616c6964206461746100000000000000000000000000000000000000000000602082015250565b60006124e4602a83611b9d565b91506124ef82612488565b604082019050919050565b60006020820190508181036000830152612513816124d7565b9050919050565b60008151905061252981611483565b92915050565b600060208284031215612545576125446113d9565b5b60006125538482850161251a565b91505092915050565b600060ff82169050919050565b6125728161255c565b82525050565b61258181611403565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6125bc81611b56565b82525050565b6125cb81611441565b82525050565b6040820160008201516125e760008501826125b3565b5060208201516125fa60208501826125c2565b50505050565b600061260c83836125d1565b60408301905092915050565b6000602082019050919050565b600061263082612587565b61263a8185612592565b9350612645836125a3565b8060005b8381101561267657815161265d8882612600565b975061266883612618565b925050600181019050612649565b5085935050505092915050565b600082825260208201905092915050565b600061269f82611eee565b6126a98185612683565b93506126b9818560208601611bae565b6126c2816114b4565b840191505092915050565b6000610100820190506126e3600083018b611a3f565b6126f0602083018a612569565b6126fd6040830189612578565b61270a6060830188612578565b6127176080830187612578565b61272460a08301866119b5565b81810360c08301526127368185612625565b905081810360e083015261274a8184612694565b90509998505050505050505050565b600060408201905061276e60008301856119b5565b61277b6020830184611a3f565b9392505050565b7f4d696e74206661696c6564000000000000000000000000000000000000000000600082015250565b60006127b8600b83611b9d565b91506127c382612782565b602082019050919050565b600060208201905081810360008301526127e7816127ab565b9050919050565b60006127f982611441565b915061280483611441565b925082820190508082111561281c5761281b612145565b5b92915050565b60006040820190506128376000830185611b68565b6128446020830184612578565b9392505050565b60008151905061285a8161144b565b92915050565b600060208284031215612876576128756113d9565b5b60006128848482850161284b565b91505092915050565b600060608201905081810360008301526128a78186612694565b90506128b660208301856119b5565b81810360408301526128c88184612694565b9050949350505050565b7f4275726e206661696c65643a206e6f7420656e6f75676820746f6b656e730000600082015250565b6000612908601e83611b9d565b9150612913826128d2565b602082019050919050565b60006020820190508181036000830152612937816128fb565b9050919050565b7f4275726e206661696c6564000000000000000000000000000000000000000000600082015250565b6000612974600b83611b9d565b915061297f8261293e565b602082019050919050565b600060208201905081810360008301526129a381612967565b905091905056fea264697066735822122051a2faf5f02c9cb4c150ba3ea7f51489c82d1472df4629e18dbb023d9eca361b64736f6c63430008170033", deployedBytecode: "0x6080604052600436106101025760003560e01c8063add29c6d11610095578063dd62ed3e11610064578063dd62ed3e1461032a578063e2f5df8c14610367578063eae02e6814610383578063eed20631146103ac578063fd2410de146103d557610109565b8063add29c6d14610280578063ae98ed1a146102ab578063cf387fed146102d4578063d064d784146102ff57610109565b80635e38b66c116100d15780635e38b66c146101b2578063796d7f56146101ef578063978563081461022c5780639cb99c8b1461025757610109565b80630677d9c71461010e5780631072b91f146101375780632bb1ae7c146101605780634f7d1d581461018957610109565b3661010957005b600080fd5b34801561011a57600080fd5b50610135600480360381019061013091906116e4565b6103fe565b005b34801561014357600080fd5b5061015e600480360381019061015991906117d6565b6104a7565b005b34801561016c57600080fd5b5061018760048036038101906101829190611803565b6104fb565b005b34801561019557600080fd5b506101b060048036038101906101ab9190611905565b610594565b005b3480156101be57600080fd5b506101d960048036038101906101d49190611988565b610694565b6040516101e691906119c4565b60405180910390f35b3480156101fb57600080fd5b50610216600480360381019061021191906119df565b6106ae565b6040516102239190611a4e565b60405180910390f35b34801561023857600080fd5b50610241610792565b60405161024e91906119c4565b60405180910390f35b34801561026357600080fd5b5061027e60048036038101906102799190611a69565b6107aa565b005b34801561028c57600080fd5b50610295610802565b6040516102a291906119c4565b60405180910390f35b3480156102b757600080fd5b506102d260048036038101906102cd9190611abc565b61080b565b005b3480156102e057600080fd5b506102e9610a1a565b6040516102f69190611b77565b60405180910390f35b34801561030b57600080fd5b50610314610a22565b6040516103219190611c11565b60405180910390f35b34801561033657600080fd5b50610351600480360381019061034c9190611c33565b610ab4565b60405161035e91906119c4565b60405180910390f35b610381600480360381019061037c9190611cc9565b610b3b565b005b34801561038f57600080fd5b506103aa60048036038101906103a591906117d6565b610b3f565b005b3480156103b857600080fd5b506103d360048036038101906103ce9190611db7565b610b93565b005b3480156103e157600080fd5b506103fc60048036038101906103f79190611e00565b610bee565b005b610406610d70565b15610446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043d90611ece565b60405180910390fd5b61049c8989898960038a898b8a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e82565b505050505050505050565b6104af610d70565b156104ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e690611ece565b60405180910390fd5b6104f881610f1a565b50565b610503610d70565b15610543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053a90611ece565b60405180910390fd5b61059082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610ffa565b5050565b61059c610d70565b156105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d390611ece565b60405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff16838590846040516106069190611f35565b600060405180830381858888f193505050503d8060008114610644576040519150601f19603f3d011682016040523d82523d6000602084013e610649565b606091505b505090508061068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068490611f98565b60405180910390fd5b5050505050565b60006106a7826106a2610a1a565b61101b565b9050919050565b6000610789600280546106c090611fe7565b80601f01602080910402602001604051908101604052809291908181526020018280546106ec90611fe7565b80156107395780601f1061070e57610100808354040283529160200191610739565b820191906000526020600020905b81548152906001019060200180831161071c57829003601f168201915b50505050508585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a2565b90509392505050565b60006107a5306107a0610a1a565b61101b565b905090565b6107b2610d70565b156107f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e990611ece565b60405180910390fd5b6107fd8383836111ae565b505050565b60008054905090565b610813610d70565b610852576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108499061208a565b60405180910390fd5b60008251905060005b818110156109f2576000848281518110610878576108776120aa565b5b602002602001015190508060200151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610949576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094090612125565b60405180910390fd5b8060200151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109dd9190612174565b9250508190555050808060010191505061085b565b50610a158230305a60036000808a60405180602001604052806000815250610e82565b505050565b600030905090565b606060018054610a3190611fe7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5d90611fe7565b8015610aaa5780601f10610a7f57610100808354040283529160200191610aaa565b820191906000526020600020905b815481529060010190602001808311610a8d57829003601f168201915b5050505050905090565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b5050565b610b47610d70565b15610b87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7e90611ece565b60405180910390fd5b610b908161127a565b50565b610b9b610d70565b15610bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd290611ece565b60405180910390fd5b8060019081610bea919061234a565b5050565b610bf6610d70565b15610c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2d90611ece565b60405180910390fd5b60008151905060005b81811015610d6a576000838281518110610c5c57610c5b6120aa565b5b602002602001015190508060200151600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806000015173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360200151604051610d5491906119c4565b60405180910390a3508080600101915050610c3f565b50505050565b6000606060008060ff73ffffffffffffffffffffffffffffffffffffffff1683604051610d9d9190611f35565b600060405180830381855afa9150503d8060008114610dd8576040519150601f19603f3d011682016040523d82523d6000602084013e610ddd565b606091505b509150915081610e22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1990612468565b60405180910390fd5b6000815111610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906124fa565b60405180910390fd5b80806020019051810190610e7a919061252f565b935050505090565b60fd73ffffffffffffffffffffffffffffffffffffffff1663f69756538486888d8d8d8d8a8a6040518a63ffffffff1660e01b8152600401610ecb9897969594939291906126cd565b60206040518083038185885af1158015610ee9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f0e919061252f565b50505050505050505050565b600060d073ffffffffffffffffffffffffffffffffffffffff1663505c91718360016040518363ffffffff1660e01b8152600401610f59929190612759565b6020604051808303816000875af1158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c919061252f565b905080610fde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd5906127ce565b60405180910390fd5b81600080828254610fef91906127ee565b925050819055505050565b6000815190506000808260208501600060fc5af161101757600080fd5b5050565b600060d173ffffffffffffffffffffffffffffffffffffffff1663e83d49ee83856040518363ffffffff1660e01b8152600401611059929190612822565b602060405180830381865afa158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612860565b905092915050565b6000808484846040516020016110ba9392919061288d565b6040516020818303038152906040529050600080606060fe73ffffffffffffffffffffffffffffffffffffffff16846040516110f69190611f35565b600060405180830381855afa9150503d8060008114611131576040519150601f19603f3d011682016040523d82523d6000602084013e611136565b606091505b5080925081945050508261117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612468565b60405180910390fd5b6000815111156111a0578080602001905181019061119d919061252f565b91505b819450505050509392505050565b6000600167ffffffffffffffff8111156111cb576111ca6114c5565b5b60405190808252806020026020018201604052801561120457816020015b6111f161139f565b8152602001906001900390816111e95790505b50905060405180604001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018381525081600081518110611246576112456120aa565b5b6020026020010181905250611274846000806000806000808860405180602001604052806000815250610e82565b50505050565b8060005410156112bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b69061291e565b60405180910390fd5b600060d073ffffffffffffffffffffffffffffffffffffffff1663505c91718360006040518363ffffffff1660e01b81526004016112fe929190612759565b6020604051808303816000875af115801561131d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611341919061252f565b905080611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137a9061298a565b60405180910390fd5b816000808282546113949190612174565b925050819055505050565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061140e826113e3565b9050919050565b61141e81611403565b811461142957600080fd5b50565b60008135905061143b81611415565b92915050565b6000819050919050565b61145481611441565b811461145f57600080fd5b50565b6000813590506114718161144b565b92915050565b60008115159050919050565b61148c81611477565b811461149757600080fd5b50565b6000813590506114a981611483565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6114fd826114b4565b810181811067ffffffffffffffff8211171561151c5761151b6114c5565b5b80604052505050565b600061152f6113cf565b905061153b82826114f4565b919050565b600067ffffffffffffffff82111561155b5761155a6114c5565b5b602082029050602081019050919050565b600080fd5b600080fd5b61157f81611403565b811461158a57600080fd5b50565b60008135905061159c81611576565b92915050565b6000604082840312156115b8576115b7611571565b5b6115c26040611525565b905060006115d28482850161158d565b60008301525060206115e684828501611462565b60208301525092915050565b600061160561160084611540565b611525565b905080838252602082019050604084028301858111156116285761162761156c565b5b835b81811015611651578061163d88826115a2565b84526020840193505060408101905061162a565b5050509392505050565b600082601f8301126116705761166f6114af565b5b81356116808482602086016115f2565b91505092915050565b600080fd5b60008083601f8401126116a4576116a36114af565b5b8235905067ffffffffffffffff8111156116c1576116c0611689565b5b6020830191508360018202830111156116dd576116dc61156c565b5b9250929050565b60008060008060008060008060006101008a8c031215611707576117066113d9565b5b60006117158c828d0161142c565b99505060206117268c828d0161142c565b98505060406117378c828d0161142c565b97505060606117488c828d01611462565b96505060806117598c828d0161149a565b95505060a08a013567ffffffffffffffff81111561177a576117796113de565b5b6117868c828d0161165b565b94505060c06117978c828d01611462565b93505060e08a013567ffffffffffffffff8111156117b8576117b76113de565b5b6117c48c828d0161168e565b92509250509295985092959850929598565b6000602082840312156117ec576117eb6113d9565b5b60006117fa84828501611462565b91505092915050565b6000806020838503121561181a576118196113d9565b5b600083013567ffffffffffffffff811115611838576118376113de565b5b6118448582860161168e565b92509250509250929050565b600080fd5b600067ffffffffffffffff8211156118705761186f6114c5565b5b611879826114b4565b9050602081019050919050565b82818337600083830152505050565b60006118a86118a384611855565b611525565b9050828152602081018484840111156118c4576118c3611850565b5b6118cf848285611886565b509392505050565b600082601f8301126118ec576118eb6114af565b5b81356118fc848260208601611895565b91505092915050565b6000806000806080858703121561191f5761191e6113d9565b5b600061192d8782880161142c565b945050602061193e87828801611462565b935050604061194f87828801611462565b925050606085013567ffffffffffffffff8111156119705761196f6113de565b5b61197c878288016118d7565b91505092959194509250565b60006020828403121561199e5761199d6113d9565b5b60006119ac8482850161142c565b91505092915050565b6119be81611441565b82525050565b60006020820190506119d960008301846119b5565b92915050565b6000806000604084860312156119f8576119f76113d9565b5b6000611a0686828701611462565b935050602084013567ffffffffffffffff811115611a2757611a266113de565b5b611a338682870161168e565b92509250509250925092565b611a4881611477565b82525050565b6000602082019050611a636000830184611a3f565b92915050565b600080600060608486031215611a8257611a816113d9565b5b6000611a908682870161142c565b9350506020611aa18682870161158d565b9250506040611ab286828701611462565b9150509250925092565b60008060408385031215611ad357611ad26113d9565b5b600083013567ffffffffffffffff811115611af157611af06113de565b5b611afd8582860161165b565b9250506020611b0e8582860161142c565b9150509250929050565b6000819050919050565b6000611b3d611b38611b33846113e3565b611b18565b6113e3565b9050919050565b6000611b4f82611b22565b9050919050565b6000611b6182611b44565b9050919050565b611b7181611b56565b82525050565b6000602082019050611b8c6000830184611b68565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611bcc578082015181840152602081019050611bb1565b60008484015250505050565b6000611be382611b92565b611bed8185611b9d565b9350611bfd818560208601611bae565b611c06816114b4565b840191505092915050565b60006020820190508181036000830152611c2b8184611bd8565b905092915050565b60008060408385031215611c4a57611c496113d9565b5b6000611c588582860161142c565b9250506020611c698582860161158d565b9150509250929050565b60008083601f840112611c8957611c886114af565b5b8235905067ffffffffffffffff811115611ca657611ca5611689565b5b602083019150836001820283011115611cc257611cc161156c565b5b9250929050565b60008060208385031215611ce057611cdf6113d9565b5b600083013567ffffffffffffffff811115611cfe57611cfd6113de565b5b611d0a85828601611c73565b92509250509250929050565b600067ffffffffffffffff821115611d3157611d306114c5565b5b611d3a826114b4565b9050602081019050919050565b6000611d5a611d5584611d16565b611525565b905082815260208101848484011115611d7657611d75611850565b5b611d81848285611886565b509392505050565b600082601f830112611d9e57611d9d6114af565b5b8135611dae848260208601611d47565b91505092915050565b600060208284031215611dcd57611dcc6113d9565b5b600082013567ffffffffffffffff811115611deb57611dea6113de565b5b611df784828501611d89565b91505092915050565b60008060408385031215611e1757611e166113d9565b5b6000611e258582860161142c565b925050602083013567ffffffffffffffff811115611e4657611e456113de565b5b611e528582860161165b565b9150509250929050565b7f547279696e6720746f2063616c6c2065787465726e616c2066756e6374696f6e60008201527f207769746820696e7465726e616c206d65737361676500000000000000000000602082015250565b6000611eb8603683611b9d565b9150611ec382611e5c565b604082019050919050565b60006020820190508181036000830152611ee781611eab565b9050919050565b600081519050919050565b600081905092915050565b6000611f0f82611eee565b611f198185611ef9565b9350611f29818560208601611bae565b80840191505092915050565b6000611f418284611f04565b915081905092915050565b7f43616c6c206661696c6564000000000000000000000000000000000000000000600082015250565b6000611f82600b83611b9d565b9150611f8d82611f4c565b602082019050919050565b60006020820190508181036000830152611fb181611f75565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611fff57607f821691505b60208210810361201257612011611fb8565b5b50919050565b7f547279696e6720746f2063616c6c20696e7465726e616c2066756e6374696f6e60008201527f20776974682065787465726e616c206d65737361676500000000000000000000602082015250565b6000612074603683611b9d565b915061207f82612018565b604082019050919050565b600060208201905081810360008301526120a381612067565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f5472616e73666572206d6f7265207468616e20616c6c6f776564000000000000600082015250565b600061210f601a83611b9d565b915061211a826120d9565b602082019050919050565b6000602082019050818103600083015261213e81612102565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061217f82611441565b915061218a83611441565b92508282039050818111156121a2576121a1612145565b5b92915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261220a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826121cd565b61221486836121cd565b95508019841693508086168417925050509392505050565b600061224761224261223d84611441565b611b18565b611441565b9050919050565b6000819050919050565b6122618361222c565b61227561226d8261224e565b8484546121da565b825550505050565b600090565b61228a61227d565b612295818484612258565b505050565b5b818110156122b9576122ae600082612282565b60018101905061229b565b5050565b601f8211156122fe576122cf816121a8565b6122d8846121bd565b810160208510156122e7578190505b6122fb6122f3856121bd565b83018261229a565b50505b505050565b600082821c905092915050565b600061232160001984600802612303565b1980831691505092915050565b600061233a8383612310565b9150826002028217905092915050565b61235382611b92565b67ffffffffffffffff81111561236c5761236b6114c5565b5b6123768254611fe7565b6123818282856122bd565b600060209050601f8311600181146123b457600084156123a2578287015190505b6123ac858261232e565b865550612414565b601f1984166123c2866121a8565b60005b828110156123ea578489015182556001820191506020850194506020810190506123c5565b868310156124075784890151612403601f891682612310565b8355505b6001600288020188555050505b505050505050565b7f507265636f6d70696c656420636f6e74726163742063616c6c206661696c6564600082015250565b6000612452602083611b9d565b915061245d8261241c565b602082019050919050565b6000602082019050818103600083015261248181612445565b9050919050565b7f2749535f494e5445524e414c5f4d455353414745272072657475726e7320696e60008201527f76616c6964206461746100000000000000000000000000000000000000000000602082015250565b60006124e4602a83611b9d565b91506124ef82612488565b604082019050919050565b60006020820190508181036000830152612513816124d7565b9050919050565b60008151905061252981611483565b92915050565b600060208284031215612545576125446113d9565b5b60006125538482850161251a565b91505092915050565b600060ff82169050919050565b6125728161255c565b82525050565b61258181611403565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6125bc81611b56565b82525050565b6125cb81611441565b82525050565b6040820160008201516125e760008501826125b3565b5060208201516125fa60208501826125c2565b50505050565b600061260c83836125d1565b60408301905092915050565b6000602082019050919050565b600061263082612587565b61263a8185612592565b9350612645836125a3565b8060005b8381101561267657815161265d8882612600565b975061266883612618565b925050600181019050612649565b5085935050505092915050565b600082825260208201905092915050565b600061269f82611eee565b6126a98185612683565b93506126b9818560208601611bae565b6126c2816114b4565b840191505092915050565b6000610100820190506126e3600083018b611a3f565b6126f0602083018a612569565b6126fd6040830189612578565b61270a6060830188612578565b6127176080830187612578565b61272460a08301866119b5565b81810360c08301526127368185612625565b905081810360e083015261274a8184612694565b90509998505050505050505050565b600060408201905061276e60008301856119b5565b61277b6020830184611a3f565b9392505050565b7f4d696e74206661696c6564000000000000000000000000000000000000000000600082015250565b60006127b8600b83611b9d565b91506127c382612782565b602082019050919050565b600060208201905081810360008301526127e7816127ab565b9050919050565b60006127f982611441565b915061280483611441565b925082820190508082111561281c5761281b612145565b5b92915050565b60006040820190506128376000830185611b68565b6128446020830184612578565b9392505050565b60008151905061285a8161144b565b92915050565b600060208284031215612876576128756113d9565b5b60006128848482850161284b565b91505092915050565b600060608201905081810360008301526128a78186612694565b90506128b660208301856119b5565b81810360408301526128c88184612694565b9050949350505050565b7f4275726e206661696c65643a206e6f7420656e6f75676820746f6b656e730000600082015250565b6000612908601e83611b9d565b9150612913826128d2565b602082019050919050565b60006020820190508181036000830152612937816128fb565b9050919050565b7f4275726e206661696c6564000000000000000000000000000000000000000000600082015250565b6000612974600b83611b9d565b915061297f8261293e565b602082019050919050565b600060208201905081810360008301526129a381612967565b905091905056fea264697066735822122051a2faf5f02c9cb4c150ba3ea7f51489c82d1472df4629e18dbb023d9eca361b64736f6c63430008170033", linkReferences: {}, deployedLinkReferences: {} }; // src/utils/deployPart.ts var import_viem = require("viem"); var import_niljs = require("@nilfoundation/niljs"); var refineSalt = (salt) => { if (typeof salt === "bigint") { return (0, import_niljs.hexToBytes)((0, import_niljs.addHexPrefix)(salt.toString(16).padStart(64, "0"))).slice( 0, 32 ); } if (salt.length !== 32) throw Error("Salt must be 32 bytes"); return salt; }; var prepareDeployPart = (data) => { const byteSalt = refineSalt(data.salt); let constructorData; if (data.abi) { constructorData = (0, import_niljs.hexToBytes)( (0, import_viem.encodeDeployData)({ abi: data.abi, bytecode: typeof data.bytecode === "string" ? data.bytecode : (0, import_niljs.bytesToHex)(data.bytecode), args: data.args || [] }) ); } else { constructorData = typeof data.bytecode === "string" ? (0, import_niljs.hexToBytes)(data.bytecode) : data.bytecode; } const bytecode = new Uint8Array([...constructorData, ...byteSalt]); const address = (0, import_niljs.calculateAddress)(data.shard, constructorData, byteSalt); return { data: bytecode, address }; }; // src/utils/index.ts var utils_exports = {}; __export(utils_exports, { expectAllReceiptsSuccess: () => expectAllReceiptsSuccess, prepareDeployPart: () => prepareDeployPart }); // src/utils/receipt.ts var expectAllReceiptsSuccess = (receipts) => { for (const receipt of receipts) { if (!receipt.success) throw Error(`Message failed: ${receipt.messageHash}`); } return receipts; }; // src/XClient.ts var import_niljs2 = require("@nilfoundation/niljs"); var XClient = class _XClient { client; shardId; rpc; signer; constructor(config) { const { shardId, rpc, signerOrPrivateKey } = config; this.client = new import_niljs2.PublicClient({ shardId, transport: new import_niljs2.HttpTransport({ endpoint: rpc }) }); this.shardId = shardId; this.rpc = rpc; if (signerOrPrivateKey) { typeof signerOrPrivateKey === "string" ? this.signer = new import_niljs2.LocalECDSAKeySigner({ privateKey: signerOrPrivateKey }) : this.signer = signerOrPrivateKey; } } connect(config) { return new _XClient({ shardId: this.shardId, rpc: this.rpc, signerOrPrivateKey: this.signer, ...config }); } async sendRawMessage(address, calldata, isDeploy) { if (!this.signer) throw Error("The client has no signer"); const { seqno, chainId } = await this.getCallParams(address); const { raw } = await (0, import_niljs2.externalMessageEncode)( { seqno, chainId, isDeploy, to: (0, import_niljs2.hexToBytes)(address), data: (0, import_niljs2.hexToBytes)(calldata) }, this.signer ); return this.client.sendRawMessage(raw); } async call(...args) { return this.client.call(...args); } async getCurrencies(address, blockTagOrHash = "latest") { return this.client.getCurrencies(address, blockTagOrHash); } async getCallParams(address) { const [seqno, chainId] = await Promise.all([ this.client.getMessageCount(address, "latest"), this.client.chainId() ]); return { seqno, chainId }; } }; // src/XWallet.ts var XWallet = class _XWallet { constructor(address, client) { this.address = address; this.client = client; } static abi = XWallet_default.abi; static code = (0, import_niljs3.hexToBytes)((0, import_niljs3.addHexPrefix)(XWallet_default.bytecode)); static async init(config) { const client = new XClient({ shardId: (0, import_niljs3.getShardIdFromAddress)(config.address), rpc: config.rpc, signerOrPrivateKey: config.signerOrPrivateKey }); return new _XWallet(config.address, client); } static async deploy(config) { const pubkey = typeof config.signerOrPrivateKey === "string" ? (0, import_niljs3.getPublicKey)(config.signerOrPrivateKey) : config.signerOrPrivateKey.getPublicKey(); const client = new XClient(config); const { data, address } = prepareDeployPart({ salt: BigInt(Date.now()), bytecode: _XWallet.code, abi: _XWallet.abi, shard: config.shardId, args: [pubkey] }); const addressHex = (0, import_niljs3.bytesToHex)(address); const faucet = new import_niljs3.Faucet(client.client); await faucet.withdrawToWithRetry((0, import_niljs3.bytesToHex)(address), 10n ** 15n); const messageHash = await client.sendRawMessage( (0, import_niljs3.bytesToHex)(address), (0, import_niljs3.bytesToHex)(data), true ); await (0, import_niljs3.waitTillCompleted)(client.client, config.shardId, messageHash).then( expectAllReceiptsSuccess ); return _XWallet.init({ address: addressHex, ...config }); } static async deployRandom(rpc, shardId = 1) { const privateKey = (0, import_niljs3.generateRandomPrivateKey)(); return _XWallet.deploy({ signerOrPrivateKey: privateKey, rpc, shardId }); } async approve(spender, currencies) { const approveCalldata = (0, import_viem2.encodeFunctionData)({ abi: _XWallet.abi, functionName: "approve", args: [spender, currencies] }); return this._callWaitResult(approveCalldata); } async allowance(spender, currency) { const result = await this.client.call( { to: this.address, data: (0, import_viem2.encodeFunctionData)({ abi: _XWallet.abi, functionName: "allowance", args: [spender, currency] }) }, "latest" ); const decoded = (0, import_viem2.decodeFunctionResult)({ abi: _XWallet.abi, functionName: "allowance", data: result.data }); return BigInt(decoded); } async createCurrency(amount) { const createCurrencyCalldata = (0, import_viem2.encodeFunctionData)({ abi: _XWallet.abi, functionName: "mintCurrency", args: [amount] }); const receipts = await this._callWaitResult(createCurrencyCalldata); const currencyId = this.address; return { receipts, currencyId }; } async getCurrencies(blockTagOrHash = "latest") { return this.client.getCurrencies(this.address, blockTagOrHash); } async deployContract(params) { const deployData = { shard: params.shardId, bytecode: params.bytecode, abi: params.abi, args: params.args, salt: params.salt }; const { data, address } = prepareDeployPart(deployData); const { seqno, chainId } = await this.client.getCallParams(this.address); const receipts = await this.sendMessage({ to: address, refundTo: this.address, data, value: params.value ?? 0n, deploy: true, feeCredit: params.feeCredit, seqno, chainId }); return { receipts, address: (0, import_niljs3.bytesToHex)(address) }; } async sendMessage(messageParams) { const hexTo = (0, import_niljs3.bytesToHex)((0, import_niljs3.refineAddress)(messageParams.to)); const hexRefundTo = (0, import_niljs3.bytesToHex)( (0, import_niljs3.refineAddress)(messageParams.refundTo ?? this.address) ); const hexBounceTo = (0, import_niljs3.bytesToHex)( (0, import_niljs3.refineAddress)(messageParams.bounceTo ?? this.address) ); const hexData = messageParams.data ? messageParams.data instanceof Uint8Array ? (0, import_niljs3.bytesToHex)(messageParams.data) : messageParams.data : "0x"; const callData = (0, import_viem2.encodeFunctionData)({ abi: _XWallet.abi, functionName: "asyncCall", args: [ hexTo, hexRefundTo, hexBounceTo, messageParams.feeCredit, !!messageParams.deploy, messageParams.tokens ?? [], messageParams.value ?? 0n, hexData ] }); return this._callWaitResult(callData); } async _callWaitResult(calldata, isDeploy = false) { const messageHash = await this._callExternal(calldata, isDeploy); return (0, import_niljs3.waitTillCompleted)( this.client.client, (0, import_niljs3.getShardIdFromAddress)(this.address), messageHash ); } async _callExternal(calldata, isDeploy = false) { return this.client.sendRawMessage(this.address, calldata, isDeploy); } }; // src/XContract.ts var import_viem3 = require("viem"); var XContract = class _XContract { constructor(abi, wallet, address) { this.abi = abi; this.wallet = wallet; this.address = address; } static connect(wallet, abi, address) { return new _XContract(abi, wallet, address); } static async deploy(wallet, artifact, args, shardId, salt) { const { address, receipts } = await wallet.deployContract({ abi: artifact.abi, args, bytecode: artifact.bytecode, feeCredit: 5000000n, shardId, salt: salt ?? BigInt(Date.now()) }); expectAllReceiptsSuccess(receipts); return new _XContract(artifact.abi, wallet, address); } connect(wallet) { return new _XContract(this.abi, wallet, this.address); } async sendMessage(params, messageTokens, expectSuccess = true) { const receipts = await this.wallet.sendMessage({ to: this.address, feeCredit: messageTokens.feeCredit, value: messageTokens.value, tokens: messageTokens.tokens, data: (0, import_viem3.encodeFunctionData)({ abi: this.abi, functionName: params.functionName, args: params.args }) }); if (expectSuccess) expectAllReceiptsSuccess(receipts); return receipts; } async call(params) { const { data } = await this.wallet.client.call( { to: this.address, data: (0, import_viem3.encodeFunctionData)({ abi: this.abi, functionName: params.functionName, args: params.args }) }, "latest" ); return (0, import_viem3.decodeFunctionResult)({ abi: this.abi, functionName: params.functionName, data }); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { XClient, XContract, XWallet, utils });