Vault Integration

If you require assistance or need additional information to integrate Unagii Vault, reach out to us at support@unagii.com. Instructions for V2 Vault integrations are coming soon.

Deposit flow

Withdraw flow

Get token allowance

GET https://app.unagii.com/api/v1/sc/vault/allowance/{vaultType}/{token}/{address}

Path Parameters

NameTypeDescription

vaultType

string

safe | growth

token

string

Token name

address

string

Account address

{
  "success": true,
  "result": {
    "value": "115792089237316195423570985008687907853269984665640564039457584007913129",
    "token": "USDT",
    "owner": "0x6e93ebc8302890ff1d1befd779d1db131ef30d4d",
    "spender": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584"
  }
}

Get deposited balance

GET https://app.unagii.com/api/v1/sc/vault/balance/{vaultType}/{token}/{address}

This endpoint allows you to get free cakes.

Path Parameters

NameTypeDescription

vaultType

string

safe | growth

token

string

Token name

address

string

Account address

Headers

NameTypeDescription

X-UNAGII-AUTH-TOKEN

string

Access token

{
  "success": true,
  "result": {
    "vaultType": "safe",
    "token": "USDC",
    "shares": "565397.594093",
    "expectedReturn": "618277.751379",
    "address": "0x6e93ebc8302890ff1d1befd779d1db131ef30d4d",
    "percentChanged": "0.00093160818829498143",
    "balanceBefore": "617713.150475",
    "balanceAfter": "618288.617104"
  }
}

Get data to build Approve Token transaction object

GET https://app.unagii.com/api/v1/sc/vault/digest/approve/{vaultType}/{token}/{address}?amount={amount}

Path Parameters

NameTypeDescription

vaultType

string

safe | growth

Query Parameters

NameTypeDescription

amount

number

Leave it blank if you want to approve an infinite amount of allowance

Headers

NameTypeDescription

X-UNAGII-AUTH-TOKEN

string

Access token

{
  "success": true,
  "result": {
    "to": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584",
    "digest": "0xb6b55f250000000000000000000000000000000000000000000000000000000000000cd4",
    "gasLimit": 83449,
    "contractAddress": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584"
  }
}
const approveTxn = {
    from: address,
    gasPrice: "20000000000", // 20 Gwei
    gas: String(result.gasLimit),
    to: result.contractAddress,
    value: "0x0",
    nonce: "10", // tx nonce
    data: result.digest
}
web3.eth.sendTransaction(approveTxn).then( // do something );

Get data to build Deposit transaction object

GET https://app.unagii.com/api/v1/sc/vault/digest/deposit/{vaultType}/{token}/{address}?amount={amount}

Path Parameters

NameTypeDescription

vaultType

string

safe | growth

token

string

Token name

address

string

Account address

Query Parameters

NameTypeDescription

amount

number

Deposit amount

Headers

NameTypeDescription

X-UNAGII-AUTH-TOKEN

string

Access token

{
  "success": true,
  "result": {
    "to": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584",
    "digest": "0xb6b55f250000000000000000000000000000000000000000000000000000000000000cd4",
    "gasLimit": 83449,
    "contractAddress": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584"
  }
}
const depositTxn = {
    from: address,
    gasPrice: "20000000000", // 20 Gwei
    gas: String(result.gasLimit),
    to: result.contractAddress,
    value: "0x0",
    nonce: "10", // tx nonce
    data: result.digest
}
web3.eth.sendTransaction(depositTxn).then( // do something );

Get data to build Withdraw transaction object

GET https://app.unagii.com/api/v1/sc/vault/digest/withdraw_by_amount/{vaultType}/{token}/{address}?amount={amount}

Path Parameters

NameTypeDescription

vaultType

string

safe | growth

token

string

Token name

address

string

Account address

Query Parameters

NameTypeDescription

amount

number

Withdrawal amount

Headers

NameTypeDescription

X-UNAGII-AUTH-TOKEN

string

Access token

{
  "success": true,
  "result": {
    "to": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584",
    "digest": "0xb6b55f250000000000000000000000000000000000000000000000000000000000000cd4",
    "gasLimit": 83449,
    "contractAddress": "0x178Bf8fD04b47D2De3eF3f6b3D112106375ad584"
  }
}
const withdrawalTxn = {
    from: address,
    gasPrice: "20000000000", // 20 Gwei
    gas: String(result.gasLimit),
    to: result.contractAddress,
    value: "0x0",
    nonce: "10", // tx nonce
    data: result.digest
}
web3.eth.sendTransaction(withdrawalTxn).then( // do something );

Last updated