🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@goat-sdk/plugin-erc20

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goat-sdk/plugin-erc20 - npm Package Compare versions

Comparing version
0.2.5
to
0.2.6
+1
dist/chunk-32NP6XA5.mjs
import{a as p}from"./chunk-LRPXRHNE.mjs";import{a as m,b as h,c as b,d as g,e as v,f as k,g as w,h as T,i as A,j as F}from"./chunk-7JSHDX4L.mjs";import{a as y}from"./chunk-YSXGDEY5.mjs";import{Tool as c}from"@goat-sdk/core";import{EVMWalletClient as a}from"@goat-sdk/wallet-evm";function d(f,t,n,e){var r=arguments.length,s=r<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,n):e,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,t,n,e);else for(var l=f.length-1;l>=0;l--)(u=f[l])&&(s=(r<3?u(s):r>3?u(t,n,s):u(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}y(d,"_ts_decorate");function o(f,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(f,t)}y(o,"_ts_metadata");var i=class{static{y(this,"Erc20Service")}tokens;constructor({tokens:t}={}){this.tokens=t??[]}async getTokenInfoBySymbol(t,n){let e=this.tokens.find(u=>[u.symbol,u.symbol.toLowerCase()].includes(n.symbol));if(!e)throw Error(`Token with symbol ${n.symbol} not found`);let r=t.getChain(),s=e.chains[r.id]?.contractAddress;if(!s)throw Error(`Token with symbol ${n.symbol} not found on chain ${r.id}`);return{symbol:e?.symbol,contractAddress:s,decimals:e?.decimals,name:e?.name}}async getTokenBalance(t,n){try{let e=await t.resolveAddress(n.wallet),r=await t.read({address:n.tokenAddress,abi:p,functionName:"balanceOf",args:[e]});return Number(r.value)}catch(e){throw Error(`Failed to fetch balance: ${e}`)}}async transfer(t,n){try{let e=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:p,functionName:"transfer",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to transfer: ${e}`)}}async getTokenTotalSupply(t,n){try{return(await t.read({address:n.tokenAddress,abi:p,functionName:"totalSupply"})).value}catch(e){throw Error(`Failed to fetch total supply: ${e}`)}}async getTokenAllowance(t,n){try{let e=await t.resolveAddress(n.owner),r=await t.resolveAddress(n.spender),s=await t.read({address:n.tokenAddress,abi:p,functionName:"allowance",args:[e,r]});return Number(s.value)}catch(e){throw Error(`Failed to fetch allowance: ${e}`)}}async approve(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:p,functionName:"approve",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to approve: ${e}`)}}async revokeApproval(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:p,functionName:"approve",args:[e,0]})).hash}catch(e){throw Error(`Failed to revoke approval: ${e}`)}}async transferFrom(t,n){try{let e=await t.resolveAddress(n.from),r=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:p,functionName:"transferFrom",args:[e,r,n.amount]})).hash}catch(e){throw Error(`Failed to transfer from: ${e}`)}}async convertToBaseUnit(t){let{amount:n,decimals:e}=t,r=n*10**e;return Number(r)}async convertFromBaseUnit(t){let{amount:n,decimals:e}=t,r=n/10**e;return Number(r)}};d([c({description:"Get the ERC20 token info by its symbol, including the contract address, decimals, and name"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof m>"u"?Object:m]),o("design:returntype",Promise)],i.prototype,"getTokenInfoBySymbol",null);d([c({description:"Get the balance of an ERC20 token in base units. Convert to decimal units before returning."}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof h>"u"?Object:h]),o("design:returntype",Promise)],i.prototype,"getTokenBalance",null);d([c({description:"Transfer an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof b>"u"?Object:b]),o("design:returntype",Promise)],i.prototype,"transfer",null);d([c({description:"Get the total supply of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof g>"u"?Object:g]),o("design:returntype",Promise)],i.prototype,"getTokenTotalSupply",null);d([c({description:"Get the allowance of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof v>"u"?Object:v]),o("design:returntype",Promise)],i.prototype,"getTokenAllowance",null);d([c({description:"Approve an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof k>"u"?Object:k]),o("design:returntype",Promise)],i.prototype,"approve",null);d([c({description:"Revoke approval for an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof w>"u"?Object:w]),o("design:returntype",Promise)],i.prototype,"revokeApproval",null);d([c({description:"Transfer an amount of an ERC20 token from an address to another address"}),o("design:type",Function),o("design:paramtypes",[typeof a>"u"?Object:a,typeof T>"u"?Object:T]),o("design:returntype",Promise)],i.prototype,"transferFrom",null);d([c({description:"Convert an amount of an ERC20 token to its base unit"}),o("design:type",Function),o("design:paramtypes",[typeof A>"u"?Object:A]),o("design:returntype",Promise)],i.prototype,"convertToBaseUnit",null);d([c({description:"Convert an amount of an ERC20 token from its base unit to its decimal unit"}),o("design:type",Function),o("design:paramtypes",[typeof F>"u"?Object:F]),o("design:returntype",Promise)],i.prototype,"convertFromBaseUnit",null);export{i as a};
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkU237PHUXjs = require('./chunk-U237PHUX.js');var _chunkYPXRNKFVjs = require('./chunk-YPXRNKFV.js');var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var _walletevm = require('@goat-sdk/wallet-evm');function d(f,t,n,e){var r=arguments.length,s=r<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,n):e,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(f,t,n,e);else for(var l=f.length-1;l>=0;l--)(u=f[l])&&(s=(r<3?u(s):r>3?u(t,n,s):u(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}_chunkEI7MMDWYjs.a.call(void 0, d,"_ts_decorate");function o(f,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(f,t)}_chunkEI7MMDWYjs.a.call(void 0, o,"_ts_metadata");var i=class{static{_chunkEI7MMDWYjs.a.call(void 0, this,"Erc20Service")}constructor({tokens:t}={}){this.tokens=_nullishCoalesce(t, () => ([]))}async getTokenInfoBySymbol(t,n){let e=this.tokens.find(u=>[u.symbol,u.symbol.toLowerCase()].includes(n.symbol));if(!e)throw Error(`Token with symbol ${n.symbol} not found`);let r=t.getChain(),s=_optionalChain([e, 'access', _ => _.chains, 'access', _2 => _2[r.id], 'optionalAccess', _3 => _3.contractAddress]);if(!s)throw Error(`Token with symbol ${n.symbol} not found on chain ${r.id}`);return{symbol:_optionalChain([e, 'optionalAccess', _4 => _4.symbol]),contractAddress:s,decimals:_optionalChain([e, 'optionalAccess', _5 => _5.decimals]),name:_optionalChain([e, 'optionalAccess', _6 => _6.name])}}async getTokenBalance(t,n){try{let e=await t.resolveAddress(n.wallet),r=await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"balanceOf",args:[e]});return Number(r.value)}catch(e){throw Error(`Failed to fetch balance: ${e}`)}}async transfer(t,n){try{let e=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"transfer",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to transfer: ${e}`)}}async getTokenTotalSupply(t,n){try{return(await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"totalSupply"})).value}catch(e){throw Error(`Failed to fetch total supply: ${e}`)}}async getTokenAllowance(t,n){try{let e=await t.resolveAddress(n.owner),r=await t.resolveAddress(n.spender),s=await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"allowance",args:[e,r]});return Number(s.value)}catch(e){throw Error(`Failed to fetch allowance: ${e}`)}}async approve(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"approve",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to approve: ${e}`)}}async revokeApproval(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"approve",args:[e,0]})).hash}catch(e){throw Error(`Failed to revoke approval: ${e}`)}}async transferFrom(t,n){try{let e=await t.resolveAddress(n.from),r=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"transferFrom",args:[e,r,n.amount]})).hash}catch(e){throw Error(`Failed to transfer from: ${e}`)}}async convertToBaseUnit(t){let{amount:n,decimals:e}=t,r=n*10**e;return Number(r)}async convertFromBaseUnit(t){let{amount:n,decimals:e}=t,r=n/10**e;return Number(r)}};d([_core.Tool.call(void 0, {description:"Get the ERC20 token info by its symbol, including the contract address, decimals, and name"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.a>"u"?Object:_chunkYPXRNKFVjs.a]),o("design:returntype",Promise)],i.prototype,"getTokenInfoBySymbol",null);d([_core.Tool.call(void 0, {description:"Get the balance of an ERC20 token in base units. Convert to decimal units before returning."}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.b>"u"?Object:_chunkYPXRNKFVjs.b]),o("design:returntype",Promise)],i.prototype,"getTokenBalance",null);d([_core.Tool.call(void 0, {description:"Transfer an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.c>"u"?Object:_chunkYPXRNKFVjs.c]),o("design:returntype",Promise)],i.prototype,"transfer",null);d([_core.Tool.call(void 0, {description:"Get the total supply of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.d>"u"?Object:_chunkYPXRNKFVjs.d]),o("design:returntype",Promise)],i.prototype,"getTokenTotalSupply",null);d([_core.Tool.call(void 0, {description:"Get the allowance of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.e>"u"?Object:_chunkYPXRNKFVjs.e]),o("design:returntype",Promise)],i.prototype,"getTokenAllowance",null);d([_core.Tool.call(void 0, {description:"Approve an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.f>"u"?Object:_chunkYPXRNKFVjs.f]),o("design:returntype",Promise)],i.prototype,"approve",null);d([_core.Tool.call(void 0, {description:"Revoke approval for an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.g>"u"?Object:_chunkYPXRNKFVjs.g]),o("design:returntype",Promise)],i.prototype,"revokeApproval",null);d([_core.Tool.call(void 0, {description:"Transfer an amount of an ERC20 token from an address to another address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunkYPXRNKFVjs.h>"u"?Object:_chunkYPXRNKFVjs.h]),o("design:returntype",Promise)],i.prototype,"transferFrom",null);d([_core.Tool.call(void 0, {description:"Convert an amount of an ERC20 token to its base unit"}),o("design:type",Function),o("design:paramtypes",[typeof _chunkYPXRNKFVjs.i>"u"?Object:_chunkYPXRNKFVjs.i]),o("design:returntype",Promise)],i.prototype,"convertToBaseUnit",null);d([_core.Tool.call(void 0, {description:"Convert an amount of an ERC20 token from its base unit to its decimal unit"}),o("design:type",Function),o("design:paramtypes",[typeof _chunkYPXRNKFVjs.j>"u"?Object:_chunkYPXRNKFVjs.j]),o("design:returntype",Promise)],i.prototype,"convertFromBaseUnit",null);exports.a = i;
import{a as t}from"./chunk-YSXGDEY5.mjs";import{createToolParameters as s}from"@goat-sdk/core";import{z as e}from"zod";var n=class extends s(e.object({symbol:e.string().describe("The symbol of the token to get the info of")})){static{t(this,"GetTokenInfoBySymbolParameters")}},r=class extends s(e.object({wallet:e.string().describe("The address to get the balance of"),tokenAddress:e.string().describe("The address of the token to get the balance of")})){static{t(this,"GetTokenBalanceParameters")}},d=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to transfer"),to:e.string().describe("The address to transfer the token to"),amount:e.string().describe("The amount of tokens to transfer in base units")})){static{t(this,"TransferParameters")}},c=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to get the total supply of")})){static{t(this,"GetTokenTotalSupplyParameters")}},i=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to check the allowance of"),owner:e.string().describe("The address to check the allowance of"),spender:e.string().describe("The address to check the allowance for")})){static{t(this,"GetTokenAllowanceParameters")}},h=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to approve"),spender:e.string().describe("The address to approve the allowance to"),amount:e.string().describe("The amount of tokens to approve in base units")})){static{t(this,"ApproveParameters")}},b=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to revoke"),spender:e.string().describe("The address to revoke the allowance to")})){static{t(this,"RevokeApprovalParameters")}},a=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to transfer"),from:e.string().describe("The address to transfer the token from"),to:e.string().describe("The address to transfer the token to"),amount:e.string().describe("The amount of tokens to transfer in base units")})){static{t(this,"TransferFromParameters")}},f=class extends s(e.object({amount:e.number().describe("The amount of tokens to convert from decimal units to base units"),decimals:e.number().describe("The number of decimals of the token")})){static{t(this,"ConvertToBaseUnitParameters")}},l=class extends s(e.object({amount:e.number().describe("The amount of tokens to convert from base units to decimal units"),decimals:e.number().describe("The number of decimals of the token")})){static{t(this,"ConvertFromBaseUnitParameters")}};export{n as a,r as b,d as c,c as d,i as e,h as f,b as g,a as h,f as i,l as j};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var o={decimals:18,symbol:"PEPE",name:"Pepe",chains:{1:{contractAddress:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"},10:{contractAddress:"0xc1c167cc44f7923cd0062c4370df962f9ddb16f5"},8453:{contractAddress:"0xb4fde59a779991bfb6a52253b51947828b982be3"}}},n= exports.b ={decimals:6,symbol:"USDC",name:"USDC",chains:{1:{contractAddress:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"},10:{contractAddress:"0x0b2c639c533813f4aa9d7837caf62653d097ff85"},137:{contractAddress:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"},8453:{contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},84532:{contractAddress:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},11155111:{contractAddress:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"},34443:{contractAddress:"0xd988097fb8612cc24eeC14542bC03424c656005f"}}},b= exports.c ={decimals:18,symbol:"MODE",name:"Mode",chains:{34443:{contractAddress:"0xDfc7C877a950e49D2610114102175A06C2e3167a"}}},f= exports.d ={decimals:18,symbol:"WETH",name:"Wrapped Ether",chains:{1:{contractAddress:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"},8453:{contractAddress:"0x4200000000000000000000000000000000000006"},34443:{contractAddress:"0x4200000000000000000000000000000000000006"},42161:{contractAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},10:{contractAddress:"0x4200000000000000000000000000000000000006"},137:{contractAddress:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"}}};function A(e,t){let d=[];for(let c of t){let s=c.chains[e];s&&d.push({chainId:e,decimals:c.decimals,symbol:c.symbol,name:c.name,contractAddress:s.contractAddress})}return d}_chunkEI7MMDWYjs.a.call(void 0, A,"getTokensForNetwork");exports.a = o; exports.b = n; exports.c = b; exports.d = f; exports.e = A;
import{a as c}from"./chunk-32NP6XA5.mjs";import{a as r}from"./chunk-YSXGDEY5.mjs";import{PluginBase as n}from"@goat-sdk/core";var t=class extends n{static{r(this,"ERC20Plugin")}constructor({tokens:e}){super("erc20",[new c({tokens:e})])}supportsChain=r(e=>e.type==="evm","supportsChain")};function u({tokens:o}){return new t({tokens:o})}r(u,"erc20");export{t as a,u as b};
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;var _chunk3DW23AWTjs = require('./chunk-3DW23AWT.js');var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var t= (_class =class extends _core.PluginBase{static{_chunkEI7MMDWYjs.a.call(void 0, this,"ERC20Plugin")}constructor({tokens:e}){super("erc20",[new (0, _chunk3DW23AWTjs.a)({tokens:e})]);_class.prototype.__init.call(this);}__init() {this.supportsChain=_chunkEI7MMDWYjs.a.call(void 0, e=>e.type==="evm","supportsChain")}}, _class);function m({tokens:o}){return new t({tokens:o})}_chunkEI7MMDWYjs.a.call(void 0, m,"erc20");exports.a = t; exports.b = m;
import{a}from"./chunk-YSXGDEY5.mjs";var n={decimals:18,symbol:"PEPE",name:"Pepe",chains:{1:{contractAddress:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"},10:{contractAddress:"0xc1c167cc44f7923cd0062c4370df962f9ddb16f5"},8453:{contractAddress:"0xb4fde59a779991bfb6a52253b51947828b982be3"}}},b={decimals:6,symbol:"USDC",name:"USDC",chains:{1:{contractAddress:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"},10:{contractAddress:"0x0b2c639c533813f4aa9d7837caf62653d097ff85"},137:{contractAddress:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"},8453:{contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},84532:{contractAddress:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},11155111:{contractAddress:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"},34443:{contractAddress:"0xd988097fb8612cc24eeC14542bC03424c656005f"}}},f={decimals:18,symbol:"MODE",name:"Mode",chains:{34443:{contractAddress:"0xDfc7C877a950e49D2610114102175A06C2e3167a"}}},A={decimals:18,symbol:"WETH",name:"Wrapped Ether",chains:{1:{contractAddress:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"},8453:{contractAddress:"0x4200000000000000000000000000000000000006"},34443:{contractAddress:"0x4200000000000000000000000000000000000006"},42161:{contractAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"},10:{contractAddress:"0x4200000000000000000000000000000000000006"},137:{contractAddress:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"}}};function x(e,t){let d=[];for(let c of t){let s=c.chains[e];s&&d.push({chainId:e,decimals:c.decimals,symbol:c.symbol,name:c.name,contractAddress:s.contractAddress})}return d}a(x,"getTokensForNetwork");export{n as a,b,f as c,A as d,x as e};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var _zod = require('zod');var n=class extends _core.createToolParameters.call(void 0, _zod.z.object({symbol:_zod.z.string().describe("The symbol of the token to get the info of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenInfoBySymbolParameters")}},r= exports.b =class extends _core.createToolParameters.call(void 0, _zod.z.object({wallet:_zod.z.string().describe("The address to get the balance of"),tokenAddress:_zod.z.string().describe("The address of the token to get the balance of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenBalanceParameters")}},d= exports.c =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to transfer"),to:_zod.z.string().describe("The address to transfer the token to"),amount:_zod.z.string().describe("The amount of tokens to transfer in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"TransferParameters")}},c= exports.d =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to get the total supply of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenTotalSupplyParameters")}},i= exports.e =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to check the allowance of"),owner:_zod.z.string().describe("The address to check the allowance of"),spender:_zod.z.string().describe("The address to check the allowance for")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenAllowanceParameters")}},h= exports.f =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to approve"),spender:_zod.z.string().describe("The address to approve the allowance to"),amount:_zod.z.string().describe("The amount of tokens to approve in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ApproveParameters")}},b= exports.g =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to revoke"),spender:_zod.z.string().describe("The address to revoke the allowance to")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"RevokeApprovalParameters")}},a= exports.h =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to transfer"),from:_zod.z.string().describe("The address to transfer the token from"),to:_zod.z.string().describe("The address to transfer the token to"),amount:_zod.z.string().describe("The amount of tokens to transfer in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"TransferFromParameters")}},f= exports.i =class extends _core.createToolParameters.call(void 0, _zod.z.object({amount:_zod.z.number().describe("The amount of tokens to convert from decimal units to base units"),decimals:_zod.z.number().describe("The number of decimals of the token")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ConvertToBaseUnitParameters")}},l= exports.j =class extends _core.createToolParameters.call(void 0, _zod.z.object({amount:_zod.z.number().describe("The amount of tokens to convert from base units to decimal units"),decimals:_zod.z.number().describe("The number of decimals of the token")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ConvertFromBaseUnitParameters")}};exports.a = n; exports.b = r; exports.c = d; exports.d = c; exports.e = i; exports.f = h; exports.g = b; exports.h = a; exports.i = f; exports.j = l;
+1
-1

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNYKDPFBXjs = require('./chunk-NYKDPFBX.js');require('./chunk-N626SWPW.js');require('./chunk-U237PHUX.js');require('./chunk-3L5AL3LU.js');require('./chunk-EI7MMDWY.js');exports.ERC20Plugin = _chunkNYKDPFBXjs.a; exports.erc20 = _chunkNYKDPFBXjs.b;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCP2PFXHWjs = require('./chunk-CP2PFXHW.js');require('./chunk-3DW23AWT.js');require('./chunk-U237PHUX.js');require('./chunk-YPXRNKFV.js');require('./chunk-EI7MMDWY.js');exports.ERC20Plugin = _chunkCP2PFXHWjs.a; exports.erc20 = _chunkCP2PFXHWjs.b;

