import axios from "axios";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
fee: SUGGESTED_NETWORK_FEES,
amount: OFFER_AMOUNT,
lender: {
cardinal: {
value: LENDER_BTC_ADDRESS,
publicKey: LENDER_BTC_PUBLIC_KEY,
},
},
product: {
id: PRODUCT_ID,
},
expiry: OFFER_EXPIRY_DATE //e.g: moment().add(1, "d").format(),
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "broadcast-offer",
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const where = qs.stringify({ where: { id: FLOW_ID_FROM_OFFER_STEP } });
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "cancel",
fee: SUGGESTED_NETWORK_FEES,
product: {
id: PRODUCT_ID,
},
};
const where = qs.stringify({ where: { id: FLOW_ID_FROM_OFFER_STEP } });
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "execute-cancel-signature",
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "spend",
fee: SUGGESTED_NETWORK_FEES,
borrower: {
utxo: {
id: "ORDINAL_UTXO",
sequence: ORDINAL_UTXO_INDEX,
runestone: { name: THE.RUNE.NAME, id: X:Y },
amount: "AMOUNT_TO_LOCK",
},
ordinal: {
value: BORROWER_ORDINAL_ADDRESS,
publicKey: BORROWER_ORDINAL_PUBLIC_KEY,
},
cardinal: {
value: BORROWER_BTC_ADDRESS,
publicKey: BORROWER_BTC_PUBLIC_KEY,
},
},
loan: {
amount: {
value: PARTIAL_AMOUNT_TO_UNLOCK,
liquidator: {
ordinal: {
value,
publicKey,
},
},
},
},
protocol: {
cardinal: {
value: PROTOCOL_BTC_ADDRESS,
publicKey: PROTOCOL_BTC_PUBLIC_KEY,
},
},
cost: PROTOCOL_COST,
expiry: OFFER_EXPIRY_DATE //e.g: moment().add(1, "d").format(),
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "execute-spend-signature",
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "repay",
amount: REPAYMENT_AMOUNT,
fee: SUGGESTED_NETWORK_FEES,
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "broadcast-repay",
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "claim",
flowEscrow: {
id: ID_OF_FLOW_ESCROW_TO_EXECUTE,
},
fee: SUGGESTED_NETWORK_FEES,
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "execute-claim-signature",
flowEscrow: {
id: ID_OF_FLOW_ESCROW_TO_EXECUTE,
},
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "liquidate",
flowEscrow: {
id: ID_OF_FLOW_ESCROW_TO_EXECUTE,
},
fee: SUGGESTED_NETWORK_FEES,
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = await axios.post(
`${DEEP_LAKE_REST_API_URL}/flows/execute?${where}`,
{ data },
{ headers }
);
import axios from "axios";
import qs from "qs";
const headers = { Authorization: MY_COMPANY_API_KEY };
const data = {
state: "execute-liquidate-signature",
flowEscrow: {
id: ID_OF_FLOW_ESCROW_TO_EXECUTE,
},
transactions: [{base64: 'SIGNED_BASE_64'}],
product: {
id: PRODUCT_ID,
},
};
const { data: flow } = 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