const qs = require("qs");
const axios = require("axios");
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
fee: 100,
locks: [
{
amount: 100,
expiry: moment().add(1, "d").format(),
locker: {
cardinal: {
value: item.address,
publicKey: item.pubkey?.toString("hex"),
},
},
destination: {
cardinal: {
value: item.address,
publicKey: item.pubkey?.toString("hex"),
},
},
},
{
amount: 100,
expiry: moment().add(1, "d").format(),
locker: {
cardinal: {
value: item.address,
publicKey: item.pubkey?.toString("hex"),
},
},
destination: {
cardinal: {
value: item.address,
publicKey: item.pubkey?.toString("hex"),
},
},
},
],
product: {
id: 11,
},
};
const { data: escrow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute`,
{ data },
{ headers }
);
const qs = require("qs");
const axios = require("axios");
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "broadcast-lock",
transactions,
product: {
id: 11,
},
};
const where = qs.stringify({ where: { id: flow.id } });
const { data: escrow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
const qs = require("qs");
const axios = require("axios");
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "unlock",
fee: 200,
index: 0,
product: {
id: 11,
},
};
const where = qs.stringify({ where: { id: flow.id } });
const { data: escrow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
const qs = require("qs");
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "broadcast-unlock",
transactions,
product: {
id: 11,
},
};
const where = qs.stringify({ where: { id: flow.id } });
const { data: escrow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
The flow API uses these APIs under the hood:
- Create Escrow
- Execute Escrow
- Broadcast Escrow
- Collateral API
- Asset API
- Action API
- Create Outcomes and integration with the oracle
- Check one Outcome
- Execute signature
- Audit trails