Documentation ¶
Index ¶
- Constants
- Variables
- type APITypedData
- type Client
- type Contract
- func (c *Contract) Address() string
- func (c *Contract) DOMAIN_SEPARATOR() (string, error)
- func (c *Contract) DOMAIN_TYPEHASH() (string, error)
- func (c *Contract) Decimals() (uint8, error)
- func (c *Contract) HasMethod(method string) bool
- func (c *Contract) Implementation() (common.Address, error)
- func (c *Contract) Name() (string, error)
- func (c *Contract) Nonces(sender string) (*big.Int, error)
- func (c *Contract) PERMIT_TYPEHASH() (string, error)
- func (c *Contract) Version() (string, error)
- type ContractABIResp
- type PermitMessage
- type TokenInfo
- type TypedData
Constants ¶
View Source
const DEFAULT_ABI = "" /* 2257-byte string literal not displayed */
View Source
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000"
Variables ¶
View Source
var ( // Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed) PERMIT_DAI_LIKE = "0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb" // Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline) PERMIT_COMMON = "0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9" PERMIT_DAI_LIKE_TYPES = []apitypes.Type{ {Name: "holder", Type: "address"}, {Name: "spender", Type: "address"}, {Name: "nonce", Type: "uint256"}, {Name: "expiry", Type: "uint256"}, {Name: "allowed", Type: "bool"}, } PERMIT_COMMON_TYPES = []apitypes.Type{ {Name: "owner", Type: "address"}, {Name: "spender", Type: "address"}, {Name: "value", Type: "uint256"}, {Name: "nonce", Type: "uint256"}, {Name: "deadline", Type: "uint256"}, } )
permit types
View Source
var ( // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract) DOMAIN_COMMON = "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f" // EIP712Domain(string name,uint256 chainId,address verifyingContract) DOMAIN_UNI_LIKE = "0x8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866" // EIP712Domain(uint256 chainId,address verifyingContract) DOMAIN_ONLY_CHAIN = "0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218" // EIP712Domain(string name,string version,address verifyingContract,bytes32 salt) DOMAIN_SALT_LIKE = "0x36c25de3e541d5d970f66e4210d728721220fff5c077cc6cd008b3a0c62adab7" DOMAIN_COMMON_TYPES = []apitypes.Type{ {Name: "name", Type: "string"}, {Name: "version", Type: "string"}, {Name: "chainId", Type: "uint256"}, {Name: "verifyingContract", Type: "address"}, } DOMAIN_UNI_LIKE_TYPES = []apitypes.Type{ {Name: "name", Type: "string"}, {Name: "chainId", Type: "uint256"}, {Name: "verifyingContract", Type: "address"}, } DOMAIN_ONLY_CHAIN_TYPES = []apitypes.Type{ {Name: "chainId", Type: "uint256"}, {Name: "verifyingContract", Type: "address"}, } DOMAIN_SALT_LIKE_TYPES = []apitypes.Type{ {Name: "name", Type: "string"}, {Name: "version", Type: "string"}, {Name: "verifyingContract", Type: "address"}, {Name: "salt", Type: "bytes32"}, } )
domain types
View Source
var APIMap = map[string]string{
"1": "https://api.etherscan.io/api",
"5": "https://api-goerli.etherscan.io/api",
"56": "https://api.bscscan.com/api",
"97": "https://api-testnet.bscscan.com/api",
"137": "https://api.polygonscan.com/api",
"80001": "https://api-testnet.polygonscan.com/api",
}
api maps
for request ABI https://api.etherscan.io/api ?module=contract &action=getabi &address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413 &apikey=YourApiKeyToken
View Source
var DomainTypedDataMap = map[string][]apitypes.Type{ DOMAIN_COMMON: DOMAIN_COMMON_TYPES, DOMAIN_UNI_LIKE: DOMAIN_UNI_LIKE_TYPES, DOMAIN_ONLY_CHAIN: DOMAIN_ONLY_CHAIN_TYPES, DOMAIN_SALT_LIKE: DOMAIN_SALT_LIKE_TYPES, }
domain maps
View Source
var IMPLEMENTATION_SLOTS = []string{
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
"0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3",
}
Functions ¶
This section is empty.
Types ¶
type APITypedData ¶
func (*APITypedData) ConvertTypedData ¶
func (atd *APITypedData) ConvertTypedData() *TypedData
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) TokenTypedData ¶
func (c *Client) TokenTypedData(req *PermitMessage) (*TypedData, error)
func (*Client) WithAPIKey ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func (*Contract) DOMAIN_SEPARATOR ¶
func (*Contract) DOMAIN_TYPEHASH ¶
func (*Contract) PERMIT_TYPEHASH ¶
type ContractABIResp ¶
type PermitMessage ¶
type TypedData ¶
type TypedData struct { Types apitypes.Types `json:"types"` PrimaryType string `json:"primaryType"` Domain apitypes.TypedDataMessage `json:"domain"` Message apitypes.TypedDataMessage `json:"message"` }
Click to show internal directories.
Click to hide internal directories.