reverse-mirage
Advanced tools
Comparing version 0.1.11 to 1.0.0-next.0
1513
dist/index.js
@@ -1,5 +0,2 @@ | ||
// src/erc20/reads.ts | ||
import "viem"; | ||
// src/amountUtils.ts | ||
// src/amount/utils.ts | ||
import invariant from "tiny-invariant"; | ||
@@ -69,2 +66,215 @@ import { parseUnits } from "viem/utils"; | ||
// src/native/utils.ts | ||
var createNativeCurrency = (name, symbol, decimals, chainID) => ({ | ||
type: "nativeCurrency", | ||
name, | ||
symbol, | ||
decimals, | ||
chainID | ||
}); | ||
// src/weth/utils.ts | ||
import { getAddress } from "viem"; | ||
var createWETH = (address, name, symbol, decimals, chainID, blockCreated = 0n) => ({ | ||
type: "weth", | ||
address: getAddress(address), | ||
name, | ||
symbol, | ||
decimals, | ||
chainID, | ||
blockCreated | ||
}); | ||
// src/chains/arbitrum.ts | ||
var arbitrumTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 42161), | ||
weth: createWETH( | ||
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
42161, | ||
55n | ||
) | ||
}; | ||
// src/chains/arbitrumGoerli.ts | ||
var arbitrumGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 421613), | ||
weth: createWETH( | ||
"0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
421613, | ||
16n | ||
) | ||
}; | ||
// src/chains/base.ts | ||
var baseTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 8453), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
8453 | ||
) | ||
}; | ||
// src/chains/baseGoerli.ts | ||
var baseGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 84531), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
84531 | ||
) | ||
}; | ||
// src/chains/celo.ts | ||
var celoTokens = { | ||
native: createNativeCurrency("Celo Native Asset", "CELO", 18, 42220), | ||
weth: createWETH( | ||
"0x471EcE3750Da237f93B8E339c536989b8978a438", | ||
"Celo Native Asset", | ||
"CELO", | ||
18, | ||
42220, | ||
2919n | ||
) | ||
}; | ||
// src/chains/celoAlfajores.ts | ||
var celoAlfajoresTokens = { | ||
native: createNativeCurrency("Celo Native Asset", "CELO", 18, 44787), | ||
weth: createWETH( | ||
"0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9", | ||
"Celo Native Asset", | ||
"CELO", | ||
18, | ||
44787 | ||
) | ||
}; | ||
// src/chains/foundry.ts | ||
var foundryTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 31337) | ||
}; | ||
// src/chains/goerli.ts | ||
var goerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 5), | ||
weth: createWETH( | ||
"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
5, | ||
1036651n | ||
) | ||
}; | ||
// src/chains/mainnet.ts | ||
var mainnetTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 1), | ||
weth: createWETH( | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
1, | ||
4719568n | ||
) | ||
}; | ||
// src/chains/optimism.ts | ||
var optimismTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 10), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
10 | ||
) | ||
}; | ||
// src/chains/optimismGoerli.ts | ||
var optimismGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 420), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
420 | ||
) | ||
}; | ||
// src/chains/sepolia.ts | ||
var sepoliaTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 11155111), | ||
weth: createWETH( | ||
"0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
11155111, | ||
3518216n | ||
) | ||
}; | ||
// src/erc20/utils.ts | ||
import { getAddress as getAddress2 } from "viem"; | ||
var createERC20 = (address, name, symbol, decimals, chainID, blockCreated = 0n) => ({ | ||
type: "erc20", | ||
address: getAddress2(address), | ||
name, | ||
symbol, | ||
decimals, | ||
chainID, | ||
blockCreated | ||
}); | ||
var createERC20Permit = (address, name, symbol, decimals, version, chainID, blockCreated = 0n) => ({ | ||
type: "erc20Permit", | ||
address: getAddress2(address), | ||
name, | ||
symbol, | ||
decimals, | ||
version, | ||
chainID, | ||
blockCreated | ||
}); | ||
var createERC20PermitDataFromString = (erc20Permit, amount, nonce) => ({ | ||
...createAmountFromString(erc20Permit, amount), | ||
type: `${erc20Permit.type}Data`, | ||
nonce | ||
}); | ||
var createERC20PermitDataFromFraction = (erc20Permit, amount, nonce) => ({ | ||
...createAmountFromFraction(erc20Permit, amount), | ||
type: `${erc20Permit.type}Data`, | ||
nonce | ||
}); | ||
var createERC20PermitDataFromRaw = (erc20Permit, amount, nonce) => ({ | ||
...createAmountFromRaw(erc20Permit, amount), | ||
type: `${erc20Permit.type}Data`, | ||
nonce | ||
}); | ||
var PermitType = { | ||
Permit: [ | ||
{ | ||
name: "owner", | ||
type: "address" | ||
}, | ||
{ name: "spender", type: "address" }, | ||
{ name: "value", type: "uint256" }, | ||
{ name: "nonce", type: "uint256" }, | ||
{ name: "deadline", type: "uint256" } | ||
] | ||
}; | ||
// src/generated.ts | ||
@@ -699,134 +909,178 @@ var weth9ABI = [ | ||
// src/erc20/utils.ts | ||
import { getAddress, hashTypedData } from "viem"; | ||
var createERC20 = (address, name, symbol, decimals, chainID, blockCreated = 0n) => ({ | ||
type: "erc20", | ||
address: getAddress(address), | ||
name, | ||
symbol, | ||
decimals, | ||
chainID, | ||
blockCreated | ||
}); | ||
var createERC20Permit = (address, name, symbol, decimals, version, chainID, blockCreated = 0n) => ({ | ||
type: "erc20Permit", | ||
address: getAddress(address), | ||
name, | ||
symbol, | ||
decimals, | ||
version, | ||
chainID, | ||
blockCreated | ||
}); | ||
var createERC20PermitDataFromString = (erc20Permit2, amount, nonce) => ({ | ||
...createAmountFromString(erc20Permit2, amount), | ||
type: `${erc20Permit2.type}Data`, | ||
nonce | ||
}); | ||
var createERC20PermitDataFromFraction = (erc20Permit2, amount, nonce) => ({ | ||
...createAmountFromFraction(erc20Permit2, amount), | ||
type: `${erc20Permit2.type}Data`, | ||
nonce | ||
}); | ||
var createERC20PermitDataFromRaw = (erc20Permit2, amount, nonce) => ({ | ||
...createAmountFromRaw(erc20Permit2, amount), | ||
type: `${erc20Permit2.type}Data`, | ||
nonce | ||
}); | ||
var PermitType = { | ||
Permit: [ | ||
{ | ||
name: "owner", | ||
type: "address" | ||
}, | ||
{ name: "spender", type: "address" }, | ||
{ name: "value", type: "uint256" }, | ||
{ name: "nonce", type: "uint256" }, | ||
{ name: "deadline", type: "uint256" } | ||
] | ||
// src/erc20/publicActions/getERC20Decimals.ts | ||
import { readContract } from "viem/contract"; | ||
var getERC20Decimals = (client, args, type) => type === void 0 ? readContract(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "decimals" | ||
}) : { | ||
read: () => readContract(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "decimals" | ||
}), | ||
parse: (data) => data | ||
}; | ||
var erc20PermitTypedDataHash = (permit) => { | ||
const domain = { | ||
name: permit.amount.token.name, | ||
version: permit.amount.token.version, | ||
chainId: permit.amount.token.chainID, | ||
verifyingContract: permit.amount.token.address | ||
}; | ||
return hashTypedData({ | ||
domain, | ||
types: PermitType, | ||
primaryType: "Permit", | ||
message: { | ||
owner: permit.owner, | ||
spender: permit.spender, | ||
value: permit.amount.amount, | ||
nonce: permit.amount.nonce, | ||
deadline: permit.deadline | ||
} | ||
}); | ||
// src/erc20/publicActions/getERC20Name.ts | ||
import { readContract as readContract2 } from "viem/contract"; | ||
var getERC20Name = (client, args, type) => type === void 0 ? readContract2(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "name" | ||
}) : { | ||
read: () => readContract2(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "name" | ||
}), | ||
parse: (data) => data | ||
}; | ||
// src/erc20/reads.ts | ||
var erc20BalanceOf = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
// src/erc20/publicActions/getERC20Symbol.ts | ||
import { readContract as readContract3 } from "viem/contract"; | ||
var getERC20Symbol = (client, args, type) => type === void 0 ? readContract3(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "symbol" | ||
}) : { | ||
read: () => readContract3(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "balanceOf", | ||
args: [args.address] | ||
functionName: "symbol" | ||
}), | ||
parse: (data) => createAmountFromRaw(args.erc20, data) | ||
}); | ||
var erc20Allowance = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
parse: (data) => data | ||
}; | ||
// src/erc20/publicActions/getERC20.ts | ||
var getERC20 = (client, args, type) => type === void 0 ? Promise.all([ | ||
getERC20Name(client, args), | ||
getERC20Symbol(client, args), | ||
getERC20Decimals(client, args) | ||
]).then( | ||
([name, symbol, decimals]) => createERC20( | ||
args.erc20.address, | ||
name, | ||
symbol, | ||
decimals, | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
) : { | ||
read: () => Promise.all([ | ||
getERC20Name(client, args, "select").read(), | ||
getERC20Symbol(client, args, "select").read(), | ||
getERC20Decimals(client, args, "select").read() | ||
]), | ||
parse: ([name, symbol, decimals]) => createERC20( | ||
args.erc20.address, | ||
name, | ||
symbol, | ||
decimals, | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
}; | ||
// src/erc20/publicActions/getERC20Allowance.ts | ||
import { readContract as readContract4 } from "viem/contract"; | ||
var getERC20Allowance = (client, args, type) => type === void 0 ? readContract4(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "allowance", | ||
args: [args.owner, args.spender] | ||
}).then((data) => createAmountFromRaw(args.erc20, data)) : { | ||
read: () => readContract4(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "allowance", | ||
args: [args.address, args.spender] | ||
args: [args.owner, args.spender] | ||
}), | ||
parse: (data) => createAmountFromRaw(args.erc20, data) | ||
}); | ||
var erc20TotalSupply = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc20/publicActions/getERC20BalanceOf.ts | ||
import { readContract as readContract5 } from "viem/contract"; | ||
var getERC20BalanceOf = (client, args, type) => type === void 0 ? readContract5(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "balanceOf", | ||
args: [args.address] | ||
}).then((data) => createAmountFromRaw(args.erc20, data)) : { | ||
read: () => readContract5(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "totalSupply" | ||
functionName: "balanceOf", | ||
args: [args.address] | ||
}), | ||
parse: (data) => createAmountFromRaw(args.erc20, data) | ||
}); | ||
var erc20Name = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc20/publicActions/getERC20DomainSeparator.ts | ||
import { readContract as readContract6 } from "viem/contract"; | ||
var getERC20DomainSeparator = (client, args, type) => type === void 0 ? readContract6(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "DOMAIN_SEPARATOR" | ||
}) : { | ||
read: () => readContract6(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "name" | ||
functionName: "DOMAIN_SEPARATOR" | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc20Symbol = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc20/publicActions/getERC20Permit.ts | ||
var getERC20Permit = (client, args, type) => type === void 0 ? Promise.all([ | ||
getERC20Name(client, args), | ||
getERC20Symbol(client, args), | ||
getERC20Decimals(client, args) | ||
]).then( | ||
([name, symbol, decimals]) => createERC20Permit( | ||
args.erc20.address, | ||
name, | ||
symbol, | ||
decimals, | ||
args.erc20.version ?? "1", | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
) : { | ||
read: () => Promise.all([ | ||
getERC20Name(client, args, "select").read(), | ||
getERC20Symbol(client, args, "select").read(), | ||
getERC20Decimals(client, args, "select").read() | ||
]), | ||
parse: ([name, symbol, decimals]) => createERC20Permit( | ||
args.erc20.address, | ||
name, | ||
symbol, | ||
decimals, | ||
args.erc20.version ?? "1", | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
}; | ||
// src/erc20/publicActions/getERC20PermitData.ts | ||
import { readContract as readContract7 } from "viem/contract"; | ||
var getERC20PermitData = (client, args, type) => type === void 0 ? Promise.all([ | ||
readContract7(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "symbol" | ||
functionName: "balanceOf", | ||
args: [args.address] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc20Decimals = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
readContract7(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "decimals" | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc20PermitNonce = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "nonces", | ||
args: [args.address] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc20PermitData = (args) => ({ | ||
read: (publicClient) => Promise.all([ | ||
publicClient.readContract({ | ||
}) | ||
]).then( | ||
([balance, nonce]) => createERC20PermitDataFromRaw(args.erc20, balance, nonce) | ||
) : { | ||
read: () => Promise.all([ | ||
readContract7(client, { | ||
abi: solmateErc20ABI, | ||
@@ -837,3 +1091,3 @@ address: args.erc20.address, | ||
}), | ||
publicClient.readContract({ | ||
readContract7(client, { | ||
abi: solmateErc20ABI, | ||
@@ -845,52 +1099,50 @@ address: args.erc20.address, | ||
]), | ||
parse: (data) => createERC20PermitDataFromRaw(args.erc20, data[0], data[1]) | ||
}); | ||
var erc20PermitDomainSeparator = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
parse: ([balance, nonce]) => createERC20PermitDataFromRaw(args.erc20, balance, nonce) | ||
}; | ||
// src/erc20/publicActions/getERC20PermitNonce.ts | ||
import { readContract as readContract8 } from "viem/contract"; | ||
var getERC20PermitNonce = (client, args, type) => type === void 0 ? readContract8(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "nonces", | ||
args: [args.address] | ||
}) : { | ||
read: () => readContract8(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "DOMAIN_SEPARATOR" | ||
functionName: "nonces", | ||
args: [args.address] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var getERC20 = (args) => ({ | ||
read: (publicClient) => Promise.all([ | ||
erc20Name(args).read(publicClient), | ||
erc20Symbol(args).read(publicClient), | ||
erc20Decimals(args).read(publicClient) | ||
]), | ||
parse: (data) => createERC20( | ||
args.erc20.address, | ||
data[0], | ||
data[1], | ||
data[2], | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
}); | ||
var getERC20Permit = (args) => ({ | ||
read: (publicClient) => Promise.all([ | ||
erc20Name(args).read(publicClient), | ||
erc20Symbol(args).read(publicClient), | ||
erc20Decimals(args).read(publicClient) | ||
]), | ||
parse: (data) => createERC20Permit( | ||
args.erc20.address, | ||
data[0], | ||
data[1], | ||
data[2], | ||
args.erc20.version ?? "1", | ||
args.erc20.chainID, | ||
args.erc20.blockCreated | ||
) | ||
}); | ||
var erc20IsPermit = (args) => ({ | ||
read: async (publicClient) => { | ||
}; | ||
// src/erc20/publicActions/getERC20TotalSupply.ts | ||
import { readContract as readContract9 } from "viem/contract"; | ||
var getERC20TotalSupply = (client, args, type) => type === void 0 ? readContract9(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "totalSupply" | ||
}).then((data) => createAmountFromRaw(args.erc20, data)) : { | ||
read: () => readContract9(client, { | ||
abi: solmateErc20ABI, | ||
address: args.erc20.address, | ||
functionName: "totalSupply" | ||
}), | ||
parse: (data) => createAmountFromRaw(args.erc20, data) | ||
}; | ||
// src/erc20/publicActions/getIsERC20Permit.ts | ||
var getIsERC20Permit = (client, args, type) => type === void 0 ? Promise.all([ | ||
getERC20Permit(client, args), | ||
getERC20DomainSeparator(client, args) | ||
]).then(([erc20]) => erc20).catch(() => getERC20(client, args)) : { | ||
read: async () => { | ||
try { | ||
return await Promise.all([ | ||
getERC20(args).read(publicClient), | ||
erc20PermitDomainSeparator(args).read(publicClient) | ||
getERC20Permit(client, args, "select").read(), | ||
getERC20DomainSeparator(client, args, "select").read() | ||
]); | ||
} catch { | ||
return await Promise.all([getERC20(args).read(publicClient)]); | ||
return await Promise.all([getERC20(client, args, "select").read()]); | ||
} | ||
@@ -914,95 +1166,99 @@ }, | ||
) | ||
}); | ||
}; | ||
// src/erc20/writes.ts | ||
import invariant2 from "tiny-invariant"; | ||
// src/erc20/walletActions/signERC20Permit.ts | ||
import { | ||
getAddress as getAddress2 | ||
getAddress as getAddress3 | ||
} from "viem"; | ||
var erc20Transfer = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "transfer", | ||
args: [args.to, args.amount.amount], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc20Approve = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "approve", | ||
args: [args.spender, args.amount.amount], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc20TransferFrom = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "transferFrom", | ||
args: [args.from, args.to, args.amount.amount], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc20SignPermit = async (walletClient, account, permit) => { | ||
import { signTypedData } from "viem/actions"; | ||
var signERC20Permit = (client, { | ||
permitData, | ||
spender, | ||
deadline, | ||
account = client.account | ||
}) => { | ||
const domain = { | ||
name: permit.permitData.token.name, | ||
version: permit.permitData.token.version, | ||
chainId: permit.permitData.token.chainID, | ||
verifyingContract: getAddress2(permit.permitData.token.address) | ||
name: permitData.token.name, | ||
version: permitData.token.version, | ||
chainId: permitData.token.chainID, | ||
verifyingContract: getAddress3(permitData.token.address) | ||
}; | ||
return walletClient.signTypedData({ | ||
const owner = client.account?.address ?? (typeof account === "object" ? account.address : account); | ||
return signTypedData(client, { | ||
domain, | ||
account, | ||
types: PermitType, | ||
primaryType: "Permit", | ||
message: { | ||
owner: permit.owner, | ||
spender: permit.spender, | ||
value: permit.permitData.amount, | ||
deadline: permit.deadline, | ||
nonce: permit.permitData.nonce | ||
} | ||
owner, | ||
spender, | ||
value: permitData.amount, | ||
deadline, | ||
nonce: permitData.nonce | ||
}, | ||
account | ||
}); | ||
}; | ||
var erc20Permit = async (publicClient, walletClient, account, args) => { | ||
invariant2(args.signature.length === 132, "Invalid signature length"); | ||
const r = `0x${args.signature.substring(2, 2 + 64)}`; | ||
const s = `0x${args.signature.substring(2 + 64, 2 + 64 + 64)}`; | ||
const v = Number(`0x${args.signature.substring(2 + 64 + 64)}`); | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.permitData.token.address, | ||
// src/erc20/walletActions/simulateERC20Approve.ts | ||
import { simulateContract } from "viem/contract"; | ||
var simulateERC20Approve = (client, { | ||
args: { amount, spender }, | ||
...request | ||
}) => simulateContract(client, { | ||
address: amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "approve", | ||
args: [spender, amount.amount], | ||
...request | ||
}); | ||
// src/erc20/walletActions/simulateERC20Permit.ts | ||
import { simulateContract as simulateContract2 } from "viem/contract"; | ||
var simulateERC20Permit = (client, { | ||
args: { owner, spender, signature, permitData, deadline }, | ||
...request | ||
}) => { | ||
const r = `0x${signature.substring(2, 2 + 64)}`; | ||
const s = `0x${signature.substring(2 + 64, 2 + 64 + 64)}`; | ||
const v = Number(`0x${signature.substring(2 + 64 + 64)}`); | ||
return simulateContract2(client, { | ||
address: permitData.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "permit", | ||
args: [ | ||
args.owner, | ||
args.spender, | ||
args.permitData.amount, | ||
args.deadline, | ||
v, | ||
r, | ||
s | ||
], | ||
account | ||
args: [owner, spender, permitData.amount, deadline, v, r, s], | ||
...request | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
// src/erc721/reads.ts | ||
import { getAddress as getAddress4 } from "viem"; | ||
// src/erc20/walletActions/simulateERC20Transfer.ts | ||
import { simulateContract as simulateContract3 } from "viem/contract"; | ||
var simulateERC20Transfer = (client, { | ||
args: { amount, to }, | ||
...request | ||
}) => simulateContract3(client, { | ||
address: amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "transfer", | ||
args: [to, amount.amount], | ||
...request | ||
}); | ||
// src/erc20/walletActions/simulateERC20TransferFrom.ts | ||
import { simulateContract as simulateContract4 } from "viem/contract"; | ||
var simulateERC20TransferFrom = (client, { | ||
args: { amount, from, to }, | ||
...request | ||
}) => simulateContract4(client, { | ||
address: amount.token.address, | ||
abi: solmateErc20ABI, | ||
functionName: "transferFrom", | ||
args: [from, to, amount.amount], | ||
...request | ||
}); | ||
// src/erc721/utils.ts | ||
import { getAddress as getAddress3 } from "viem"; | ||
import { getAddress as getAddress4 } from "viem"; | ||
var createERC721 = (address, name, symbol, id, tokenURI, chainID, blockCreated = 0n) => ({ | ||
type: "erc721", | ||
address: getAddress3(address), | ||
address: getAddress4(address), | ||
name, | ||
@@ -1027,5 +1283,10 @@ symbol, | ||
// src/erc721/reads.ts | ||
var erc721Name = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
// src/erc721/publicActions/getERC721Name.ts | ||
import { readContract as readContract10 } from "viem/contract"; | ||
var getERC721Name = (client, args, type) => type === void 0 ? readContract10(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "name" | ||
}) : { | ||
read: () => readContract10(client, { | ||
abi: solmateErc721ABI, | ||
@@ -1036,5 +1297,12 @@ address: args.erc721.address, | ||
parse: (data) => data | ||
}); | ||
var erc721Symbol = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721Symbol.ts | ||
import { readContract as readContract11 } from "viem/contract"; | ||
var getERC721Symbol = (client, args, type) => type === void 0 ? readContract11(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "symbol" | ||
}) : { | ||
read: () => readContract11(client, { | ||
abi: solmateErc721ABI, | ||
@@ -1045,5 +1313,13 @@ address: args.erc721.address, | ||
parse: (data) => data | ||
}); | ||
var erc721TokenURI = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721TokenURI.ts | ||
import { readContract as readContract12 } from "viem/contract"; | ||
var getERC721TokenURI = (client, args, type) => type === void 0 ? readContract12(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "tokenURI", | ||
args: [args.erc721.id] | ||
}) : { | ||
read: () => readContract12(client, { | ||
abi: solmateErc721ABI, | ||
@@ -1055,32 +1331,110 @@ address: args.erc721.address, | ||
parse: (data) => data | ||
}); | ||
var erc721OwnerOf = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721.ts | ||
var getERC721 = (client, args, type) => type === void 0 ? Promise.all([ | ||
getERC721Name(client, args), | ||
getERC721Symbol(client, args), | ||
getERC721TokenURI(client, args) | ||
]).then( | ||
([name, symbol, tokenURI]) => createERC721( | ||
args.erc721.address, | ||
name, | ||
symbol, | ||
args.erc721.id, | ||
tokenURI, | ||
args.erc721.chainID, | ||
args.blockNumber | ||
) | ||
) : { | ||
read: () => Promise.all([ | ||
getERC721Name(client, args, "select").read(), | ||
getERC721Symbol(client, args, "select").read(), | ||
getERC721TokenURI(client, args, "select").read() | ||
]), | ||
parse: ([name, symbol, tokenURI]) => createERC721( | ||
args.erc721.address, | ||
name, | ||
symbol, | ||
args.erc721.id, | ||
tokenURI, | ||
args.erc721.chainID, | ||
args.blockNumber | ||
) | ||
}; | ||
// src/erc721/publicActions/getERC721Approved.ts | ||
import { readContract as readContract13 } from "viem/contract"; | ||
var getERC721Approved = (client, args, type) => type === void 0 ? readContract13(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "getApproved", | ||
args: [args.erc721.id] | ||
}) : { | ||
read: () => readContract13(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "ownerOf", | ||
functionName: "getApproved", | ||
args: [args.erc721.id] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc721BalanceOf = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721BalanceOf.ts | ||
import { readContract as readContract14 } from "viem/contract"; | ||
var getERC721BalanceOf = (client, args, type) => type === void 0 ? readContract14(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "balanceOf", | ||
args: [args.address] | ||
}) : { | ||
read: () => readContract14(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "balanceOf", | ||
args: [args.owner] | ||
args: [args.address] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc721GetApproved = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721Data.ts | ||
var getERC721Data = (client, args, type) => type === void 0 ? getERC721BalanceOf(client, args).then((data) => { | ||
if (data > Number.MAX_SAFE_INTEGER) | ||
throw Error("balance exceeds maximum representable number"); | ||
return createERC721Data(args.erc721, Number(data)); | ||
}) : { | ||
read: () => getERC721BalanceOf(client, args, "select").read(), | ||
parse: (data) => { | ||
if (data > Number.MAX_SAFE_INTEGER) | ||
throw Error("balance exceeds maximum representable number"); | ||
return createERC721Data(args.erc721, Number(data)); | ||
} | ||
}; | ||
// src/erc721/publicActions/getERC721IDData.ts | ||
import { readContract as readContract15 } from "viem/contract"; | ||
var getERC721IDData = (client, args, type) => type === void 0 ? readContract15(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "ownerOf", | ||
args: [args.erc721.id] | ||
}).then((data) => data === args.address) : { | ||
read: () => readContract15(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "getApproved", | ||
functionName: "ownerOf", | ||
args: [args.erc721.id] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc721IsApprovedForAll = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
parse: (data) => data === args.address | ||
}; | ||
// src/erc721/publicActions/getERC721IsApprovedForAll.ts | ||
import { readContract as readContract16 } from "viem/contract"; | ||
var getERC721IsApprovedForAll = (client, args, type) => type === void 0 ? readContract16(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "isApprovedForAll", | ||
args: [args.owner, args.spender] | ||
}) : { | ||
read: () => readContract16(client, { | ||
abi: solmateErc721ABI, | ||
@@ -1092,7 +1446,32 @@ address: args.erc721.address, | ||
parse: (data) => data | ||
}); | ||
var erc721SupportsInterface = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc721/publicActions/getERC721OwnerOf.ts | ||
import { readContract as readContract17 } from "viem/contract"; | ||
var getERC721OwnerOf = (client, args, type) => type === void 0 ? readContract17(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "ownerOf", | ||
args: [args.erc721.id] | ||
}) : { | ||
read: () => readContract17(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "ownerOf", | ||
args: [args.erc721.id] | ||
}), | ||
parse: (data) => data | ||
}; | ||
// src/erc721/publicActions/getERC721SupportsInterface.ts | ||
import { readContract as readContract18 } from "viem/contract"; | ||
var getERC721SupportsInterface = (client, args, type) => type === void 0 ? readContract18(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "supportsInterface", | ||
args: [args.interfaceID] | ||
}) : { | ||
read: () => readContract18(client, { | ||
abi: solmateErc721ABI, | ||
address: args.erc721.address, | ||
functionName: "supportsInterface", | ||
@@ -1102,92 +1481,68 @@ args: [args.interfaceID] | ||
parse: (data) => data | ||
}; | ||
// src/erc721/walletActions/simulateERC721Transfer.ts | ||
import { simulateContract as simulateContract5 } from "viem/contract"; | ||
var simulateERC721Transfer = (client, { | ||
args: { erc721, from, to, data }, | ||
...request | ||
}) => data === void 0 ? simulateContract5(client, { | ||
address: erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "transferFrom", | ||
args: [ | ||
from ?? client.account?.address ?? (typeof request.account === "object" ? request.account.address : request.account), | ||
to, | ||
erc721.id | ||
], | ||
...request | ||
}) : data === "safe" ? simulateContract5(client, { | ||
address: erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "safeTransferFrom", | ||
args: [ | ||
from ?? client.account?.address ?? (typeof request.account === "object" ? request.account.address : request.account), | ||
to, | ||
erc721.id | ||
], | ||
...request | ||
}) : simulateContract5(client, { | ||
address: erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "safeTransferFrom", | ||
args: [ | ||
from ?? client.account?.address ?? (typeof request.account === "object" ? request.account.address : request.account), | ||
to, | ||
erc721.id, | ||
data | ||
], | ||
...request | ||
}); | ||
var getERC721 = (args) => ({ | ||
read: (publicClient) => Promise.all([ | ||
erc721Name(args).read(publicClient), | ||
erc721Symbol(args).read(publicClient), | ||
erc721TokenURI(args).read(publicClient) | ||
]), | ||
parse: (data) => createERC721( | ||
args.erc721.address, | ||
data[0], | ||
data[1], | ||
args.erc721.id, | ||
data[2], | ||
args.erc721.chainID, | ||
args.erc721.blockCreated | ||
) | ||
// src/erc721/walletActions/simulateERC721Approve.ts | ||
import { simulateContract as simulateContract6 } from "viem/contract"; | ||
var simulateERC721Approve = (client, { | ||
args: { erc721, spender }, | ||
...request | ||
}) => simulateContract6(client, { | ||
address: erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "approve", | ||
args: [spender, erc721.id], | ||
...request | ||
}); | ||
var erc721IDData = (args) => ({ | ||
read: (publicClient) => erc721OwnerOf({ erc721: args.erc721 }).read(publicClient), | ||
parse: (data) => createERC721IDData( | ||
args.erc721, | ||
getAddress4(data) === getAddress4(args.owner) | ||
) | ||
// src/erc721/walletActions/simulateERC721SetApprovalForAll.ts | ||
import { simulateContract as simulateContract7 } from "viem/contract"; | ||
var simulateERC721SetApprovalForAll = (client, { | ||
args: { erc721, spender, approved }, | ||
...request | ||
}) => simulateContract7(client, { | ||
address: erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "setApprovalForAll", | ||
args: [spender, approved], | ||
...request | ||
}); | ||
var erc721Data = (args) => ({ | ||
read: (publicClient) => erc721BalanceOf(args).read(publicClient), | ||
parse: (data) => { | ||
if (data > Number.MAX_SAFE_INTEGER) | ||
throw Error("balance exceeds maximum representable number"); | ||
return createERC721Data(args.erc721, Number(data)); | ||
} | ||
}); | ||
// src/erc721/writes.ts | ||
var erc721Transfer = async (publicClient, walletClient, account, args) => { | ||
if (args.data === void 0) { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "transferFrom", | ||
args: [args.from, args.to, args.erc721.id], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
} else if (args.data === "safe") { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "safeTransferFrom", | ||
args: [args.from, args.to, args.erc721.id], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
} else { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "safeTransferFrom", | ||
args: [args.from, args.to, args.erc721.id, args.data], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
} | ||
}; | ||
var erc721Approve = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "approve", | ||
args: [args.spender, args.erc721.id], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc721SetApprovalForAll = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc721.address, | ||
abi: solmateErc721ABI, | ||
functionName: "setApprovalForAll", | ||
args: [args.spender, args.approved], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
// src/erc1155/utils.ts | ||
@@ -1209,80 +1564,113 @@ import { getAddress as getAddress5 } from "viem"; | ||
// src/erc1155/reads.ts | ||
var erc1155IsApprovedForAll = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
// src/erc1155/publicActions/getERC1155.ts | ||
import { readContract as readContract19 } from "viem/contract"; | ||
var getERC1155 = (client, args, type) => type === void 0 ? readContract19(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "uri", | ||
args: [args.erc1155.id] | ||
}).then( | ||
(data) => createERC1155( | ||
args.erc1155.address, | ||
args.erc1155.id, | ||
data, | ||
args.erc1155.chainID, | ||
args.blockNumber | ||
) | ||
) : { | ||
read: () => readContract19(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "isApprovedForAll", | ||
args: [args.owner, args.spender] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc1155URI = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "uri", | ||
args: [args.erc1155.id] | ||
}), | ||
parse: (data) => data | ||
}); | ||
var erc1155BalanceOf = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
parse: (data) => createERC1155( | ||
args.erc1155.address, | ||
args.erc1155.id, | ||
data, | ||
args.erc1155.chainID, | ||
args.blockNumber | ||
) | ||
}; | ||
// src/erc1155/publicActions/getERC1155BalanceOf.ts | ||
import { readContract as readContract20 } from "viem/contract"; | ||
var getERC1155BalanceOf = (client, args, type) => type === void 0 ? readContract20(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "balanceOf", | ||
args: [args.address, args.erc1155.id] | ||
}).then((data) => createERC1155Data(args.erc1155, data)) : { | ||
read: () => readContract20(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "balanceOf", | ||
args: [args.owner, args.erc1155.id] | ||
args: [args.address, args.erc1155.id] | ||
}), | ||
parse: (data) => createERC1155Data(args.erc1155, data) | ||
}); | ||
var getERC1155 = (args) => ({ | ||
read: (publicClient) => publicClient.readContract({ | ||
}; | ||
// src/erc1155/publicActions/getERC1155IsApprovedForAll.ts | ||
import { readContract as readContract21 } from "viem/contract"; | ||
var getERC1155IsApprovedForAll = (client, args, type) => type === void 0 ? readContract21(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "isApprovedForAll", | ||
args: [args.owner, args.spender] | ||
}) : { | ||
read: () => readContract21(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "isApprovedForAll", | ||
args: [args.owner, args.spender] | ||
}), | ||
parse: (data) => data | ||
}; | ||
// src/erc1155/publicActions/getERC1155URI.ts | ||
import { readContract as readContract22 } from "viem/contract"; | ||
var getERC1155URI = (client, args, type) => type === void 0 ? readContract22(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "uri", | ||
args: [args.erc1155.id] | ||
}) : { | ||
read: () => readContract22(client, { | ||
abi: solmateErc1155ABI, | ||
address: args.erc1155.address, | ||
functionName: "uri", | ||
args: [args.erc1155.id] | ||
}), | ||
parse: (data) => createERC1155( | ||
args.erc1155.address, | ||
args.erc1155.id, | ||
data, | ||
args.erc1155.chainID, | ||
args.erc1155.blockCreated | ||
) | ||
parse: (data) => data | ||
}; | ||
// src/erc1155/walletActions/simulateERC1155Transfer.ts | ||
import { simulateContract as simulateContract8 } from "viem/contract"; | ||
var simulateERC1155Transfer = (client, { | ||
args: { erc1155Data, to, from, data }, | ||
...request | ||
}) => simulateContract8(client, { | ||
address: erc1155Data.token.address, | ||
abi: solmateErc1155ABI, | ||
functionName: "safeTransferFrom", | ||
args: [ | ||
from ?? client.account?.address ?? (typeof request.account === "object" ? request.account.address : request.account), | ||
to, | ||
erc1155Data.token.id, | ||
erc1155Data.amount, | ||
data ?? "0x" | ||
], | ||
...request | ||
}); | ||
// src/erc1155/writes.ts | ||
// src/erc1155/walletActions/simulateERC1155TransferBatch.ts | ||
import { | ||
getAddress as getAddress6 | ||
} from "viem"; | ||
var erc1155SetApprovalForAll = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc1155.address, | ||
abi: solmateErc1155ABI, | ||
functionName: "setApprovalForAll", | ||
args: [args.spender, args.approved], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc1155Transfer = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.erc1155.token.address, | ||
abi: solmateErc1155ABI, | ||
functionName: "safeTransferFrom", | ||
args: [ | ||
args.from, | ||
args.to, | ||
args.erc1155.token.id, | ||
args.erc1155.amount, | ||
args.data ?? "0x" | ||
], | ||
account | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var erc1155TransferBatch = async (publicClient, walletClient, account, args) => { | ||
const address = args.erc1155.reduce((addr, cur) => { | ||
import { simulateContract as simulateContract9 } from "viem/contract"; | ||
var simulateERC1155TransferBatch = (client, { | ||
args: { erc1155Data, to, from, data }, | ||
...request | ||
}) => { | ||
const address = erc1155Data.reduce((addr, cur) => { | ||
if (addr === void 0) | ||
@@ -1297,3 +1685,3 @@ return getAddress6(cur.token.address); | ||
throw Error("No tokens passed to transfer"); | ||
const { request, result } = await publicClient.simulateContract({ | ||
return simulateContract9(client, { | ||
address, | ||
@@ -1303,76 +1691,31 @@ abi: solmateErc1155ABI, | ||
args: [ | ||
args.from, | ||
args.to, | ||
args.erc1155.map((t) => t.token.id), | ||
args.erc1155.map((t) => t.amount), | ||
args.data ?? "0x" | ||
from ?? client.account?.address ?? (typeof request.account === "object" ? request.account.address : request.account), | ||
to, | ||
erc1155Data.map((t) => t.token.id), | ||
erc1155Data.map((t) => t.amount), | ||
data ?? "0x" | ||
], | ||
account | ||
...request | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
// src/native/reads.ts | ||
var nativeBalance = (args) => ({ | ||
read: (publicClient) => publicClient.getBalance({ address: args.address }), | ||
parse: (data) => createAmountFromRaw(args.nativeCurrency, data) | ||
// src/erc1155/walletActions/simulateERC1155SetApprovalForAll.ts | ||
import { simulateContract as simulateContract10 } from "viem/contract"; | ||
var simulateERC1155SetApprovalForAll = (client, { | ||
args: { erc1155, spender, approved }, | ||
...request | ||
}) => simulateContract10(client, { | ||
address: erc1155.address, | ||
abi: solmateErc1155ABI, | ||
functionName: "setApprovalForAll", | ||
args: [spender, approved], | ||
...request | ||
}); | ||
// src/native/utils.ts | ||
var createNativeCurrency = (name, symbol, decimals, chainID) => ({ | ||
type: "nativeCurrency", | ||
name, | ||
symbol, | ||
decimals, | ||
chainID | ||
}); | ||
// src/weth/utils.ts | ||
import { getAddress as getAddress7 } from "viem"; | ||
var createWETH = (address, name, symbol, decimals, chainID, blockCreated = 0n) => ({ | ||
type: "weth", | ||
address: getAddress7(address), | ||
name, | ||
symbol, | ||
decimals, | ||
chainID, | ||
blockCreated | ||
}); | ||
// src/weth/writes.ts | ||
var wethDeposit = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.amount.token.address, | ||
abi: weth9ABI, | ||
functionName: "deposit", | ||
account, | ||
value: args.amount.amount | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
var wethWithdraw = async (publicClient, walletClient, account, args) => { | ||
const { request, result } = await publicClient.simulateContract({ | ||
address: args.amount.token.address, | ||
abi: weth9ABI, | ||
functionName: "withdraw", | ||
account, | ||
args: [args.amount.amount] | ||
}); | ||
const hash = await walletClient.writeContract(request); | ||
return { hash, result, request }; | ||
}; | ||
// src/readUtils.ts | ||
var readAndParse = async (publicClient, reverseMirageRead) => { | ||
return reverseMirageRead.parse(await reverseMirageRead.read(publicClient)); | ||
}; | ||
// src/fractionUtils.ts | ||
import invariant3 from "tiny-invariant"; | ||
// src/fraction/utils.ts | ||
import invariant2 from "tiny-invariant"; | ||
var isFraction = (x) => typeof x === "object"; | ||
var createFraction = (numerator, denominator = 1) => { | ||
const d = BigInt(denominator); | ||
invariant3(d !== 0n, "Fraction: denominator equal to 0"); | ||
invariant2(d !== 0n, "Fraction: denominator equal to 0"); | ||
return { type: "fraction", numerator: BigInt(numerator), denominator: d }; | ||
@@ -1383,3 +1726,3 @@ }; | ||
var fractionInvert = (fraction) => { | ||
invariant3(fraction.numerator !== 0n, "Fraction: denominator equal to 0"); | ||
invariant2(fraction.numerator !== 0n, "Fraction: denominator equal to 0"); | ||
return { | ||
@@ -1432,4 +1775,13 @@ type: "fraction", | ||
// src/priceUtils.ts | ||
import invariant4 from "tiny-invariant"; | ||
// src/native/publicActions/getNativeBalance.ts | ||
import { getBalance } from "viem/actions"; | ||
var getNativeBalance = (client, args, type) => type === void 0 ? getBalance(client, { address: args.address }).then( | ||
(data) => createAmountFromRaw(args.nativeCurrency, data) | ||
) : { | ||
read: () => getBalance(client, { address: args.address }), | ||
parse: (data) => createAmountFromRaw(args.nativeCurrency, data) | ||
}; | ||
// src/price/utils.ts | ||
import invariant3 from "tiny-invariant"; | ||
var isPrice = (x) => typeof x === "object"; | ||
@@ -1465,3 +1817,3 @@ var createPriceFromFraction = (quote, base, price) => ({ | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? { | ||
@@ -1480,3 +1832,3 @@ ...fractionAdd(rawPrice(a), rawPrice(b)), | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? { | ||
@@ -1495,3 +1847,3 @@ ...fractionSubtract(rawPrice(a), rawPrice(b)), | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? { | ||
@@ -1517,3 +1869,3 @@ type: "price", | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? { | ||
@@ -1539,3 +1891,3 @@ type: "price", | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? fractionLessThan(rawPrice(a), rawPrice(b)) : fractionLessThan(adjustedPrice(a), b); | ||
@@ -1545,3 +1897,3 @@ }; | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? fractionEqualTo(rawPrice(a), rawPrice(b)) : fractionEqualTo(adjustedPrice(a), b); | ||
@@ -1551,7 +1903,7 @@ }; | ||
if (isPrice(b)) | ||
invariant4(a.base === b.base && a.quote === b.quote); | ||
invariant3(a.base === b.base && a.quote === b.quote); | ||
return isPrice(b) ? fractionGreaterThan(rawPrice(a), rawPrice(b)) : fractionGreaterThan(adjustedPrice(a), b); | ||
}; | ||
var priceQuote = (price, amount) => { | ||
invariant4(price.base === amount.token); | ||
invariant3(price.base === amount.token); | ||
return createAmountFromRaw( | ||
@@ -1574,92 +1926,40 @@ price.quote, | ||
// src/constants.ts | ||
var mainnetTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 1), | ||
weth: createWETH( | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
1, | ||
4719568n | ||
) | ||
// src/utils/getQueryKey.ts | ||
var getQueryKey = (get, args, chainID) => { | ||
return [ | ||
{ | ||
chainID, | ||
read: { | ||
name: get.name, | ||
args | ||
} | ||
} | ||
]; | ||
}; | ||
var sepoliaTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 11155111) | ||
}; | ||
var goerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 5), | ||
weth: createWETH( | ||
"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
5, | ||
1036651n | ||
) | ||
}; | ||
var optimismTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 10), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
10 | ||
) | ||
}; | ||
var optimismGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 420) | ||
}; | ||
var arbitrumTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 42161), | ||
weth: createWETH( | ||
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
42161, | ||
55n | ||
) | ||
}; | ||
var arbitrumGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 421613) | ||
}; | ||
var baseTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 8453), | ||
weth: createWETH( | ||
"0x4200000000000000000000000000000000000006", | ||
"Wrapped Ether", | ||
"WETH", | ||
18, | ||
8453 | ||
) | ||
}; | ||
var baseGoerliTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 84531) | ||
}; | ||
var celoTokens = { | ||
native: createNativeCurrency("Celo Native Asset", "CELO", 18, 42220), | ||
weth: createWETH( | ||
"0x471EcE3750Da237f93B8E339c536989b8978a438", | ||
"Celo Native Asset", | ||
"CELO", | ||
18, | ||
42220, | ||
2919n | ||
) | ||
}; | ||
var celoAlfajoresTokens = { | ||
native: createNativeCurrency("Celo Native Asset", "CELO", 18, 44787), | ||
weth: createWETH( | ||
"0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9", | ||
"Celo Native Asset", | ||
"CELO", | ||
18, | ||
44787 | ||
) | ||
}; | ||
var foundryTokens = { | ||
native: createNativeCurrency("Ether", "ETH", 18, 31337) | ||
}; | ||
// src/weth/walletActions/simulateWETHDeposit.ts | ||
import { simulateContract as simulateContract11 } from "viem/contract"; | ||
var simulateWETHDeposit = (client, { | ||
args: { amount }, | ||
...request | ||
}) => simulateContract11(client, { | ||
address: amount.token.address, | ||
abi: weth9ABI, | ||
functionName: "deposit", | ||
value: amount.amount, | ||
...request | ||
}); | ||
// src/weth/walletActions/simulateWETHWithdraw.ts | ||
import { simulateContract as simulateContract12 } from "viem/contract"; | ||
var simulateWETHWithdraw = (client, { | ||
args: { amount }, | ||
...request | ||
}) => simulateContract12(client, { | ||
address: amount.token.address, | ||
abi: weth9ABI, | ||
functionName: "withdraw", | ||
args: [amount.amount], | ||
...request | ||
}); | ||
export { | ||
@@ -1701,40 +2001,2 @@ PermitType, | ||
createWETH, | ||
solmateErc1155ABI as erc1155ABI, | ||
erc1155BalanceOf, | ||
erc1155IsApprovedForAll, | ||
erc1155SetApprovalForAll, | ||
erc1155Transfer, | ||
erc1155TransferBatch, | ||
erc1155URI, | ||
solmateErc20ABI as erc20ABI, | ||
erc20Allowance, | ||
erc20Approve, | ||
erc20BalanceOf, | ||
erc20Decimals, | ||
erc20IsPermit, | ||
erc20Name, | ||
erc20Permit, | ||
erc20PermitData, | ||
erc20PermitDomainSeparator, | ||
erc20PermitNonce, | ||
erc20PermitTypedDataHash, | ||
erc20SignPermit, | ||
erc20Symbol, | ||
erc20TotalSupply, | ||
erc20Transfer, | ||
erc20TransferFrom, | ||
solmateErc721ABI as erc721ABI, | ||
erc721Approve, | ||
erc721BalanceOf, | ||
erc721Data, | ||
erc721GetApproved, | ||
erc721IDData, | ||
erc721IsApprovedForAll, | ||
erc721Name, | ||
erc721OwnerOf, | ||
erc721SetApprovalForAll, | ||
erc721SupportsInterface, | ||
erc721Symbol, | ||
erc721TokenURI, | ||
erc721Transfer, | ||
foundryTokens, | ||
@@ -1753,5 +2015,30 @@ fractionAdd, | ||
getERC1155, | ||
getERC1155BalanceOf, | ||
getERC1155IsApprovedForAll, | ||
getERC1155URI, | ||
getERC20, | ||
getERC20Allowance, | ||
getERC20BalanceOf, | ||
getERC20Decimals, | ||
getERC20DomainSeparator, | ||
getERC20Name, | ||
getERC20Permit, | ||
getERC20PermitData, | ||
getERC20PermitNonce, | ||
getERC20Symbol, | ||
getERC20TotalSupply, | ||
getERC721, | ||
getERC721Approved, | ||
getERC721BalanceOf, | ||
getERC721Data, | ||
getERC721IDData, | ||
getERC721IsApprovedForAll, | ||
getERC721Name, | ||
getERC721OwnerOf, | ||
getERC721SupportsInterface, | ||
getERC721Symbol, | ||
getERC721TokenURI, | ||
getIsERC20Permit, | ||
getNativeBalance, | ||
getQueryKey, | ||
goerliTokens, | ||
@@ -1762,3 +2049,2 @@ isAmount, | ||
mainnetTokens, | ||
nativeBalance, | ||
optimismGoerliTokens, | ||
@@ -1777,8 +2063,21 @@ optimismTokens, | ||
rawPrice, | ||
readAndParse, | ||
sepoliaTokens, | ||
weth9ABI, | ||
wethDeposit, | ||
wethWithdraw | ||
signERC20Permit, | ||
simulateERC1155SetApprovalForAll, | ||
simulateERC1155Transfer, | ||
simulateERC1155TransferBatch, | ||
simulateERC20Approve, | ||
simulateERC20Permit, | ||
simulateERC20Transfer, | ||
simulateERC20TransferFrom, | ||
simulateERC721Approve, | ||
simulateERC721SetApprovalForAll, | ||
simulateERC721Transfer, | ||
simulateWETHDeposit, | ||
simulateWETHWithdraw, | ||
solmateErc1155ABI as solmateERC1155ABI, | ||
solmateErc20ABI as solmateERC20ABI, | ||
solmateErc721ABI as solmateERC721ABI, | ||
weth9ABI | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "reverse-mirage", | ||
"version": "0.1.11", | ||
"version": "1.0.0-next.0", | ||
"description": "Application level typescript utilities for Ethereum", | ||
@@ -17,3 +17,3 @@ "type": "module", | ||
"!src/**/*.bench.ts", | ||
"!src/test/**/*" | ||
"!src/_test/**/*" | ||
], | ||
@@ -43,11 +43,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.1.2", | ||
"@biomejs/biome": "^1.2.2", | ||
"@uniswap/sdk-core": "^4.0.7", | ||
"@viem/anvil": "^0.0.6", | ||
"@vitest/coverage-v8": "^0.34.4", | ||
"bun": "^1.0.0", | ||
"bun": "^1.0.2", | ||
"mitata": "^0.1.6", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2", | ||
"viem": "^1.10.9", | ||
"viem": "^1.10.14", | ||
"vitest": "^0.34.4" | ||
@@ -54,0 +54,0 @@ }, |
import type { Address } from "viem"; | ||
import type { Amount } from "../amountUtils.js"; | ||
import type { Token } from "../types.js"; | ||
import type { Amount } from "../amount/types.js"; | ||
import type { Token } from "../types/token.js"; | ||
@@ -5,0 +5,0 @@ export type ERC1155 = Token<"erc1155"> & { |
import type { Address } from "viem/accounts"; | ||
import type { Amount } from "../amountUtils.js"; | ||
import type { Token, TokenData } from "../types.js"; | ||
import type { Amount } from "../amount/types.js"; | ||
import type { Token, TokenData } from "../types/token.js"; | ||
@@ -5,0 +5,0 @@ export type BaseERC20<TType extends string = string> = Token<TType> & { |
@@ -1,2 +0,2 @@ | ||
import { type Address, getAddress, hashTypedData } from "viem"; | ||
import { type Address, getAddress } from "viem"; | ||
import { | ||
@@ -6,4 +6,4 @@ createAmountFromFraction, | ||
createAmountFromString, | ||
} from "../amountUtils.js"; | ||
import type { Fraction } from "../types.js"; | ||
} from "../amount/utils.js"; | ||
import type { Fraction } from "../fraction/types.js"; | ||
import type { ERC20, ERC20Permit, ERC20PermitData } from "./types.js"; | ||
@@ -108,31 +108,1 @@ | ||
} as const; | ||
/** | ||
* Returns the EIP 712 typed data hash of type {@link PermitType} | ||
*/ | ||
export const erc20PermitTypedDataHash = (permit: { | ||
amount: ERC20PermitData<ERC20Permit>; | ||
owner: Address; | ||
spender: Address; | ||
deadline: bigint; | ||
}) => { | ||
const domain = { | ||
name: permit.amount.token.name, | ||
version: permit.amount.token.version, | ||
chainId: permit.amount.token.chainID, | ||
verifyingContract: permit.amount.token.address, | ||
} as const; | ||
return hashTypedData({ | ||
domain, | ||
types: PermitType, | ||
primaryType: "Permit", | ||
message: { | ||
owner: permit.owner, | ||
spender: permit.spender, | ||
value: permit.amount.amount, | ||
nonce: permit.amount.nonce, | ||
deadline: permit.deadline, | ||
}, | ||
}); | ||
}; |
import type { Address } from "viem"; | ||
import type { Token, TokenData, Tuple } from "../types.js"; | ||
import type { Token, TokenData } from "../types/token.js"; | ||
import type { Tuple } from "../types/tuple.js"; | ||
@@ -4,0 +5,0 @@ export type ERC721 = Token<"erc721"> & { |
import { type Address, getAddress } from "viem"; | ||
import type { Tuple } from "../types.js"; | ||
import type { Tuple } from "../types/tuple.js"; | ||
import type { ERC721, ERC721Data, ERC721IDData } from "./types.js"; | ||
@@ -4,0 +4,0 @@ |
264
src/index.ts
@@ -1,118 +0,107 @@ | ||
// ERC20 | ||
export { | ||
type Amount, | ||
isAmount, | ||
createAmountFromString, | ||
createAmountFromFraction, | ||
createAmountFromRaw, | ||
amountAdd, | ||
amountSubtract, | ||
amountMultiply, | ||
amountDivide, | ||
amountLessThan, | ||
amountEqualTo, | ||
amountGreaterThan, | ||
amountToNumber, | ||
} from "./amount/index.js"; | ||
export { | ||
erc20BalanceOf, | ||
erc20Allowance, | ||
erc20TotalSupply, | ||
erc20Name, | ||
erc20Symbol, | ||
erc20Decimals, | ||
erc20PermitNonce, | ||
erc20PermitData, | ||
erc20PermitDomainSeparator, | ||
getERC20, | ||
getERC20Permit, | ||
erc20IsPermit, | ||
} from "./erc20/reads.js"; | ||
type ChainTokens, | ||
arbitrumTokens, | ||
arbitrumGoerliTokens, | ||
baseTokens, | ||
baseGoerliTokens, | ||
celoTokens, | ||
celoAlfajoresTokens, | ||
foundryTokens, | ||
goerliTokens, | ||
mainnetTokens, | ||
optimismTokens, | ||
optimismGoerliTokens, | ||
sepoliaTokens, | ||
} from "./chains/index.js"; | ||
export { | ||
type BaseERC20, | ||
type ERC20, | ||
type ERC20Permit, | ||
type ERC20Data, | ||
type ERC20Amount, | ||
type ERC20PermitData, | ||
createERC20, | ||
createERC20Permit, | ||
createERC20PermitDataFromFraction, | ||
createERC20PermitDataFromRaw, | ||
createERC20PermitDataFromString, | ||
createERC20PermitDataFromRaw, | ||
createERC20PermitDataFromFraction, | ||
PermitType, | ||
erc20PermitTypedDataHash, | ||
} from "./erc20/utils.js"; | ||
solmateERC20ABI, | ||
getERC20, | ||
getERC20Allowance, | ||
getERC20BalanceOf, | ||
getERC20Decimals, | ||
getERC20DomainSeparator, | ||
getERC20Name, | ||
getERC20Permit, | ||
getERC20PermitData, | ||
getERC20PermitNonce, | ||
getERC20Symbol, | ||
getERC20TotalSupply, | ||
getIsERC20Permit, | ||
signERC20Permit, | ||
simulateERC20Approve, | ||
simulateERC20Permit, | ||
simulateERC20Transfer, | ||
simulateERC20TransferFrom, | ||
} from "./erc20/index.js"; | ||
export { | ||
erc20Transfer, | ||
erc20Approve, | ||
erc20TransferFrom, | ||
erc20Permit, | ||
erc20SignPermit, | ||
} from "./erc20/writes.js"; | ||
// ERC721 | ||
export { | ||
erc721Name, | ||
erc721Symbol, | ||
erc721TokenURI, | ||
erc721GetApproved, | ||
erc721IsApprovedForAll, | ||
erc721OwnerOf, | ||
erc721BalanceOf, | ||
erc721SupportsInterface, | ||
getERC721, | ||
erc721Data, | ||
erc721IDData, | ||
} from "./erc721/reads.js"; | ||
export { | ||
type ERC721, | ||
type ERC721IDData, | ||
type ERC721Data, | ||
createERC721, | ||
createERC721Data, | ||
createERC721IDData, | ||
} from "./erc721/utils.js"; | ||
solmateERC721ABI, | ||
getERC721, | ||
getERC721Approved, | ||
getERC721BalanceOf, | ||
getERC721Data, | ||
getERC721IDData, | ||
getERC721IsApprovedForAll, | ||
getERC721Name, | ||
getERC721Symbol, | ||
getERC721OwnerOf, | ||
getERC721SupportsInterface, | ||
getERC721TokenURI, | ||
simulateERC721Transfer, | ||
simulateERC721Approve, | ||
simulateERC721SetApprovalForAll, | ||
} from "./erc721/index.js"; | ||
export { | ||
erc721Transfer, | ||
erc721Approve, | ||
erc721SetApprovalForAll, | ||
} from "./erc721/writes.js"; | ||
// ERC1155 | ||
export { | ||
erc1155IsApprovedForAll, | ||
erc1155URI, | ||
erc1155BalanceOf, | ||
type ERC1155, | ||
type ERC1155Data, | ||
createERC1155, | ||
createERC1155Data, | ||
solmateERC1155ABI, | ||
getERC1155, | ||
} from "./erc1155/reads.js"; | ||
getERC1155BalanceOf, | ||
getERC1155IsApprovedForAll, | ||
getERC1155URI, | ||
simulateERC1155Transfer, | ||
simulateERC1155TransferBatch, | ||
simulateERC1155SetApprovalForAll, | ||
} from "./erc1155/index.js"; | ||
export { createERC1155, createERC1155Data } from "./erc1155/utils.js"; | ||
export { | ||
erc1155SetApprovalForAll, | ||
erc1155Transfer, | ||
erc1155TransferBatch, | ||
} from "./erc1155/writes.js"; | ||
// NATIVE | ||
export { nativeBalance } from "./native/reads.js"; | ||
export { createNativeCurrency } from "./native/utils.js"; | ||
// WETH | ||
export { createWETH } from "./weth/utils.js"; | ||
export { wethDeposit, wethWithdraw } from "./weth/writes.js"; | ||
// UTILS | ||
export { readAndParse } from "./readUtils.js"; | ||
// AMOUNT | ||
export { | ||
type Amount, | ||
isAmount, | ||
createAmountFromString, | ||
createAmountFromFraction, | ||
createAmountFromRaw, | ||
amountAdd, | ||
amountSubtract, | ||
amountMultiply, | ||
amountDivide, | ||
amountLessThan, | ||
amountEqualTo, | ||
amountGreaterThan, | ||
amountToNumber, | ||
} from "./amountUtils.js"; | ||
// FRACTION | ||
export { | ||
type Fraction, | ||
isFraction, | ||
@@ -131,7 +120,16 @@ createFraction, | ||
fractionToNumber, | ||
} from "./fractionUtils.js"; | ||
} from "./fraction/index.js"; | ||
// PRICE | ||
export { | ||
type NativeCurrency, | ||
type NativeCurrencyAmount, | ||
type NativeCurrencyData, | ||
createNativeCurrency, | ||
getNativeBalance, | ||
type GetNativeBalanceParameters, | ||
type GetNativeBalanceReturnType, | ||
} from "./native/index.js"; | ||
export { | ||
type Price, | ||
isPrice, | ||
@@ -153,63 +151,21 @@ createPriceFromFraction, | ||
priceToNumber, | ||
} from "./priceUtils.js"; | ||
} from "./price/index.js"; | ||
// ABI | ||
export { | ||
solmateErc20ABI as erc20ABI, | ||
solmateErc721ABI as erc721ABI, | ||
solmateErc1155ABI as erc1155ABI, | ||
weth9ABI, | ||
} from "./generated.js"; | ||
// TYPES | ||
export type { | ||
BaseERC20, | ||
ERC20, | ||
ERC20Permit, | ||
ERC20Data, | ||
ERC20Amount, | ||
ERC20PermitData, | ||
} from "./erc20/types.js"; | ||
export type { ERC721, ERC721IDData, ERC721Data } from "./erc721/types.js"; | ||
export type { ERC1155, ERC1155Data } from "./erc1155/types.js"; | ||
export type { | ||
NativeCurrency, | ||
NativeCurrencyAmount, | ||
NativeCurrencyData, | ||
} from "./native/types.js"; | ||
export type { WETH } from "./weth/types.js"; | ||
export type { | ||
BigIntIsh, | ||
Fraction, | ||
ReverseMirage, | ||
ReverseMirageRead, | ||
Token, | ||
TokenData, | ||
Price, | ||
ReverseMirageRead, | ||
ReverseMirageWrite, | ||
Tuple, | ||
} from "./types.js"; | ||
} from "./types/index.js"; | ||
// CONSTANTS | ||
export { getQueryKey } from "./utils/index.js"; | ||
export { | ||
type ChainTokens, | ||
mainnetTokens, | ||
sepoliaTokens, | ||
goerliTokens, | ||
optimismTokens, | ||
optimismGoerliTokens, | ||
arbitrumTokens, | ||
arbitrumGoerliTokens, | ||
baseTokens, | ||
baseGoerliTokens, | ||
celoTokens, | ||
celoAlfajoresTokens, | ||
foundryTokens, | ||
} from "./constants.js"; | ||
type WETH, | ||
createWETH, | ||
weth9ABI, | ||
simulateWETHDeposit, | ||
simulateWETHWithdraw, | ||
} from "./weth/index.js"; |
@@ -1,2 +0,2 @@ | ||
import type { Token, TokenData } from "../types.js"; | ||
import type { Token, TokenData } from "../types/token.js"; | ||
@@ -3,0 +3,0 @@ export type NativeCurrency = Token<"nativeCurrency"> & { |
@@ -1,3 +0,3 @@ | ||
import type { BaseERC20 } from "../index.js"; | ||
import type { BaseERC20 } from "../erc20/types.js"; | ||
export type WETH = BaseERC20<"weth">; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
932850
97
13810
0