@@ -1,1 +0,1 @@

import{a,b}from"./chunk-OOTXVZEE.mjs";import"./chunk-HHCIO3KF.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-ONF4HCCC.mjs";import"./chunk-YSXGDEY5.mjs";export{a as ERC20Plugin,b as erc20};
import{a,b}from"./chunk-BDIYMBEJ.mjs";import"./chunk-32NP6XA5.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-7JSHDX4L.mjs";import"./chunk-YSXGDEY5.mjs";export{a as ERC20Plugin,b as erc20};
import { EVMWalletClient } from '@goat-sdk/wallet-evm';
import { GetTokenInfoBySymbolParameters, GetTokenBalanceParameters, TransferParameters, GetTokenTotalSupplyParameters, GetTokenAllowanceParameters, ApproveParameters, TransferFromParameters, ConvertToBaseUnitParameters, ConvertFromBaseUnitParameters } from './parameters.mjs';
import { GetTokenInfoBySymbolParameters, GetTokenBalanceParameters, TransferParameters, GetTokenTotalSupplyParameters, GetTokenAllowanceParameters, ApproveParameters, RevokeApprovalParameters, TransferFromParameters, ConvertToBaseUnitParameters, ConvertFromBaseUnitParameters } from './parameters.mjs';
import { Token } from './token.mjs';

