exchange.IO("key", ...)
Switches the private key.
exchange.IO(k, key)Examples
Switch the private key used by the exchange object.
javascript
function main() {
// "Private Key" represents the private key string, which needs to be filled in specifically
exchange.IO("key", "Private Key")
}Arguments
| Name | Type | Required | Description |
k | string | Yes | Function of |
key | string | Yes | Private key string. |
See Also
Remarks
The exchange.IO() function supports private key switching functionality, allowing operations on multiple wallet addresses. You can also add multiple exchange objects (refer to: exchanges) to operate multiple wallet addresses.
For private key switching operations: exchange.IO("key", "xxx"), concurrent switching is not supported.
The private key is a hex string with an optional 0x prefix. An invalid key is reported as an error and nothing is switched. The key is only kept in memory and never written to the log; after switching, getting the address, signing and sending transactions all use the new key.