(ledger)
- createTransactions - Create a new batch of transactions to a ledger
- addMetadataOnTransaction - Set the metadata of a transaction by its ID
- addMetadataToAccount - Add metadata to an account
- countAccounts - Count the accounts from a ledger
- countTransactions - Count the transactions from a ledger
- createTransaction - Create a new transaction to a ledger
- getAccount - Get account by its address
- getBalances - Get the balances from a ledger's account
- getBalancesAggregated - Get the aggregated balances from selected accounts
- getInfo - Show server information
- getLedgerInfo - Get information about a ledger
- getMapping - Get the mapping of a ledger
- getTransaction - Get transaction from a ledger by its ID
- listAccounts - List accounts from a ledger
- listLogs - List the logs from a ledger
- listTransactions - List transactions from a ledger
- readStats - Get statistics from a ledger
- revertTransaction - Revert a ledger transaction by its ID
runScript- Execute a Numscript⚠️ Deprecated- updateMapping - Update the mapping of a ledger
- v2AddMetadataOnTransaction - Set the metadata of a transaction by its ID
- v2AddMetadataToAccount - Add metadata to an account
- v2CountAccounts - Count the accounts from a ledger
- v2CountTransactions - Count the transactions from a ledger
- v2CreateBulk - Bulk request
- v2CreateLedger - Create a ledger
- v2CreateTransaction - Create a new transaction to a ledger
- v2DeleteAccountMetadata - Delete metadata by key
- v2DeleteLedgerMetadata - Delete ledger metadata by key
- v2DeleteTransactionMetadata - Delete metadata by key
- v2GetAccount - Get account by its address
- v2GetBalancesAggregated - Get the aggregated balances from selected accounts
- v2GetInfo - Show server information
- v2GetLedger - Get a ledger
- v2GetLedgerInfo - Get information about a ledger
- v2GetTransaction - Get transaction from a ledger by its ID
- v2GetVolumesWithBalances - Get list of volumes with balances for (account/asset)
- v2ListAccounts - List accounts from a ledger
- v2ListLedgers - List ledgers
- v2ListLogs - List the logs from a ledger
- v2ListTransactions - List transactions from a ledger
- v2ReadStats - Get statistics from a ledger
- v2RevertTransaction - Revert a ledger transaction by its ID
- v2UpdateLedgerMetadata - Update ledger metadata
Create a new batch of transactions to a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.createTransactions({
transactions: {
transactions: [
{
postings: [
{
amount: BigInt("100"),
asset: "COIN",
destination: "users:002",
source: "users:001",
},
],
reference: "ref:001",
},
],
},
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.CreateTransactionsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Set the metadata of a transaction by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.addMetadataOnTransaction({
ledger: "ledger001",
txid: BigInt("1234"),
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AddMetadataOnTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.AddMetadataOnTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Add metadata to an account
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.addMetadataToAccount({
requestBody: {
"key": "<value>",
},
address: "users:001",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.AddMetadataToAccountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.AddMetadataToAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Count the accounts from a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.countAccounts({
address: "users:.+",
ledger: "ledger001",
metadata: {
"0": "m",
"1": "e",
"2": "t",
"3": "a",
"4": "d",
"5": "a",
"6": "t",
"7": "a",
"8": "[",
"9": "k",
"10": "e",
"11": "y",
"12": "]",
"13": "=",
"14": "v",
"15": "a",
"16": "l",
"17": "u",
"18": "e",
"19": "1",
"20": "&",
"21": "m",
"22": "e",
"23": "t",
"24": "a",
"25": "d",
"26": "a",
"27": "t",
"28": "a",
"29": "[",
"30": "a",
"31": ".",
"32": "n",
"33": "e",
"34": "s",
"35": "t",
"36": "e",
"37": "d",
"38": ".",
"39": "k",
"40": "e",
"41": "y",
"42": "]",
"43": "=",
"44": "v",
"45": "a",
"46": "l",
"47": "u",
"48": "e",
"49": "2",
},
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CountAccountsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.CountAccountsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Count the transactions from a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.countTransactions({
account: "users:001",
destination: "users:001",
ledger: "ledger001",
metadata: {},
reference: "ref:001",
source: "users:001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CountTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.CountTransactionsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Create a new transaction to a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.createTransaction({
postTransaction: {
postings: [
{
amount: BigInt("100"),
asset: "COIN",
destination: "users:002",
source: "users:001",
},
],
reference: "ref:001",
script: {
plain: "vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
",
vars: {
"user": "users:042",
},
},
},
ledger: "ledger001",
preview: true,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.CreateTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get account by its address
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getAccount({
address: "users:001",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetAccountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get the balances from a ledger's account
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getBalances({
address: "users:001",
after: "users:003",
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetBalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetBalancesResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get the aggregated balances from selected accounts
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getBalancesAggregated({
address: "users:001",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetBalancesAggregatedRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetBalancesAggregatedResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Show server information
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getInfo();
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetInfoResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get information about a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getLedgerInfo({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetLedgerInfoRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetLedgerInfoResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get the mapping of a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getMapping({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetMappingRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetMappingResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get transaction from a ledger by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.getTransaction({
ledger: "ledger001",
txid: BigInt("1234"),
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List accounts from a ledger, sorted by address in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.listAccounts({
address: "users:.+",
after: "users:003",
balance: 2400,
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
metadata: {
"0": "m",
"1": "e",
"2": "t",
"3": "a",
"4": "d",
"5": "a",
"6": "t",
"7": "a",
"8": "[",
"9": "k",
"10": "e",
"11": "y",
"12": "]",
"13": "=",
"14": "v",
"15": "a",
"16": "l",
"17": "u",
"18": "e",
"19": "1",
"20": "&",
"21": "m",
"22": "e",
"23": "t",
"24": "a",
"25": "d",
"26": "a",
"27": "t",
"28": "a",
"29": "[",
"30": "a",
"31": ".",
"32": "n",
"33": "e",
"34": "s",
"35": "t",
"36": "e",
"37": "d",
"38": ".",
"39": "k",
"40": "e",
"41": "y",
"42": "]",
"43": "=",
"44": "v",
"45": "a",
"46": "l",
"47": "u",
"48": "e",
"49": "2",
},
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListAccountsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.ListAccountsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List the logs from a ledger, sorted by ID in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.listLogs({
after: "1234",
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListLogsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.ListLogsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List transactions from a ledger, sorted by txid in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.listTransactions({
account: "users:001",
after: "1234",
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
destination: "users:001",
ledger: "ledger001",
pageSize: 100,
reference: "ref:001",
source: "users:001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.ListTransactionsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get statistics from a ledger. (aggregate metrics on accounts and transactions)
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.readStats({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ReadStatsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.ReadStatsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Revert a ledger transaction by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.revertTransaction({
ledger: "ledger001",
txid: BigInt("1234"),
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.RevertTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.RevertTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
This route is deprecated, and has been merged into POST /{ledger}/transactions
.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.runScript({
script: {
plain: "vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
",
reference: "order_1234",
vars: {
"user": "users:042",
},
},
ledger: "ledger001",
preview: true,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.RunScriptRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.RunScriptResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Update the mapping of a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.updateMapping({
mapping: {
contracts: [
{
account: "users:001",
expr: {},
},
],
},
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateMappingRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.UpdateMappingResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Set the metadata of a transaction by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2AddMetadataOnTransaction({
requestBody: {
"admin": "true",
},
dryRun: true,
id: BigInt("1234"),
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2AddMetadataOnTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2AddMetadataOnTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Add metadata to an account
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2AddMetadataToAccount({
requestBody: {
"admin": "true",
},
address: "users:001",
dryRun: true,
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2AddMetadataToAccountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2AddMetadataToAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Count the accounts from a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2CountAccounts({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2CountAccountsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2CountAccountsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Count the transactions from a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2CountTransactions({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2CountTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2CountTransactionsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Bulk request
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2CreateBulk({
requestBody: [
{
action: "<value>",
},
],
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2CreateBulkRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2CreateBulkResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Create a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2CreateLedger({
v2CreateLedgerRequest: {
metadata: {
"admin": "true",
},
},
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2CreateLedgerRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2CreateLedgerResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Create a new transaction to a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2CreateTransaction({
v2PostTransaction: {
metadata: {
"admin": "true",
},
postings: [
{
amount: BigInt("100"),
asset: "COIN",
destination: "users:002",
source: "users:001",
},
],
reference: "ref:001",
script: {
plain: "vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
",
vars: {
"user": "users:042",
},
},
},
dryRun: true,
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2CreateTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2CreateTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Delete metadata by key
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2DeleteAccountMetadata({
address: "3680 Emile Grove",
key: "foo",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2DeleteAccountMetadataRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2DeleteAccountMetadataResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Delete ledger metadata by key
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2DeleteLedgerMetadata({
key: "foo",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2DeleteLedgerMetadataRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2DeleteLedgerMetadataResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Delete metadata by key
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2DeleteTransactionMetadata({
id: BigInt("1234"),
key: "foo",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2DeleteTransactionMetadataRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2DeleteTransactionMetadataResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get account by its address
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetAccount({
address: "users:001",
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetAccountRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get the aggregated balances from selected accounts
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetBalancesAggregated({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetBalancesAggregatedRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetBalancesAggregatedResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Show server information
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetInfo();
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetInfoResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetLedger({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetLedgerRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetLedgerResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get information about a ledger
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetLedgerInfo({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetLedgerInfoRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetLedgerInfoResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get transaction from a ledger by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetTransaction({
id: BigInt("1234"),
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get list of volumes with balances for (account/asset)
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2GetVolumesWithBalances({
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
groupBy: 3,
ledger: "ledger001",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2GetVolumesWithBalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2GetVolumesWithBalancesResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List accounts from a ledger, sorted by address in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2ListAccounts({
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2ListAccountsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2ListAccountsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List ledgers
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2ListLedgers({
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2ListLedgersRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2ListLedgersResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List the logs from a ledger, sorted by ID in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2ListLogs({
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2ListLogsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2ListLogsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
List transactions from a ledger, sorted by id in descending order.
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2ListTransactions({
cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==",
ledger: "ledger001",
pageSize: 100,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2ListTransactionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2ListTransactionsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Get statistics from a ledger. (aggregate metrics on accounts and transactions)
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2ReadStats({
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2ReadStatsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2ReadStatsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Revert a ledger transaction by its ID
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2RevertTransaction({
id: BigInt("1234"),
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2RevertTransactionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2RevertTransactionResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |
Update ledger metadata
import { SDK } from "@formance/formance-sdk";
const sdk = new SDK({
authorization: "<YOUR_AUTHORIZATION_HERE>",
});
async function run() {
const result = await sdk.ledger.v2UpdateLedgerMetadata({
requestBody: {
"admin": "true",
},
ledger: "ledger001",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.V2UpdateLedgerMetadataRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.V2UpdateLedgerMetadataResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.V2ErrorResponse | default | application/json |
errors.SDKError | 4xx-5xx | / |