@@ -23,2 +23,3 @@ import '@goat-sdk/core';

approve(walletClient: EVMWalletClient, parameters: ApproveParameters): Promise<string>;
revokeApproval(walletClient: EVMWalletClient, parameters: RevokeApprovalParameters): Promise<string>;
transferFrom(walletClient: EVMWalletClient, parameters: TransferFromParameters): Promise<string>;

@@ -25,0 +26,0 @@ convertToBaseUnit(parameters: ConvertToBaseUnitParameters): Promise<number>;

import { EVMWalletClient } from '@goat-sdk/wallet-evm';
import { GetTokenInfoBySymbolParameters, GetTokenBalanceParameters, TransferParameters, GetTokenTotalSupplyParameters, GetTokenAllowanceParameters, ApproveParameters, TransferFromParameters, ConvertToBaseUnitParameters, ConvertFromBaseUnitParameters } from './parameters.js';
import { GetTokenInfoBySymbolParameters, GetTokenBalanceParameters, TransferParameters, GetTokenTotalSupplyParameters, GetTokenAllowanceParameters, ApproveParameters, RevokeApprovalParameters, TransferFromParameters, ConvertToBaseUnitParameters, ConvertFromBaseUnitParameters } from './parameters.js';
import { Token } from './token.js';

@@ -23,2 +23,3 @@ import '@goat-sdk/core';

