Methods to set default environment variables
Environment Management allows developers to set default variables to be used when calling FunWallet methods.
Currently, a developer can specify the following default environment variables:
Config Property Default Value API Key
N/A Target Blockchain
goerli Gas Payment Mode
Base Gas Token Developer Fee
No fee Skip DB Action
false
Configure and set default environment variables
await configureEnvironment ( {
apiKey : "nbiQS2Ut932ewF5TqiCpl2ZTUqPWb1P29N8GcJjy" ,
chain : "goerli" ,
gasSponsor : {
token : "usdc" ,
sponsorAddress : "0x8aF2c6E3C6E3C9a8A0cA2Bc4B5f5Bb8d2b8BbDd2" ,
usePermit : true
} ,
fee : {
token : "usdc" ,
amount : 1 ,
recipient : "0x8aF2c6E3C6E3C9a8A0cA2Bc4B5f5Bb8d2b8BbDd2"
}
} )
Default environment configuration variables. It has the following properties:
An API key is required to use the FunWallet SDK.
You can get one by at the Fun dashboard.
nbiQS2Ut932ewF5TqiCpl2ZTUqPWb1P29N8GcJjy
chain
string || Chain || number
The network the SDK will be configured to. Used for operations, querying information, etc. Defaults to Goerli
When used, the sponsor becomes a token sponsor, while its absence defaults to a gasless sponsor.
Uses the given sponsor address to pay for operations in ETH. If not provided, uses the Fun Owned token sponsor.
0x8aF2c6E3C6E3C9a8A0cA2Bc4B5f5Bb8d2b8BbDd2
When true, paying for paymaster for tokens will avoid having to give approval for each token transfer.
Defaults to true.
The token users will pay the fee in.
The amount per operation a user will pay in the token.
The amount (in percent terms, so 10 = 10%) as a percentage of gas per operation a user will pay in the token.
If the recipient address refers to a contract that is unable to receive ETH via receive() or fallback(), the Funwallet transactions will be reverted
0x8aF2c6E3C6E3C9a8A0cA2Bc4B5f5Bb8d2b8BbDd2
If set to true all actions will not be stored in our DB by default. Used to maintain privacy or to run your own storage.