Wrap / Unwrap
Wrapping:
POST /v1/TokenWrapping/Request
Submit a request to wrap a token to receipt token
Note: currently we only support wrapping from USDC to USDC-G
Request
Headers
Header | Type | Description |
Content-Type | string | application/json |
Request Body
Attribute | Type | Description |
SourceToken | string | The gluwacoin token to be wrapped to TargetToken. Eg: USDC |
TargetToken | string | The gluwacoin token the user will receive after wrapping SourceToken. Eg: USDC-G |
Amount | number | The amount of Source tokens to be wrapped with decimal places if any. |
ApproveTxnSignature | string | The raw transaction of approve function signed by the user private key to allow the TargetToken contract withdraw the Amount from SourceToken Refer: see example Approve Raw Signature |
MintTxnSignature | string | The raw transaction of mint function of TargetToken contract signed by the user private key to withdraw the Amount from SourceToken and receive the TargetToken Refer: see example Ethless Mint Signature |
Address | string | The user’s address which has SourceToken and is used to receive TargetToken after wrapping |
IdempotentKey | string | Optional. The unique id generated by Gluwa SDK |
Sample Request
Response
Response | 202 Accepted |
Example ApproveTxnSignature: Approve Raw Signature
For a token owner to approve a spender to transfer(spend) an “amount“ of his/her token from a contract on his/her behalf Spender can be a contract address or a typical Ethereum address.
Note: the amount must include the fee, which means: approved amount = amount (to transfer) + fee
Example MintTxnSignature: Ethless Mint Signature
MinterAddress: the address which will receive the minted token
Note 1: only used for wrapping USCD -> USDC-G Note 2: for Mint, after minting "amount" successful, the Minter need to pay "fee" from the "amount" to the Wrapper Note 3: the prerequisite for Mint function is that the Minter need to approve USDC-G contract to spend "amount" of USDC token on behalf of him/her
Unwrapping:
POST /v1/TokenUnwrapping/Request
Submit a request to unwrap a token to receive another token
Note: currently we only support unwrapping from USDC-G to USDC
Request
Headers
Header | Type | Description |
Content-Type | string | application/json |
Request Body
Attribute | Type | Description |
SourceToken | string | The gluwacoin token to be unwrapped to TargetToken. Eg: USDC-G |
TargetToken | string | The gluwacoin token the user will receive after unwrapping SourceToken. Eg: USDC |
Amount | number | The amount of Source tokens to be unwrapped with decimal places if any. Note: Amount is a component to create BurnSignature |
BurnSignature | string | The Burn signature signed by a user’s private key to authorize burning USDC-G to get USDC Refer: see example Ethless Burn Signature |
Nonce | number | A unique random number generated by Gluwa client Note: Nonce is a component to create BurnSignature |
Fee | number | Fee of burning retrieved from Fee API /v1/{Currency}/fee?function=Burn Note: Fee is a component to create BurnSignature |
Address | string | The user’s address which has SourceToken and is used to receive TargetToken after unwrapping Note: Address is a component to create BurnSignature |
IdempotentKey | string | Optional. The unique id generated by Gluwa SDK |
Sample Request
Response
Response | 202 Accepted |
Example BurnSignature: Ethless Burn Signature
BurnerAddress: the address which will withdraw USDC-G token -> USDC token
Note 1: only used for unwrapping USCD-G -> USDC
Note 2: for Burn, after burning "amount" successful, the Burner need to pay "fee" from the "amount" to the Wrapper
Note 3: the prerequisite for Burn function is that the Burner need to approve USDC-G contract to spend "amount" of USDC token on behalf of him/her
Last updated