approve(walletClient: EVMWalletClient, parameters: ApproveParameters): Promise<string>;
revokeApproval(walletClient: EVMWalletClient, parameters: RevokeApprovalParameters): Promise<string>;
transferFrom(walletClient: EVMWalletClient, parameters: TransferFromParameters): Promise<string>;

@@ -25,0 +26,0 @@ convertToBaseUnit(parameters: ConvertToBaseUnitParameters): Promise<number>;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkN626SWPWjs = require('./chunk-N626SWPW.js');require('./chunk-U237PHUX.js');require('./chunk-3L5AL3LU.js');require('./chunk-EI7MMDWY.js');exports.Erc20Service = _chunkN626SWPWjs.a;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3DW23AWTjs = require('./chunk-3DW23AWT.js');require('./chunk-U237PHUX.js');require('./chunk-YPXRNKFV.js');require('./chunk-EI7MMDWY.js');exports.Erc20Service = _chunk3DW23AWTjs.a;

@@ -1,1 +0,1 @@

import{a}from"./chunk-HHCIO3KF.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-ONF4HCCC.mjs";import"./chunk-YSXGDEY5.mjs";export{a as Erc20Service};
import{a}from"./chunk-32NP6XA5.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-7JSHDX4L.mjs";import"./chunk-YSXGDEY5.mjs";export{a as Erc20Service};

@@ -1,4 +0,4 @@

export { ChainSpecificToken, MODE, PEPE, Token, USDC, getTokensForNetwork } from './token.mjs';
export { ChainSpecificToken, MODE, PEPE, Token, USDC, WETH, getTokensForNetwork } from './token.mjs';
export { ERC20Plugin, ERC20PluginCtorParams, erc20 } from './erc20.plugin.mjs';
import '@goat-sdk/core';
import '@goat-sdk/wallet-evm';

@@ -1,4 +0,4 @@

export { ChainSpecificToken, MODE, PEPE, Token, USDC, getTokensForNetwork } from './token.js';
export { ChainSpecificToken, MODE, PEPE, Token, USDC, WETH, getTokensForNetwork } from './token.js';
export { ERC20Plugin, ERC20PluginCtorParams, erc20 } from './erc20.plugin.js';
import '@goat-sdk/core';
import '@goat-sdk/wallet-evm';

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNYKDPFBXjs = require('./chunk-NYKDPFBX.js');require('./chunk-N626SWPW.js');require('./chunk-U237PHUX.js');require('./chunk-3L5AL3LU.js');var _chunkZZVQA4J4js = require('./chunk-ZZVQA4J4.js');require('./chunk-EI7MMDWY.js');exports.ERC20Plugin = _chunkNYKDPFBXjs.a; exports.MODE = _chunkZZVQA4J4js.c; exports.PEPE = _chunkZZVQA4J4js.a; exports.USDC = _chunkZZVQA4J4js.b; exports.erc20 = _chunkNYKDPFBXjs.b; exports.getTokensForNetwork = _chunkZZVQA4J4js.d;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCP2PFXHWjs = require('./chunk-CP2PFXHW.js');require('./chunk-3DW23AWT.js');require('./chunk-U237PHUX.js');require('./chunk-YPXRNKFV.js');var _chunk7XPO6FH3js = require('./chunk-7XPO6FH3.js');require('./chunk-EI7MMDWY.js');exports.ERC20Plugin = _chunkCP2PFXHWjs.a; exports.MODE = _chunk7XPO6FH3js.c; exports.PEPE = _chunk7XPO6FH3js.a; exports.USDC = _chunk7XPO6FH3js.b; exports.WETH = _chunk7XPO6FH3js.d; exports.erc20 = _chunkCP2PFXHWjs.b; exports.getTokensForNetwork = _chunk7XPO6FH3js.e;

@@ -1,1 +0,1 @@

