@silvana-one/api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/node/client/sdk.gen.d.ts +153 -0
- package/dist/node/client/sdk.gen.js +269 -0
- package/dist/node/client/sdk.gen.js.map +1 -0
- package/dist/node/client/types.gen.d.ts +1068 -0
- package/dist/node/client/types.gen.js +3 -0
- package/dist/node/client/types.gen.js.map +1 -0
- package/dist/node/config.d.ts +5 -0
- package/dist/node/config.js +15 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/index.cjs +286 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.js +9 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/wait.d.ts +2 -0
- package/dist/node/wait.js +58 -0
- package/dist/node/wait.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsconfig.web.tsbuildinfo +1 -0
- package/dist/web/client/sdk.gen.d.ts +153 -0
- package/dist/web/client/sdk.gen.js +269 -0
- package/dist/web/client/sdk.gen.js.map +1 -0
- package/dist/web/client/types.gen.d.ts +1068 -0
- package/dist/web/client/types.gen.js +3 -0
- package/dist/web/client/types.gen.js.map +1 -0
- package/dist/web/config.d.ts +5 -0
- package/dist/web/config.js +15 -0
- package/dist/web/config.js.map +1 -0
- package/dist/web/index.d.ts +4 -0
- package/dist/web/index.js +9 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/wait.d.ts +2 -0
- package/dist/web/wait.js +58 -0
- package/dist/web/wait.js.map +1 -0
- package/package.json +61 -0
- package/src/client/sdk.gen.ts +294 -0
- package/src/client/types.gen.ts +1211 -0
- package/src/config.ts +24 -0
- package/src/index.ts +8 -0
- package/src/wait.ts +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.gen.js","sourceRoot":"","sources":["../../../src/client/types.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { client } from "./client/sdk.gen.js";
|
|
2
|
+
export function config({ apiKey, chain, throwOnError, }) {
|
|
3
|
+
client.setConfig({
|
|
4
|
+
headers: {
|
|
5
|
+
"x-api-key": apiKey,
|
|
6
|
+
},
|
|
7
|
+
baseUrl: chain === "zeko"
|
|
8
|
+
? "https://zekotokens.com/api/v1/"
|
|
9
|
+
: chain === "devnet"
|
|
10
|
+
? "https://devnet.silvana-one.com/api/v1/"
|
|
11
|
+
: "https://silvana-one.com/api/v1/",
|
|
12
|
+
throwOnError: throwOnError ?? true,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,UAAU,MAAM,CAAC,EACrB,MAAM,EACN,KAAK,EACL,YAAY,GAKb;IACC,MAAM,CAAC,SAAS,CAAC;QACf,OAAO,EAAE;YACP,WAAW,EAAE,MAAM;SACpB;QACD,OAAO,EACL,KAAK,KAAK,MAAM;YACd,CAAC,CAAC,gCAAgC;YAClC,CAAC,CAAC,KAAK,KAAK,QAAQ;gBACpB,CAAC,CAAC,wCAAwC;gBAC1C,CAAC,CAAC,iCAAiC;QACvC,YAAY,EAAE,YAAY,IAAI,IAAI;KACnC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// export * from "./api.js";
|
|
2
|
+
// export * from "./transaction.js";
|
|
3
|
+
// export * from "./token.js";
|
|
4
|
+
// export * from "./nft-v2.js";
|
|
5
|
+
export * from "./client/sdk.gen.js";
|
|
6
|
+
export * from "./client/types.gen.js";
|
|
7
|
+
export * from "./config.js";
|
|
8
|
+
export * from "./wait.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,oCAAoC;AACpC,8BAA8B;AAC9B,+BAA+B;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
package/dist/web/wait.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getProof, txStatus } from "./client/sdk.gen.js";
|
|
2
|
+
export async function waitForProofs(jobId) {
|
|
3
|
+
console.log("Job ID:", jobId);
|
|
4
|
+
let errorCount = 0;
|
|
5
|
+
const startTime = Date.now();
|
|
6
|
+
console.log("Waiting for job result...");
|
|
7
|
+
while (errorCount < 100 && Date.now() - startTime < 1000 * 60 * 10) {
|
|
8
|
+
try {
|
|
9
|
+
const jobResults = (await getProof({ body: { jobId } })).data;
|
|
10
|
+
const jobStatus = jobResults?.jobStatus;
|
|
11
|
+
if (jobResults?.success === true &&
|
|
12
|
+
(jobStatus === "finished" || jobStatus === "used")) {
|
|
13
|
+
return jobResults.results?.map((result) => result.hash ?? "") ?? [];
|
|
14
|
+
}
|
|
15
|
+
if (jobStatus === "failed") {
|
|
16
|
+
console.error(`Job ${jobId} failed`);
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
errorCount++;
|
|
22
|
+
console.error(error);
|
|
23
|
+
}
|
|
24
|
+
await sleep(10000);
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
export async function waitForTransaction(hash, timeout = 1000 * 60 * 60 * 5) {
|
|
29
|
+
console.log(`Waiting for transaction ${hash} to be included in a block...`);
|
|
30
|
+
const startTime = Date.now();
|
|
31
|
+
let status = "pending";
|
|
32
|
+
let errorCount = 0;
|
|
33
|
+
while (status !== "applied" &&
|
|
34
|
+
errorCount < 100 &&
|
|
35
|
+
Date.now() - startTime < timeout) {
|
|
36
|
+
try {
|
|
37
|
+
const result = (await txStatus({ body: { hash } })).data;
|
|
38
|
+
status = result?.status ?? "pending";
|
|
39
|
+
if (status === "failed") {
|
|
40
|
+
throw new Error(`Transaction ${hash} failed: ${JSON.stringify({ result })}`);
|
|
41
|
+
}
|
|
42
|
+
else if (status === "applied") {
|
|
43
|
+
console.log(`Transaction ${hash} included in a block`, result);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
errorCount++;
|
|
49
|
+
console.error(error);
|
|
50
|
+
}
|
|
51
|
+
await sleep(30000);
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Transaction ${hash} not included in a block, timeout or too many errors`);
|
|
54
|
+
}
|
|
55
|
+
async function sleep(ms) {
|
|
56
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=wait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@silvana-one/api",
|
|
3
|
+
"description": "Silvana API",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": "DFST",
|
|
6
|
+
"bugs": "https://github.com/SilvanaOne/silvana-lib/issues",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@hey-api/client-fetch": "^0.5.6"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@hey-api/openapi-ts": "^0.60.0",
|
|
12
|
+
"@types/node": "^22.10.2",
|
|
13
|
+
"esbuild": "^0.24.0",
|
|
14
|
+
"typescript": "^5.7.2"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20.0.0"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
"types": "./dist/node/index.d.ts",
|
|
21
|
+
"node": {
|
|
22
|
+
"import": "./dist/node/index.js",
|
|
23
|
+
"require": "./dist/node/index.cjs"
|
|
24
|
+
},
|
|
25
|
+
"browser": "./dist/web/index.js",
|
|
26
|
+
"default": "./dist/web/index.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"src",
|
|
31
|
+
"package.json",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://docs.silvana.one",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"cloud",
|
|
38
|
+
"fungible-token",
|
|
39
|
+
"mina-protocol",
|
|
40
|
+
"silvana",
|
|
41
|
+
"NFT",
|
|
42
|
+
"proving",
|
|
43
|
+
"tokens",
|
|
44
|
+
"typescript"
|
|
45
|
+
],
|
|
46
|
+
"license": "Apache-2.0",
|
|
47
|
+
"main": "dist/web/index.js",
|
|
48
|
+
"peerDependencies": {},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"repository": "SilvanaOne/silvana-lib.git",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "rm -rf dist && tsc && tsc --build tsconfig.web.json && node build-cjs.js",
|
|
55
|
+
"generate": "npm run validate && openapi-ts && rm src/client/index.ts && node replace-import.cjs && npm run build",
|
|
56
|
+
"release": "npm publish --access public",
|
|
57
|
+
"validate": "swagger-cli validate open-api.yaml"
|
|
58
|
+
},
|
|
59
|
+
"type": "module",
|
|
60
|
+
"types": "./dist/node/index.d.ts"
|
|
61
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch';
|
|
4
|
+
import type { LaunchTokenData, LaunchTokenError, LaunchTokenResponse, GetContractInfoData, GetContractInfoError, GetContractInfoResponse, GetNftV2InfoData, GetNftV2InfoError, GetNftV2InfoResponse, FaucetData, FaucetError, FaucetResponse2, GetTokenInfoData, GetTokenInfoError, GetTokenInfoResponse, GetTokenBalanceData, GetTokenBalanceError, GetTokenBalanceResponse, ProveData, ProveError, ProveResponse, GetProofData, GetProofError, GetProofResponse, TxStatusData, TxStatusError, TxStatusResponse, MintTokensData, MintTokensError, MintTokensResponse, TransferTokensData, TransferTokensError, TransferTokensResponse, AirdropTokensData, AirdropTokensError, AirdropTokensResponse, RedeemTokensData, RedeemTokensError, RedeemTokensResponse, BurnTokensData, BurnTokensError, BurnTokensResponse, TokenBidData, TokenBidError, TokenBidResponse, TokenOfferData, TokenOfferError, TokenOfferResponse, BuyTokensData, BuyTokensError, BuyTokensResponse, SellTokensData, SellTokensError, SellTokensResponse, WithdrawTokenBidData, WithdrawTokenBidError, WithdrawTokenBidResponse, WithdrawTokenOfferData, WithdrawTokenOfferError, WithdrawTokenOfferResponse, UpdateTokenBidWhitelistData, UpdateTokenBidWhitelistError, UpdateTokenBidWhitelistResponse, UpdateTokenOfferWhitelistData, UpdateTokenOfferWhitelistError, UpdateTokenOfferWhitelistResponse, UpdateTokenAdminWhitelistData, UpdateTokenAdminWhitelistError, UpdateTokenAdminWhitelistResponse } from './types.gen.js';
|
|
5
|
+
|
|
6
|
+
export const client = createClient(createConfig());
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Deploy a new fungible token contract.
|
|
10
|
+
* The `launch` endpoint is used to deploy a new fungible token on the Mina blockchain.
|
|
11
|
+
* It allows users to create a new token with customizable parameters such as symbol,
|
|
12
|
+
* decimals, URI, and admin contract type (standard or advanced).
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export const launchToken = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<LaunchTokenData, ThrowOnError>) => {
|
|
16
|
+
return (options?.client ?? client).post<LaunchTokenResponse, LaunchTokenError, ThrowOnError>({
|
|
17
|
+
...options,
|
|
18
|
+
url: '/token/launch'
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve contract info
|
|
24
|
+
* Retrieves detailed information about a contract.
|
|
25
|
+
*/
|
|
26
|
+
export const getContractInfo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetContractInfoData, ThrowOnError>) => {
|
|
27
|
+
return (options?.client ?? client).post<GetContractInfoResponse, GetContractInfoError, ThrowOnError>({
|
|
28
|
+
...options,
|
|
29
|
+
url: '/info/contract'
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve NFT Info
|
|
35
|
+
* Retrieves detailed information about a Mina NFT V2.
|
|
36
|
+
*/
|
|
37
|
+
export const getNftV2Info = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetNftV2InfoData, ThrowOnError>) => {
|
|
38
|
+
return (options?.client ?? client).post<GetNftV2InfoResponse, GetNftV2InfoError, ThrowOnError>({
|
|
39
|
+
...options,
|
|
40
|
+
url: '/info/nft-v2'
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Request Funds from Faucet
|
|
46
|
+
* Requests funds from the faucet for testing purposes.
|
|
47
|
+
*/
|
|
48
|
+
export const faucet = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<FaucetData, ThrowOnError>) => {
|
|
49
|
+
return (options?.client ?? client).post<FaucetResponse2, FaucetError, ThrowOnError>({
|
|
50
|
+
...options,
|
|
51
|
+
url: '/faucet'
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Retrieve information about a fungible token.
|
|
57
|
+
* The `info` endpoint retrieves detailed information about a specific fungible token deployed on the Mina blockchain.
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
export const getTokenInfo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTokenInfoData, ThrowOnError>) => {
|
|
61
|
+
return (options?.client ?? client).post<GetTokenInfoResponse, GetTokenInfoError, ThrowOnError>({
|
|
62
|
+
...options,
|
|
63
|
+
url: '/info/token'
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve the balance of a specific token for an address.
|
|
69
|
+
* The `balance` endpoint retrieves the balance of a specific fungible token for a given Mina address.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
export const getTokenBalance = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTokenBalanceData, ThrowOnError>) => {
|
|
73
|
+
return (options?.client ?? client).post<GetTokenBalanceResponse, GetTokenBalanceError, ThrowOnError>({
|
|
74
|
+
...options,
|
|
75
|
+
url: '/info/balance'
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Generate proofs for signed token transactions.
|
|
81
|
+
* The `prove` endpoint initiates the proof generation process for a set of signed token transactions.
|
|
82
|
+
* It returns a job ID which can be used to check the status and retrieve the proofs or tx hashes using the `/proof` endpoint.
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
export const prove = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<ProveData, ThrowOnError>) => {
|
|
86
|
+
return (options?.client ?? client).post<ProveResponse, ProveError, ThrowOnError>({
|
|
87
|
+
...options,
|
|
88
|
+
url: '/transaction/prove'
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Check the status of a proof generation job and retrieve proofs.
|
|
94
|
+
* The `proof` endpoint allows you to check the status of a proof generation job initiated via the `/prove` endpoint.
|
|
95
|
+
* It returns the status of the job and the proofs or tx hashes if they are ready.
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
export const getProof = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetProofData, ThrowOnError>) => {
|
|
99
|
+
return (options?.client ?? client).post<GetProofResponse, GetProofError, ThrowOnError>({
|
|
100
|
+
...options,
|
|
101
|
+
url: '/transaction/proof'
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Retrieve the status of a transaction by its hash.
|
|
107
|
+
* The `tx-status` endpoint allows you to check the current status of a transaction on the Mina blockchain by providing the transaction hash. It returns whether the transaction has been applied, failed, or is still pending.
|
|
108
|
+
*
|
|
109
|
+
*/
|
|
110
|
+
export const txStatus = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TxStatusData, ThrowOnError>) => {
|
|
111
|
+
return (options?.client ?? client).post<TxStatusResponse, TxStatusError, ThrowOnError>({
|
|
112
|
+
...options,
|
|
113
|
+
url: '/transaction/status'
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Mint new tokens to a specified address.
|
|
119
|
+
* The `mint` endpoint allows authorized users to mint new tokens of a fungible token on the Mina blockchain.
|
|
120
|
+
* This transaction increases the total supply of the token by creating new tokens and assigning them to a specified address.
|
|
121
|
+
* The sender must have the authority to mint tokens, typically the admin of the token contract.
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
124
|
+
export const mintTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<MintTokensData, ThrowOnError>) => {
|
|
125
|
+
return (options?.client ?? client).post<MintTokensResponse, MintTokensError, ThrowOnError>({
|
|
126
|
+
...options,
|
|
127
|
+
url: '/token/mint'
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Transfer tokens from one address to another.
|
|
133
|
+
* The `transfer` endpoint allows users to transfer tokens of a fungible token on the Mina blockchain from one address to another.
|
|
134
|
+
* The sender must have sufficient balance and appropriate permissions to perform the transfer.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
export const transferTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TransferTokensData, ThrowOnError>) => {
|
|
138
|
+
return (options?.client ?? client).post<TransferTokensResponse, TransferTokensError, ThrowOnError>({
|
|
139
|
+
...options,
|
|
140
|
+
url: '/token/transfer'
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Distribute tokens to multiple addresses via airdrop.
|
|
146
|
+
* Allows users to distribute tokens to multiple addresses in a single transaction.
|
|
147
|
+
* This is efficient for distributing tokens during events like token launches or community rewards.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
export const airdropTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<AirdropTokensData, ThrowOnError>) => {
|
|
151
|
+
return (options?.client ?? client).post<AirdropTokensResponse, AirdropTokensError, ThrowOnError>({
|
|
152
|
+
...options,
|
|
153
|
+
url: '/token/airdrop'
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Redeem tokens for a MINA (applicable for Fungible Tokens with Bonding Curve Admin)
|
|
159
|
+
* The `redeem` endpoint allows users to redeem tokens of a fungible token on the Mina blockchain for a MINA.
|
|
160
|
+
* The sender must have sufficient balance and appropriate permissions to perform the transfer.
|
|
161
|
+
*
|
|
162
|
+
*/
|
|
163
|
+
export const redeemTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<RedeemTokensData, ThrowOnError>) => {
|
|
164
|
+
return (options?.client ?? client).post<RedeemTokensResponse, RedeemTokensError, ThrowOnError>({
|
|
165
|
+
...options,
|
|
166
|
+
url: '/token/redeem'
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Burn tokens from one address.
|
|
172
|
+
* The `burn` endpoint allows users to burn tokens of a fungible token on the Mina blockchain from one address.
|
|
173
|
+
* The sender must have sufficient balance and appropriate permissions to perform the burn.
|
|
174
|
+
*
|
|
175
|
+
*/
|
|
176
|
+
export const burnTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<BurnTokensData, ThrowOnError>) => {
|
|
177
|
+
return (options?.client ?? client).post<BurnTokensResponse, BurnTokensError, ThrowOnError>({
|
|
178
|
+
...options,
|
|
179
|
+
url: '/token/burn'
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Place a bid on a token
|
|
185
|
+
* Allows users to place a bid on an token.
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
export const tokenBid = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TokenBidData, ThrowOnError>) => {
|
|
189
|
+
return (options?.client ?? client).post<TokenBidResponse, TokenBidError, ThrowOnError>({
|
|
190
|
+
...options,
|
|
191
|
+
url: '/token/bid/create'
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Create an offer to sell tokens at a specified price.
|
|
197
|
+
* Allows users to create an offer to sell a specified amount of tokens at a given price.
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
export const tokenOffer = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<TokenOfferData, ThrowOnError>) => {
|
|
201
|
+
return (options?.client ?? client).post<TokenOfferResponse, TokenOfferError, ThrowOnError>({
|
|
202
|
+
...options,
|
|
203
|
+
url: '/token/offer/create'
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Purchase tokens from an existing offer.
|
|
209
|
+
* Allows users to purchase tokens from an existing offer on the Mina blockchain.
|
|
210
|
+
* This endpoint facilitates the transaction where tokens are transferred from the offer address to the buyer's address in exchange for the specified price.
|
|
211
|
+
*
|
|
212
|
+
*/
|
|
213
|
+
export const buyTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<BuyTokensData, ThrowOnError>) => {
|
|
214
|
+
return (options?.client ?? client).post<BuyTokensResponse, BuyTokensError, ThrowOnError>({
|
|
215
|
+
...options,
|
|
216
|
+
url: '/token/offer/buy'
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Sell a token to the Bid contract.
|
|
222
|
+
* Allows token owners to sell their tokens to the Bid contract.
|
|
223
|
+
*
|
|
224
|
+
*/
|
|
225
|
+
export const sellTokens = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<SellTokensData, ThrowOnError>) => {
|
|
226
|
+
return (options?.client ?? client).post<SellTokensResponse, SellTokensError, ThrowOnError>({
|
|
227
|
+
...options,
|
|
228
|
+
url: '/token/bid/sell'
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Withdraw a previously placed bid on an token.
|
|
234
|
+
* Allows users to withdraw a bid they have previously placed using the `/bid` endpoint.
|
|
235
|
+
* This transaction cancels the active bid, releasing any locked funds.
|
|
236
|
+
*
|
|
237
|
+
*/
|
|
238
|
+
export const withdrawTokenBid = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<WithdrawTokenBidData, ThrowOnError>) => {
|
|
239
|
+
return (options?.client ?? client).post<WithdrawTokenBidResponse, WithdrawTokenBidError, ThrowOnError>({
|
|
240
|
+
...options,
|
|
241
|
+
url: '/token/bid/withdraw'
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Withdraw a previously made offer to sell a token.
|
|
247
|
+
* Allows users to withdraw an offer they have previously made using the `/offer` endpoint.
|
|
248
|
+
* This transaction cancels the active offer, releasing any locked tokens.
|
|
249
|
+
*
|
|
250
|
+
*/
|
|
251
|
+
export const withdrawTokenOffer = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<WithdrawTokenOfferData, ThrowOnError>) => {
|
|
252
|
+
return (options?.client ?? client).post<WithdrawTokenOfferResponse, WithdrawTokenOfferError, ThrowOnError>({
|
|
253
|
+
...options,
|
|
254
|
+
url: '/token/offer/withdraw'
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Update the bid whitelist
|
|
260
|
+
* Allows administrators to update the whitelist of addresses permitted to interact with the Bid contract.
|
|
261
|
+
* This is essential for managing participation in bidding processes, especially for controlled or private auctions.
|
|
262
|
+
*
|
|
263
|
+
*/
|
|
264
|
+
export const updateTokenBidWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenBidWhitelistData, ThrowOnError>) => {
|
|
265
|
+
return (options?.client ?? client).post<UpdateTokenBidWhitelistResponse, UpdateTokenBidWhitelistError, ThrowOnError>({
|
|
266
|
+
...options,
|
|
267
|
+
url: '/token/bid/whitelist'
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Update the offer whitelist
|
|
273
|
+
* Allows administrators to update the whitelist of addresses permitted to interact with the Offer contract.
|
|
274
|
+
* This is essential for managing participation in offer processes, especially for controlled or private sales.
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
export const updateTokenOfferWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenOfferWhitelistData, ThrowOnError>) => {
|
|
278
|
+
return (options?.client ?? client).post<UpdateTokenOfferWhitelistResponse, UpdateTokenOfferWhitelistError, ThrowOnError>({
|
|
279
|
+
...options,
|
|
280
|
+
url: '/token/offer/whitelist'
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Update the advanced admin whitelist
|
|
286
|
+
* Allows administrators to update the whitelist of admin contracts.
|
|
287
|
+
*
|
|
288
|
+
*/
|
|
289
|
+
export const updateTokenAdminWhitelist = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<UpdateTokenAdminWhitelistData, ThrowOnError>) => {
|
|
290
|
+
return (options?.client ?? client).post<UpdateTokenAdminWhitelistResponse, UpdateTokenAdminWhitelistError, ThrowOnError>({
|
|
291
|
+
...options,
|
|
292
|
+
url: '/token/admin/whitelist'
|
|
293
|
+
});
|
|
294
|
+
};
|