import{a as o,b as r}from"./chunk-OOTXVZEE.mjs";import"./chunk-HHCIO3KF.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-ONF4HCCC.mjs";import{a as e,b as f,c as m,d as p}from"./chunk-WTAZDWS6.mjs";import"./chunk-YSXGDEY5.mjs";export{o as ERC20Plugin,m as MODE,e as PEPE,f as USDC,r as erc20,p as getTokensForNetwork};
import{a as o,b as r}from"./chunk-BDIYMBEJ.mjs";import"./chunk-32NP6XA5.mjs";import"./chunk-LRPXRHNE.mjs";import"./chunk-7JSHDX4L.mjs";import{a as e,b as f,c as m,d as p,e as t}from"./chunk-Y2PY4F4H.mjs";import"./chunk-YSXGDEY5.mjs";export{o as ERC20Plugin,m as MODE,e as PEPE,f as USDC,p as WETH,r as erc20,t as getTokensForNetwork};

@@ -79,2 +79,14 @@ import * as _goat_sdk_core from '@goat-sdk/core';

}
declare const RevokeApprovalParameters_base: _goat_sdk_core.ToolParametersStatic<z.ZodObject<{
tokenAddress: z.ZodString;
spender: z.ZodString;
}, "strip", z.ZodTypeAny, {
spender: string;
tokenAddress: string;
}, {
spender: string;
tokenAddress: string;
}>>;
declare class RevokeApprovalParameters extends RevokeApprovalParameters_base {
}
declare const TransferFromParameters_base: _goat_sdk_core.ToolParametersStatic<z.ZodObject<{

@@ -123,2 +135,2 @@ tokenAddress: z.ZodString;

export { ApproveParameters, ConvertFromBaseUnitParameters, ConvertToBaseUnitParameters, GetTokenAllowanceParameters, GetTokenBalanceParameters, GetTokenInfoBySymbolParameters, GetTokenTotalSupplyParameters, TransferFromParameters, TransferParameters };
export { ApproveParameters, ConvertFromBaseUnitParameters, ConvertToBaseUnitParameters, GetTokenAllowanceParameters, GetTokenBalanceParameters, GetTokenInfoBySymbolParameters, GetTokenTotalSupplyParameters, RevokeApprovalParameters, TransferFromParameters, TransferParameters };

@@ -79,2 +79,14 @@ import * as _goat_sdk_core from '@goat-sdk/core';

}
declare const RevokeApprovalParameters_base: _goat_sdk_core.ToolParametersStatic<z.ZodObject<{
tokenAddress: z.ZodString;
spender: z.ZodString;
}, "strip", z.ZodTypeAny, {
spender: string;
tokenAddress: string;
}, {
spender: string;
tokenAddress: string;
}>>;
declare class RevokeApprovalParameters extends RevokeApprovalParameters_base {
}
declare const TransferFromParameters_base: _goat_sdk_core.ToolParametersStatic<z.ZodObject<{

@@ -123,2 +135,2 @@ tokenAddress: z.ZodString;

export { ApproveParameters, ConvertFromBaseUnitParameters, ConvertToBaseUnitParameters, GetTokenAllowanceParameters, GetTokenBalanceParameters, GetTokenInfoBySymbolParameters, GetTokenTotalSupplyParameters, TransferFromParameters, TransferParameters };
export { ApproveParameters, ConvertFromBaseUnitParameters, ConvertToBaseUnitParameters, GetTokenAllowanceParameters, GetTokenBalanceParameters, GetTokenInfoBySymbolParameters, GetTokenTotalSupplyParameters, RevokeApprovalParameters, TransferFromParameters, TransferParameters };

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3L5AL3LUjs = require('./chunk-3L5AL3LU.js');require('./chunk-EI7MMDWY.js');exports.ApproveParameters = _chunk3L5AL3LUjs.f; exports.ConvertFromBaseUnitParameters = _chunk3L5AL3LUjs.i; exports.ConvertToBaseUnitParameters = _chunk3L5AL3LUjs.h; exports.GetTokenAllowanceParameters = _chunk3L5AL3LUjs.e; exports.GetTokenBalanceParameters = _chunk3L5AL3LUjs.b; exports.GetTokenInfoBySymbolParameters = _chunk3L5AL3LUjs.a; exports.GetTokenTotalSupplyParameters = _chunk3L5AL3LUjs.d; exports.TransferFromParameters = _chunk3L5AL3LUjs.g; exports.TransferParameters = _chunk3L5AL3LUjs.c;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYPXRNKFVjs = require('./chunk-YPXRNKFV.js');require('./chunk-EI7MMDWY.js');exports.ApproveParameters = _chunkYPXRNKFVjs.f; exports.ConvertFromBaseUnitParameters = _chunkYPXRNKFVjs.j; exports.ConvertToBaseUnitParameters = _chunkYPXRNKFVjs.i; exports.GetTokenAllowanceParameters = _chunkYPXRNKFVjs.e; exports.GetTokenBalanceParameters = _chunkYPXRNKFVjs.b; exports.GetTokenInfoBySymbolParameters = _chunkYPXRNKFVjs.a; exports.GetTokenTotalSupplyParameters = _chunkYPXRNKFVjs.d; exports.RevokeApprovalParameters = _chunkYPXRNKFVjs.g; exports.TransferFromParameters = _chunkYPXRNKFVjs.h; exports.TransferParameters = _chunkYPXRNKFVjs.c;

@@ -1,1 +0,1 @@

import{a,b,c,d,e,f,g,h,i}from"./chunk-ONF4HCCC.mjs";import"./chunk-YSXGDEY5.mjs";export{f as ApproveParameters,i as ConvertFromBaseUnitParameters,h as ConvertToBaseUnitParameters,e as GetTokenAllowanceParameters,b as GetTokenBalanceParameters,a as GetTokenInfoBySymbolParameters,d as GetTokenTotalSupplyParameters,g as TransferFromParameters,c as TransferParameters};
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-7JSHDX4L.mjs";import"./chunk-YSXGDEY5.mjs";export{f as ApproveParameters,j as ConvertFromBaseUnitParameters,i as ConvertToBaseUnitParameters,e as GetTokenAllowanceParameters,b as GetTokenBalanceParameters,a as GetTokenInfoBySymbolParameters,d as GetTokenTotalSupplyParameters,g as RevokeApprovalParameters,h as TransferFromParameters,c as TransferParameters};

@@ -19,4 +19,5 @@ type Token = {

declare const MODE: Token;
declare const WETH: Token;
declare function getTokensForNetwork(chainId: number, tokens: Token[]): ChainSpecificToken[];
export { type ChainSpecificToken, MODE, PEPE, type Token, USDC, getTokensForNetwork };
export { type ChainSpecificToken, MODE, PEPE, type Token, USDC, WETH, getTokensForNetwork };

@@ -19,4 +19,5 @@ type Token = {

declare const MODE: Token;
declare const WETH: Token;
declare function getTokensForNetwork(chainId: number, tokens: Token[]): ChainSpecificToken[];
export { type ChainSpecificToken, MODE, PEPE, type Token, USDC, getTokensForNetwork };
export { type ChainSpecificToken, MODE, PEPE, type Token, USDC, WETH, getTokensForNetwork };

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZZVQA4J4js = require('./chunk-ZZVQA4J4.js');require('./chunk-EI7MMDWY.js');exports.MODE = _chunkZZVQA4J4js.c; exports.PEPE = _chunkZZVQA4J4js.a; exports.USDC = _chunkZZVQA4J4js.b; exports.getTokensForNetwork = _chunkZZVQA4J4js.d;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XPO6FH3js = require('./chunk-7XPO6FH3.js');require('./chunk-EI7MMDWY.js');exports.MODE = _chunk7XPO6FH3js.c; exports.PEPE = _chunk7XPO6FH3js.a; exports.USDC = _chunk7XPO6FH3js.b; exports.WETH = _chunk7XPO6FH3js.d; exports.getTokensForNetwork = _chunk7XPO6FH3js.e;

@@ -1,1 +0,1 @@

import{a,b,c,d}from"./chunk-WTAZDWS6.mjs";import"./chunk-YSXGDEY5.mjs";export{c as MODE,a as PEPE,b as USDC,d as getTokensForNetwork};
import{a,b,c,d,e}from"./chunk-Y2PY4F4H.mjs";import"./chunk-YSXGDEY5.mjs";export{c as MODE,a as PEPE,b as USDC,d as WETH,e as getTokensForNetwork};
{
"name": "@goat-sdk/plugin-erc20",
"version": "0.2.5",
"version": "0.2.6",
"files": [

@@ -16,8 +16,8 @@ "dist/**/*",

"zod": "3.23.8",
"@goat-sdk/core": "0.4.3",
"@goat-sdk/wallet-evm": "0.2.3"
"@goat-sdk/core": "0.4.4",
"@goat-sdk/wallet-evm": "0.2.4"
},
"peerDependencies": {
"viem": "2.21.49",
"@goat-sdk/core": "0.4.3"
"@goat-sdk/core": "0.4.4"
},

@@ -24,0 +24,0 @@ "homepage": "https://ohmygoat.dev",

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var _zod = require('zod');var n=class extends _core.createToolParameters.call(void 0, _zod.z.object({symbol:_zod.z.string().describe("The symbol of the token to get the info of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenInfoBySymbolParameters")}},r= exports.b =class extends _core.createToolParameters.call(void 0, _zod.z.object({wallet:_zod.z.string().describe("The address to get the balance of"),tokenAddress:_zod.z.string().describe("The address of the token to get the balance of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenBalanceParameters")}},d= exports.c =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to transfer"),to:_zod.z.string().describe("The address to transfer the token to"),amount:_zod.z.string().describe("The amount of tokens to transfer in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"TransferParameters")}},c= exports.d =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to get the total supply of")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenTotalSupplyParameters")}},i= exports.e =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to check the allowance of"),owner:_zod.z.string().describe("The address to check the allowance of"),spender:_zod.z.string().describe("The address to check the allowance for")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"GetTokenAllowanceParameters")}},a= exports.f =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to approve"),spender:_zod.z.string().describe("The address to approve the allowance to"),amount:_zod.z.string().describe("The amount of tokens to approve in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ApproveParameters")}},b= exports.g =class extends _core.createToolParameters.call(void 0, _zod.z.object({tokenAddress:_zod.z.string().describe("The address of the token to transfer"),from:_zod.z.string().describe("The address to transfer the token from"),to:_zod.z.string().describe("The address to transfer the token to"),amount:_zod.z.string().describe("The amount of tokens to transfer in base units")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"TransferFromParameters")}},h= exports.h =class extends _core.createToolParameters.call(void 0, _zod.z.object({amount:_zod.z.number().describe("The amount of tokens to convert from decimal units to base units"),decimals:_zod.z.number().describe("The number of decimals of the token")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ConvertToBaseUnitParameters")}},f= exports.i =class extends _core.createToolParameters.call(void 0, _zod.z.object({amount:_zod.z.number().describe("The amount of tokens to convert from base units to decimal units"),decimals:_zod.z.number().describe("The number of decimals of the token")})){static{_chunkEI7MMDWYjs.a.call(void 0, this,"ConvertFromBaseUnitParameters")}};exports.a = n; exports.b = r; exports.c = d; exports.d = c; exports.e = i; exports.f = a; exports.g = b; exports.h = h; exports.i = f;
import{a as u}from"./chunk-LRPXRHNE.mjs";import{a as m,b,c as h,d as g,e as w,f as T,g as k,h as v,i as A}from"./chunk-ONF4HCCC.mjs";import{a as l}from"./chunk-YSXGDEY5.mjs";import{Tool as c}from"@goat-sdk/core";import{EVMWalletClient as s}from"@goat-sdk/wallet-evm";function d(f,t,n,e){var r=arguments.length,a=r<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,n):e,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,t,n,e);else for(var y=f.length-1;y>=0;y--)(p=f[y])&&(a=(r<3?p(a):r>3?p(t,n,a):p(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}l(d,"_ts_decorate");function o(f,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(f,t)}l(o,"_ts_metadata");var i=class{static{l(this,"Erc20Service")}tokens;constructor({tokens:t}={}){this.tokens=t??[]}async getTokenInfoBySymbol(t,n){let e=this.tokens.find(p=>[p.symbol,p.symbol.toLowerCase()].includes(n.symbol));if(!e)throw Error(`Token with symbol ${n.symbol} not found`);let r=t.getChain(),a=e.chains[r.id]?.contractAddress;if(!a)throw Error(`Token with symbol ${n.symbol} not found on chain ${r.id}`);return{symbol:e?.symbol,contractAddress:a,decimals:e?.decimals,name:e?.name}}async getTokenBalance(t,n){try{let e=await t.resolveAddress(n.wallet),r=await t.read({address:n.tokenAddress,abi:u,functionName:"balanceOf",args:[e]});return Number(r.value)}catch(e){throw Error(`Failed to fetch balance: ${e}`)}}async transfer(t,n){try{let e=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:u,functionName:"transfer",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to transfer: ${e}`)}}async getTokenTotalSupply(t,n){try{return(await t.read({address:n.tokenAddress,abi:u,functionName:"totalSupply"})).value}catch(e){throw Error(`Failed to fetch total supply: ${e}`)}}async getTokenAllowance(t,n){try{let e=await t.resolveAddress(n.owner),r=await t.resolveAddress(n.spender),a=await t.read({address:n.tokenAddress,abi:u,functionName:"allowance",args:[e,r]});return Number(a.value)}catch(e){throw Error(`Failed to fetch allowance: ${e}`)}}async approve(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:u,functionName:"approve",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to approve: ${e}`)}}async transferFrom(t,n){try{let e=await t.resolveAddress(n.from),r=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:u,functionName:"transferFrom",args:[e,r,n.amount]})).hash}catch(e){throw Error(`Failed to transfer from: ${e}`)}}async convertToBaseUnit(t){let{amount:n,decimals:e}=t,r=n*10**e;return Number(r)}async convertFromBaseUnit(t){let{amount:n,decimals:e}=t,r=n/10**e;return Number(r)}};d([c({description:"Get the ERC20 token info by its symbol, including the contract address, decimals, and name"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof m>"u"?Object:m]),o("design:returntype",Promise)],i.prototype,"getTokenInfoBySymbol",null);d([c({description:"Get the balance of an ERC20 token in base units. Convert to decimal units before returning."}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof b>"u"?Object:b]),o("design:returntype",Promise)],i.prototype,"getTokenBalance",null);d([c({description:"Transfer an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof h>"u"?Object:h]),o("design:returntype",Promise)],i.prototype,"transfer",null);d([c({description:"Get the total supply of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof g>"u"?Object:g]),o("design:returntype",Promise)],i.prototype,"getTokenTotalSupply",null);d([c({description:"Get the allowance of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof w>"u"?Object:w]),o("design:returntype",Promise)],i.prototype,"getTokenAllowance",null);d([c({description:"Approve an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof T>"u"?Object:T]),o("design:returntype",Promise)],i.prototype,"approve",null);d([c({description:"Transfer an amount of an ERC20 token from an address to another address"}),o("design:type",Function),o("design:paramtypes",[typeof s>"u"?Object:s,typeof k>"u"?Object:k]),o("design:returntype",Promise)],i.prototype,"transferFrom",null);d([c({description:"Convert an amount of an ERC20 token to its base unit"}),o("design:type",Function),o("design:paramtypes",[typeof v>"u"?Object:v]),o("design:returntype",Promise)],i.prototype,"convertToBaseUnit",null);d([c({description:"Convert an amount of an ERC20 token from its base unit to its decimal unit"}),o("design:type",Function),o("design:paramtypes",[typeof A>"u"?Object:A]),o("design:returntype",Promise)],i.prototype,"convertFromBaseUnit",null);export{i as a};
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkU237PHUXjs = require('./chunk-U237PHUX.js');var _chunk3L5AL3LUjs = require('./chunk-3L5AL3LU.js');var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var _walletevm = require('@goat-sdk/wallet-evm');function d(f,t,n,e){var r=arguments.length,a=r<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,n):e,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,t,n,e);else for(var y=f.length-1;y>=0;y--)(p=f[y])&&(a=(r<3?p(a):r>3?p(t,n,a):p(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}_chunkEI7MMDWYjs.a.call(void 0, d,"_ts_decorate");function o(f,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(f,t)}_chunkEI7MMDWYjs.a.call(void 0, o,"_ts_metadata");var i=class{static{_chunkEI7MMDWYjs.a.call(void 0, this,"Erc20Service")}constructor({tokens:t}={}){this.tokens=_nullishCoalesce(t, () => ([]))}async getTokenInfoBySymbol(t,n){let e=this.tokens.find(p=>[p.symbol,p.symbol.toLowerCase()].includes(n.symbol));if(!e)throw Error(`Token with symbol ${n.symbol} not found`);let r=t.getChain(),a=_optionalChain([e, 'access', _ => _.chains, 'access', _2 => _2[r.id], 'optionalAccess', _3 => _3.contractAddress]);if(!a)throw Error(`Token with symbol ${n.symbol} not found on chain ${r.id}`);return{symbol:_optionalChain([e, 'optionalAccess', _4 => _4.symbol]),contractAddress:a,decimals:_optionalChain([e, 'optionalAccess', _5 => _5.decimals]),name:_optionalChain([e, 'optionalAccess', _6 => _6.name])}}async getTokenBalance(t,n){try{let e=await t.resolveAddress(n.wallet),r=await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"balanceOf",args:[e]});return Number(r.value)}catch(e){throw Error(`Failed to fetch balance: ${e}`)}}async transfer(t,n){try{let e=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"transfer",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to transfer: ${e}`)}}async getTokenTotalSupply(t,n){try{return(await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"totalSupply"})).value}catch(e){throw Error(`Failed to fetch total supply: ${e}`)}}async getTokenAllowance(t,n){try{let e=await t.resolveAddress(n.owner),r=await t.resolveAddress(n.spender),a=await t.read({address:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"allowance",args:[e,r]});return Number(a.value)}catch(e){throw Error(`Failed to fetch allowance: ${e}`)}}async approve(t,n){try{let e=await t.resolveAddress(n.spender);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"approve",args:[e,n.amount]})).hash}catch(e){throw Error(`Failed to approve: ${e}`)}}async transferFrom(t,n){try{let e=await t.resolveAddress(n.from),r=await t.resolveAddress(n.to);return(await t.sendTransaction({to:n.tokenAddress,abi:_chunkU237PHUXjs.a,functionName:"transferFrom",args:[e,r,n.amount]})).hash}catch(e){throw Error(`Failed to transfer from: ${e}`)}}async convertToBaseUnit(t){let{amount:n,decimals:e}=t,r=n*10**e;return Number(r)}async convertFromBaseUnit(t){let{amount:n,decimals:e}=t,r=n/10**e;return Number(r)}};d([_core.Tool.call(void 0, {description:"Get the ERC20 token info by its symbol, including the contract address, decimals, and name"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.a>"u"?Object:_chunk3L5AL3LUjs.a]),o("design:returntype",Promise)],i.prototype,"getTokenInfoBySymbol",null);d([_core.Tool.call(void 0, {description:"Get the balance of an ERC20 token in base units. Convert to decimal units before returning."}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.b>"u"?Object:_chunk3L5AL3LUjs.b]),o("design:returntype",Promise)],i.prototype,"getTokenBalance",null);d([_core.Tool.call(void 0, {description:"Transfer an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.c>"u"?Object:_chunk3L5AL3LUjs.c]),o("design:returntype",Promise)],i.prototype,"transfer",null);d([_core.Tool.call(void 0, {description:"Get the total supply of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.d>"u"?Object:_chunk3L5AL3LUjs.d]),o("design:returntype",Promise)],i.prototype,"getTokenTotalSupply",null);d([_core.Tool.call(void 0, {description:"Get the allowance of an ERC20 token"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.e>"u"?Object:_chunk3L5AL3LUjs.e]),o("design:returntype",Promise)],i.prototype,"getTokenAllowance",null);d([_core.Tool.call(void 0, {description:"Approve an amount of an ERC20 token to an address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.f>"u"?Object:_chunk3L5AL3LUjs.f]),o("design:returntype",Promise)],i.prototype,"approve",null);d([_core.Tool.call(void 0, {description:"Transfer an amount of an ERC20 token from an address to another address"}),o("design:type",Function),o("design:paramtypes",[typeof _walletevm.EVMWalletClient>"u"?Object:_walletevm.EVMWalletClient,typeof _chunk3L5AL3LUjs.g>"u"?Object:_chunk3L5AL3LUjs.g]),o("design:returntype",Promise)],i.prototype,"transferFrom",null);d([_core.Tool.call(void 0, {description:"Convert an amount of an ERC20 token to its base unit"}),o("design:type",Function),o("design:paramtypes",[typeof _chunk3L5AL3LUjs.h>"u"?Object:_chunk3L5AL3LUjs.h]),o("design:returntype",Promise)],i.prototype,"convertToBaseUnit",null);d([_core.Tool.call(void 0, {description:"Convert an amount of an ERC20 token from its base unit to its decimal unit"}),o("design:type",Function),o("design:paramtypes",[typeof _chunk3L5AL3LUjs.i>"u"?Object:_chunk3L5AL3LUjs.i]),o("design:returntype",Promise)],i.prototype,"convertFromBaseUnit",null);exports.a = i;
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;var _chunkN626SWPWjs = require('./chunk-N626SWPW.js');var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var _core = require('@goat-sdk/core');var t= (_class =class extends _core.PluginBase{static{_chunkEI7MMDWYjs.a.call(void 0, this,"ERC20Plugin")}constructor({tokens:e}){super("erc20",[new (0, _chunkN626SWPWjs.a)({tokens:e})]);_class.prototype.__init.call(this);}__init() {this.supportsChain=_chunkEI7MMDWYjs.a.call(void 0, e=>e.type==="evm","supportsChain")}}, _class);function m({tokens:o}){return new t({tokens:o})}_chunkEI7MMDWYjs.a.call(void 0, m,"erc20");exports.a = t; exports.b = m;
import{a as t}from"./chunk-YSXGDEY5.mjs";import{createToolParameters as s}from"@goat-sdk/core";import{z as e}from"zod";var n=class extends s(e.object({symbol:e.string().describe("The symbol of the token to get the info of")})){static{t(this,"GetTokenInfoBySymbolParameters")}},r=class extends s(e.object({wallet:e.string().describe("The address to get the balance of"),tokenAddress:e.string().describe("The address of the token to get the balance of")})){static{t(this,"GetTokenBalanceParameters")}},d=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to transfer"),to:e.string().describe("The address to transfer the token to"),amount:e.string().describe("The amount of tokens to transfer in base units")})){static{t(this,"TransferParameters")}},c=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to get the total supply of")})){static{t(this,"GetTokenTotalSupplyParameters")}},i=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to check the allowance of"),owner:e.string().describe("The address to check the allowance of"),spender:e.string().describe("The address to check the allowance for")})){static{t(this,"GetTokenAllowanceParameters")}},a=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to approve"),spender:e.string().describe("The address to approve the allowance to"),amount:e.string().describe("The amount of tokens to approve in base units")})){static{t(this,"ApproveParameters")}},b=class extends s(e.object({tokenAddress:e.string().describe("The address of the token to transfer"),from:e.string().describe("The address to transfer the token from"),to:e.string().describe("The address to transfer the token to"),amount:e.string().describe("The amount of tokens to transfer in base units")})){static{t(this,"TransferFromParameters")}},h=class extends s(e.object({amount:e.number().describe("The amount of tokens to convert from decimal units to base units"),decimals:e.number().describe("The number of decimals of the token")})){static{t(this,"ConvertToBaseUnitParameters")}},f=class extends s(e.object({amount:e.number().describe("The amount of tokens to convert from base units to decimal units"),decimals:e.number().describe("The number of decimals of the token")})){static{t(this,"ConvertFromBaseUnitParameters")}};export{n as a,r as b,d as c,c as d,i as e,a as f,b as g,h,f as i};
import{a as c}from"./chunk-HHCIO3KF.mjs";import{a as r}from"./chunk-YSXGDEY5.mjs";import{PluginBase as n}from"@goat-sdk/core";var t=class extends n{static{r(this,"ERC20Plugin")}constructor({tokens:e}){super("erc20",[new c({tokens:e})])}supportsChain=r(e=>e.type==="evm","supportsChain")};function u({tokens:o}){return new t({tokens:o})}r(u,"erc20");export{t as a,u as b};
import{a as t}from"./chunk-YSXGDEY5.mjs";var n={decimals:18,symbol:"PEPE",name:"Pepe",chains:{1:{contractAddress:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"},10:{contractAddress:"0xc1c167cc44f7923cd0062c4370df962f9ddb16f5"},8453:{contractAddress:"0xb4fde59a779991bfb6a52253b51947828b982be3"}}},b={decimals:6,symbol:"USDC",name:"USDC",chains:{1:{contractAddress:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"},10:{contractAddress:"0x0b2c639c533813f4aa9d7837caf62653d097ff85"},137:{contractAddress:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"},8453:{contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},84532:{contractAddress:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},11155111:{contractAddress:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"},34443:{contractAddress:"0xd988097fb8612cc24eeC14542bC03424c656005f"}}},f={decimals:18,symbol:"MODE",name:"Mode",chains:{34443:{contractAddress:"0xDfc7C877a950e49D2610114102175A06C2e3167a"}}};function C(e,a){let d=[];for(let c of a){let s=c.chains[e];s&&d.push({chainId:e,decimals:c.decimals,symbol:c.symbol,name:c.name,contractAddress:s.contractAddress})}return d}t(C,"getTokensForNetwork");export{n as a,b,f as c,C as d};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEI7MMDWYjs = require('./chunk-EI7MMDWY.js');var r={decimals:18,symbol:"PEPE",name:"Pepe",chains:{1:{contractAddress:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"},10:{contractAddress:"0xc1c167cc44f7923cd0062c4370df962f9ddb16f5"},8453:{contractAddress:"0xb4fde59a779991bfb6a52253b51947828b982be3"}}},n= exports.b ={decimals:6,symbol:"USDC",name:"USDC",chains:{1:{contractAddress:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"},10:{contractAddress:"0x0b2c639c533813f4aa9d7837caf62653d097ff85"},137:{contractAddress:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"},8453:{contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},84532:{contractAddress:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},11155111:{contractAddress:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"},34443:{contractAddress:"0xd988097fb8612cc24eeC14542bC03424c656005f"}}},b= exports.c ={decimals:18,symbol:"MODE",name:"Mode",chains:{34443:{contractAddress:"0xDfc7C877a950e49D2610114102175A06C2e3167a"}}};function f(e,a){let d=[];for(let c of a){let s=c.chains[e];s&&d.push({chainId:e,decimals:c.decimals,symbol:c.symbol,name:c.name,contractAddress:s.contractAddress})}return d}_chunkEI7MMDWYjs.a.call(void 0, f,"getTokensForNetwork");exports.a = r; exports.b = n; exports.c = b; exports.d = f;