@defillama/sdk 5.0.235 → 5.0.238
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/build/ChainApi.d.ts +23 -1
- package/build/ChainApi.js +13 -0
- package/build/abi/tron.js +7 -1
- package/build/chains/algorand.d.ts +277 -0
- package/build/chains/algorand.js +618 -0
- package/build/chains/aptos.d.ts +230 -0
- package/build/chains/aptos.js +612 -0
- package/build/chains/cardano.d.ts +242 -0
- package/build/chains/cardano.js +407 -0
- package/build/chains/cosmos.d.ts +252 -0
- package/build/chains/cosmos.js +618 -0
- package/build/chains/icp.d.ts +235 -0
- package/build/chains/icp.js +1040 -0
- package/build/chains/index.d.ts +23 -0
- package/build/chains/index.js +59 -0
- package/build/chains/near.d.ts +192 -0
- package/build/chains/near.js +446 -0
- package/build/chains/rpc.d.ts +125 -0
- package/build/chains/rpc.js +326 -0
- package/build/chains/starknet.d.ts +205 -0
- package/build/chains/starknet.js +884 -0
- package/build/chains/stellar.d.ts +410 -0
- package/build/chains/stellar.js +1082 -0
- package/build/chains/substrate.d.ts +333 -0
- package/build/chains/substrate.js +1042 -0
- package/build/chains/sui.d.ts +365 -0
- package/build/chains/sui.js +1135 -0
- package/build/chains/svm.d.ts +340 -0
- package/build/chains/svm.js +760 -0
- package/build/chains/tezos.d.ts +225 -0
- package/build/chains/tezos.js +412 -0
- package/build/chains/ton.d.ts +353 -0
- package/build/chains/ton.js +788 -0
- package/build/chains/tron.d.ts +45 -0
- package/build/chains/tron.js +110 -0
- package/build/chains/utxo.d.ts +202 -0
- package/build/chains/utxo.js +592 -0
- package/build/chains/xrpl.d.ts +179 -0
- package/build/chains/xrpl.js +467 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +3 -1
- package/build/providers.json +1 -1
- package/build/util/LlamaProvider.js +2 -0
- package/build/util/blocks.js +292 -84
- package/build/util/chainUtils/data.json +80 -0
- package/build/util/chainUtils/index.d.ts +1 -0
- package/build/util/chainUtils/index.js +23 -0
- package/build/util/coins.js +14 -3
- package/build/util/common.js +6 -4
- package/build/util/computeTVL.js +1 -1
- package/build/util/cosmos.d.ts +1 -11
- package/build/util/cosmos.js +6 -66
- package/build/util/env.d.ts +1 -0
- package/build/util/env.js +18 -0
- package/build/util/indexer.compatibility.d.ts +6 -0
- package/build/util/indexer.compatibility.js +64 -0
- package/build/util/indexer.d.ts +24 -2
- package/build/util/indexer.js +333 -294
- package/build/util/indexerSql.d.ts +8 -1
- package/build/util/indexerSql.js +53 -22
- package/build/util/logs.d.ts +3 -0
- package/build/util/logs.decode.shared.js +5 -4
- package/build/util/logs.js +57 -26
- package/build/util/transactions.d.ts +23 -1
- package/build/util/updateChainLabels.d.ts +1 -0
- package/build/util/updateChainLabels.js +5 -0
- package/build/util/updateProviderList.js +40 -18
- package/package.json +20 -7
- package/README.md +0 -41
package/build/ChainApi.d.ts
CHANGED
|
@@ -112,7 +112,29 @@ export declare class ChainApi {
|
|
|
112
112
|
}>;
|
|
113
113
|
getLogs(params: GetLogsOptions): Promise<any[] | import("ethers").EventLog[] | import("ethers").EventLog[][]>;
|
|
114
114
|
getBalancesV2(): Balances;
|
|
115
|
-
getTransactions(params: GetTransactionOptions): Promise<
|
|
115
|
+
getTransactions(params: GetTransactionOptions): Promise<{
|
|
116
|
+
hash: any;
|
|
117
|
+
blockNumber: number;
|
|
118
|
+
transactionIndex: number;
|
|
119
|
+
from: any;
|
|
120
|
+
to: any;
|
|
121
|
+
value: any;
|
|
122
|
+
gasPrice: any;
|
|
123
|
+
gas: any;
|
|
124
|
+
input: any;
|
|
125
|
+
nonce: number;
|
|
126
|
+
data: any;
|
|
127
|
+
type: any;
|
|
128
|
+
maxFeePerGas: any;
|
|
129
|
+
maxPriorityFeePerGas: any;
|
|
130
|
+
baseFeePerGas: any;
|
|
131
|
+
effectiveGasPrice: any;
|
|
132
|
+
gasUsed: any;
|
|
133
|
+
cumulativeGasUsed: any;
|
|
134
|
+
status: number;
|
|
135
|
+
contractCreated: any;
|
|
136
|
+
timestamp: any;
|
|
137
|
+
}[] | null>;
|
|
116
138
|
getTransactionReceipt(tx: string): Promise<import("ethers").TransactionReceipt | null>;
|
|
117
139
|
getStats(): DebugStats;
|
|
118
140
|
}
|
package/build/ChainApi.js
CHANGED
|
@@ -17,6 +17,15 @@ const logs_1 = __importDefault(require("./util/logs"));
|
|
|
17
17
|
const transactions_1 = require("./util/transactions");
|
|
18
18
|
const callStatsByProject = {};
|
|
19
19
|
const nullAddress = '0x0000000000000000000000000000000000000000';
|
|
20
|
+
// ERC-20 views of the native coin: balanceOf returns the same balance as eth_getBalance, so when summing
|
|
21
|
+
// they are read as the native coin and deduped per owner, otherwise listing both counts the coin twice
|
|
22
|
+
const nativeTokenAliases = {
|
|
23
|
+
polygon: '0x0000000000000000000000000000000000001010', // POL (MRC20)
|
|
24
|
+
celo: '0x471ece3750da237f93b8e339c536989b8978a438', // CELO (GoldToken)
|
|
25
|
+
metis: '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // METIS
|
|
26
|
+
arc: '0x3600000000000000000000000000000000000000', // USDC (6 decimals, native is 18)
|
|
27
|
+
stable: '0x779ded0c9e1022225f8e0630b35a9b54be713736', // USDT0 (6 decimals, native is 18)
|
|
28
|
+
};
|
|
20
29
|
class ChainApi {
|
|
21
30
|
constructor(params) {
|
|
22
31
|
var _a, _b;
|
|
@@ -197,6 +206,10 @@ class ChainApi {
|
|
|
197
206
|
blacklistedOwners = (0, common_1.getUniqueAddresses)(blacklistedOwners, this.chain);
|
|
198
207
|
blacklistedTokens = (0, common_1.getUniqueAddresses)(blacklistedTokens, this.chain);
|
|
199
208
|
tokensAndOwners = tokensAndOwners.filter(i => !blacklistedTokens.includes(i[0]) && !blacklistedOwners.includes(i[1]));
|
|
209
|
+
// only when summing: plain balance lookups expect the alias's own (ERC-20 decimals) value back
|
|
210
|
+
const nativeAlias = nativeTokenAliases[this.chain];
|
|
211
|
+
if (skipDuplicates && nativeAlias)
|
|
212
|
+
tokensAndOwners = getUniqueTokensAndOwners(tokensAndOwners.map(([t, o]) => [t === nativeAlias ? nullAddress : t, o]), this.chain);
|
|
200
213
|
const tokenBalances = [];
|
|
201
214
|
const erc20TokensResponseIndex = [];
|
|
202
215
|
const ethBalanceResponseIndex = [];
|
package/build/abi/tron.js
CHANGED
|
@@ -65,7 +65,13 @@ async function getBalance(params) {
|
|
|
65
65
|
throw new Error('getBalance: target is required');
|
|
66
66
|
const data = await limitRPCCalls(() => {
|
|
67
67
|
if (!balanceCache[params.target])
|
|
68
|
-
|
|
68
|
+
// drop the entry if the request fails, otherwise the rejected promise is served to every
|
|
69
|
+
// later call for this address and the process never retries it
|
|
70
|
+
balanceCache[params.target] = post({ address: params.target, visible: true, }, '/wallet/getaccount')
|
|
71
|
+
.catch((e) => {
|
|
72
|
+
delete balanceCache[params.target];
|
|
73
|
+
throw e;
|
|
74
|
+
});
|
|
69
75
|
return balanceCache[params.target];
|
|
70
76
|
});
|
|
71
77
|
const frozenBalance = (_b = (_a = data.frozen) === null || _a === void 0 ? void 0 : _a.reduce((t, { frozen_balance }) => t + frozen_balance, 0)) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
export declare const DEFAULT_INDEXER = "https://mainnet-idx.algonode.cloud";
|
|
2
|
+
export declare const DEFAULT_ALGOD = "https://mainnet-api.algonode.cloud";
|
|
3
|
+
/** Indexer endpoint list: `ALGORAND_INDEXER` env (comma separated) or the default. */
|
|
4
|
+
export declare function getIndexerEndpoints(): string[];
|
|
5
|
+
/** First indexer endpoint. */
|
|
6
|
+
export declare function getIndexerEndpoint(): string;
|
|
7
|
+
/** Algod endpoint list: `ALGORAND_RPC` env (comma separated) or the default. */
|
|
8
|
+
export declare function getAlgodEndpoints(): string[];
|
|
9
|
+
/** First algod endpoint. */
|
|
10
|
+
export declare function getAlgodEndpoint(): string;
|
|
11
|
+
export type AlgoAmount = number | string;
|
|
12
|
+
export interface GlobalStateEntry {
|
|
13
|
+
key: string;
|
|
14
|
+
value: {
|
|
15
|
+
type: number;
|
|
16
|
+
bytes?: string;
|
|
17
|
+
uint?: AlgoAmount;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface AlgorandApplication {
|
|
21
|
+
id: number;
|
|
22
|
+
'created-at-round'?: number;
|
|
23
|
+
deleted?: boolean;
|
|
24
|
+
params: {
|
|
25
|
+
creator: string;
|
|
26
|
+
'global-state'?: GlobalStateEntry[];
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export interface AlgorandAssetHolding {
|
|
32
|
+
'asset-id': AlgoAmount;
|
|
33
|
+
amount: AlgoAmount;
|
|
34
|
+
'is-frozen'?: boolean;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
export interface AlgorandAccount {
|
|
38
|
+
address: string;
|
|
39
|
+
amount: AlgoAmount;
|
|
40
|
+
assets?: AlgorandAssetHolding[];
|
|
41
|
+
'created-apps'?: AlgorandApplication[];
|
|
42
|
+
round?: number;
|
|
43
|
+
status?: string;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}
|
|
46
|
+
/** `getAccountInfo` result: the indexer account with string asset ids and an `assetMapping` index. */
|
|
47
|
+
export interface AlgorandAccountInfo extends AlgorandAccount {
|
|
48
|
+
assets: AlgorandAssetHolding[];
|
|
49
|
+
/** holdings keyed by asset id (string); the native ALGO balance is also exposed under the pseudo id '1' */
|
|
50
|
+
assetMapping: {
|
|
51
|
+
[assetId: string]: AlgorandAssetHolding;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface AlgorandAssetParams {
|
|
55
|
+
creator: string;
|
|
56
|
+
decimals: number;
|
|
57
|
+
total: AlgoAmount;
|
|
58
|
+
name?: string;
|
|
59
|
+
'unit-name'?: string;
|
|
60
|
+
reserve?: string;
|
|
61
|
+
manager?: string;
|
|
62
|
+
freeze?: string;
|
|
63
|
+
clawback?: string;
|
|
64
|
+
url?: string;
|
|
65
|
+
'default-frozen'?: boolean;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}
|
|
68
|
+
/** `getAssetInfo` result: asset params flattened next to the asset metadata (`id`, `created-at-round`, ...) */
|
|
69
|
+
export interface AlgorandAssetInfo extends AlgorandAssetParams {
|
|
70
|
+
id: number;
|
|
71
|
+
params: AlgorandAssetParams;
|
|
72
|
+
'created-at-round'?: number;
|
|
73
|
+
deleted?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface AlgorandAssetSupply {
|
|
76
|
+
total: string;
|
|
77
|
+
decimals: number;
|
|
78
|
+
reserve: string | undefined;
|
|
79
|
+
/** total minus the reserve account's holding (equals total when there is no reserve) */
|
|
80
|
+
circulating: string;
|
|
81
|
+
}
|
|
82
|
+
export interface AlgorandBox {
|
|
83
|
+
name: string;
|
|
84
|
+
value: string;
|
|
85
|
+
round?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface AlgorandBlock {
|
|
88
|
+
round: number;
|
|
89
|
+
timestamp: number;
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}
|
|
92
|
+
export interface BlockRef {
|
|
93
|
+
number: number;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
}
|
|
96
|
+
export type GlobalStateValue = number | string;
|
|
97
|
+
export type DecodedGlobalState = {
|
|
98
|
+
[key: string]: GlobalStateValue;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* JSON.parse that keeps integers too large for a JS number as decimal strings.
|
|
102
|
+
* Only integer literals outside of strings that fail `Number.isSafeInteger` are quoted.
|
|
103
|
+
*/
|
|
104
|
+
export declare function parseJsonSafe(text: string): any;
|
|
105
|
+
/** Raw GET against the indexer (`/v2/...`), parsed with the uint64-safe parser. */
|
|
106
|
+
export declare function indexerGet({ path, params }: {
|
|
107
|
+
path: string;
|
|
108
|
+
params?: Record<string, any>;
|
|
109
|
+
}): Promise<any>;
|
|
110
|
+
/** Raw GET against algod (`/v2/...`), parsed with the uint64-safe parser. */
|
|
111
|
+
export declare function algodGet({ path, params }: {
|
|
112
|
+
path: string;
|
|
113
|
+
params?: Record<string, any>;
|
|
114
|
+
}): Promise<any>;
|
|
115
|
+
/** `/v2/applications/{appId}` -> the `application` object (id, params, global-state, ...) */
|
|
116
|
+
export declare function lookupApplication({ appId }: {
|
|
117
|
+
appId: number | string;
|
|
118
|
+
}): Promise<AlgorandApplication>;
|
|
119
|
+
/**
|
|
120
|
+
* `/v2/accounts/{address}` -> the `account` object. `includeAll` also returns closed-out / deleted holdings.
|
|
121
|
+
* Resolves to `undefined` when the indexer has never seen the account (404).
|
|
122
|
+
*/
|
|
123
|
+
export declare function lookupAccount({ address, includeAll, params }: {
|
|
124
|
+
address: string;
|
|
125
|
+
includeAll?: boolean;
|
|
126
|
+
params?: Record<string, any>;
|
|
127
|
+
}): Promise<AlgorandAccount | undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* Account with holdings indexed by asset id. Memoised per process (same address -> same promise), like the
|
|
130
|
+
* adapters helper it replaces. A numeric `address` is treated as an application id and resolved to its escrow address.
|
|
131
|
+
* The ALGO balance is added to `assets` / `assetMapping` under the pseudo asset id '1'.
|
|
132
|
+
*/
|
|
133
|
+
export declare function getAccountInfo({ address }: {
|
|
134
|
+
address: string | number;
|
|
135
|
+
}): Promise<AlgorandAccountInfo>;
|
|
136
|
+
/** Drop the memoised `getAccountInfo` entries (all, or one address). */
|
|
137
|
+
export declare function clearAccountInfoCache(address?: string): void;
|
|
138
|
+
export interface SearchAccountsOptions {
|
|
139
|
+
/** only accounts opted into this application */
|
|
140
|
+
appId?: number | string;
|
|
141
|
+
/** only accounts holding this asset */
|
|
142
|
+
assetId?: number | string;
|
|
143
|
+
limit?: number;
|
|
144
|
+
nextToken?: string;
|
|
145
|
+
/** extra indexer query params (`currency-greater-than`, `include-all`, `exclude`, ...) */
|
|
146
|
+
params?: Record<string, any>;
|
|
147
|
+
}
|
|
148
|
+
/** `/v2/accounts` search, one page -> `{ accounts, 'next-token', 'current-round' }` */
|
|
149
|
+
export declare function searchAccounts({ appId, assetId, limit, nextToken, params }: SearchAccountsOptions): Promise<{
|
|
150
|
+
accounts: AlgorandAccount[];
|
|
151
|
+
'next-token'?: string;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}>;
|
|
154
|
+
/** All pages of `searchAccounts`. `onPage` is called with every page as it arrives. */
|
|
155
|
+
export declare function searchAccountsAll({ appId, assetId, limit, params, onPage }: Omit<SearchAccountsOptions, 'nextToken'> & {
|
|
156
|
+
onPage?: (accounts: AlgorandAccount[], page: number) => void | Promise<void>;
|
|
157
|
+
}): Promise<AlgorandAccount[]>;
|
|
158
|
+
/** `/v2/accounts/{address}/created-applications` -> `{ applications, 'next-token', ... }` */
|
|
159
|
+
export declare function lookupApplicationsCreatedByAccount({ address, params }: {
|
|
160
|
+
address: string;
|
|
161
|
+
params?: Record<string, any>;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
applications: AlgorandApplication[];
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}>;
|
|
166
|
+
/** `/v2/assets/{assetId}` -> asset params (total, decimals, reserve, unit-name, ...) flattened with the asset metadata. */
|
|
167
|
+
export declare function getAssetInfo({ assetId }: {
|
|
168
|
+
assetId: number | string;
|
|
169
|
+
}): Promise<AlgorandAssetInfo>;
|
|
170
|
+
/** Amount of `assetId` held by `address` as a base-unit string; '0' when the account is not opted in or unknown. */
|
|
171
|
+
export declare function getAssetBalance({ address, assetId }: {
|
|
172
|
+
address: string;
|
|
173
|
+
assetId: number | string;
|
|
174
|
+
}): Promise<string>;
|
|
175
|
+
/** Native ALGO balance of `address` in microalgos as a string; '0' for unknown accounts. */
|
|
176
|
+
export declare function getAlgoBalance({ address }: {
|
|
177
|
+
address: string;
|
|
178
|
+
}): Promise<string>;
|
|
179
|
+
/**
|
|
180
|
+
* Supply figures for an ASA, all in base units. `circulating` is `total` minus the reserve account's holding,
|
|
181
|
+
* which is how Algorand issuers (USDC, USDt, ...) signal the un-issued part of a fixed total.
|
|
182
|
+
*/
|
|
183
|
+
export declare function getAssetSupply({ assetId }: {
|
|
184
|
+
assetId: number | string;
|
|
185
|
+
}): Promise<AlgorandAssetSupply>;
|
|
186
|
+
/** Global state key: base64 -> utf8 string. */
|
|
187
|
+
export declare function decodeGlobalStateKey(b64: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Global state value: uint (type 2) -> number (or decimal string when above 2^53), bytes (type 1) -> base64
|
|
190
|
+
* string as delivered by the indexer. Use `bytesAsAddress` / `bytesAsUint64s` / `bytesAsUtf8` to interpret bytes.
|
|
191
|
+
*/
|
|
192
|
+
export declare function decodeGlobalStateValue(value: GlobalStateEntry['value']): GlobalStateValue;
|
|
193
|
+
/** Decode an indexer `global-state` (or `local-state`) key/value list into a plain object. */
|
|
194
|
+
export declare function decodeGlobalState(entries?: GlobalStateEntry[]): DecodedGlobalState;
|
|
195
|
+
/** Decoded global state of an application: `{ [utf8 key]: number | string }`. */
|
|
196
|
+
export declare function getAppGlobalState({ appId }: {
|
|
197
|
+
appId: number | string;
|
|
198
|
+
}): Promise<DecodedGlobalState>;
|
|
199
|
+
/** Interpret a 32 byte base64 state value as an Algorand address. */
|
|
200
|
+
export declare function bytesAsAddress(b64: string): string;
|
|
201
|
+
/** Interpret a base64 state value as consecutive big-endian uint64s (packed structs used by Folks, Tinyman, ...). */
|
|
202
|
+
export declare function bytesAsUint64s(b64: string): bigint[];
|
|
203
|
+
/** Interpret a base64 state value as utf8 text. */
|
|
204
|
+
export declare function bytesAsUtf8(b64: string): string;
|
|
205
|
+
/** `/v2/applications/{appId}/boxes`, one page -> `{ boxes: [{ name }], 'next-token' }` */
|
|
206
|
+
export declare function getApplicationBoxes({ appId, limit, nextToken }: {
|
|
207
|
+
appId: number | string;
|
|
208
|
+
limit?: number;
|
|
209
|
+
nextToken?: string;
|
|
210
|
+
}): Promise<{
|
|
211
|
+
boxes: {
|
|
212
|
+
name: string;
|
|
213
|
+
}[];
|
|
214
|
+
'next-token'?: string;
|
|
215
|
+
[key: string]: any;
|
|
216
|
+
}>;
|
|
217
|
+
/** All box names of an application (base64 encoded). */
|
|
218
|
+
export declare function getApplicationBoxesAll({ appId, limit }: {
|
|
219
|
+
appId: number | string;
|
|
220
|
+
limit?: number;
|
|
221
|
+
}): Promise<{
|
|
222
|
+
name: string;
|
|
223
|
+
}[]>;
|
|
224
|
+
/**
|
|
225
|
+
* Encode a box name for the `name` query param. Strings already prefixed with `b64:` / `str:` / `int:` are passed
|
|
226
|
+
* through, raw bytes are base64 encoded, plain strings are sent as `str:`.
|
|
227
|
+
*/
|
|
228
|
+
export declare function encodeBoxName(name: string | Uint8Array): string;
|
|
229
|
+
/** `/v2/applications/{appId}/box?name=...` -> `{ name, value, round }` (base64 encoded name/value). */
|
|
230
|
+
export declare function getApplicationBox({ appId, name }: {
|
|
231
|
+
appId: number | string;
|
|
232
|
+
name: string | Uint8Array;
|
|
233
|
+
}): Promise<AlgorandBox>;
|
|
234
|
+
/** `/v2/transactions` search with raw indexer params (`address`, `asset-id`, `min-round`, `after-time`, `next`, ...). */
|
|
235
|
+
export declare function lookupTransactions({ params }?: {
|
|
236
|
+
params?: Record<string, any>;
|
|
237
|
+
}): Promise<{
|
|
238
|
+
transactions: any[];
|
|
239
|
+
'next-token'?: string;
|
|
240
|
+
[key: string]: any;
|
|
241
|
+
}>;
|
|
242
|
+
/** `/v2/blocks/{round}` -> block header (round, timestamp, transactions, ...) */
|
|
243
|
+
export declare function getBlock({ round }: {
|
|
244
|
+
round: number;
|
|
245
|
+
}): Promise<AlgorandBlock>;
|
|
246
|
+
/** Latest round the indexer has ingested (from `/health`) with its timestamp. */
|
|
247
|
+
export declare function getLatestBlock(): Promise<BlockRef>;
|
|
248
|
+
/**
|
|
249
|
+
* First block whose timestamp is >= `timestamp` (unix seconds). Fast path: the first transaction after that time
|
|
250
|
+
* (indexer `after-time`); falls back to a binary search over block headers.
|
|
251
|
+
*/
|
|
252
|
+
export declare function getBlockAtTimestamp({ timestamp }: {
|
|
253
|
+
timestamp: number;
|
|
254
|
+
}): Promise<BlockRef>;
|
|
255
|
+
/** RFC 4648 base32 with `=` padding. */
|
|
256
|
+
export declare function base32Encode(bytes: Uint8Array): string;
|
|
257
|
+
/** RFC 4648 base32 decode; padding optional, case insensitive, throws on invalid characters. */
|
|
258
|
+
export declare function base32Decode(str: string): Uint8Array;
|
|
259
|
+
/** SHA-512/256 digest (Algorand's "genericHash"). */
|
|
260
|
+
export declare function sha512_256(bytes: Uint8Array | Buffer): Uint8Array;
|
|
261
|
+
export declare function concatArrays(...arrs: Uint8Array[]): Uint8Array;
|
|
262
|
+
/** 32 byte public key -> 58 char address (base32 of key + 4 byte sha512/256 checksum, padding stripped). */
|
|
263
|
+
export declare function encodeAddress(publicKey: Uint8Array): string;
|
|
264
|
+
/**
|
|
265
|
+
* 58 char address -> `{ publicKey, checksum }`; throws when the length, the checksum or the
|
|
266
|
+
* encoding is wrong. Like algosdk, only the canonical upper-case base32 form is accepted: the
|
|
267
|
+
* last character carries 2 padding bits that must be zero, so re-encoding must reproduce the input.
|
|
268
|
+
*/
|
|
269
|
+
export declare function decodeAddress(address: string): {
|
|
270
|
+
publicKey: Uint8Array;
|
|
271
|
+
checksum: Uint8Array;
|
|
272
|
+
};
|
|
273
|
+
export declare function isValidAddress(address: string): boolean;
|
|
274
|
+
/** Big-endian 8 byte encoding of an unsigned 64-bit integer. */
|
|
275
|
+
export declare function encodeUint64(num: number | bigint | string): Uint8Array;
|
|
276
|
+
/** Escrow address of an application: encodeAddress(sha512_256("appID" || uint64(appId))). */
|
|
277
|
+
export declare function getApplicationAddress(appId: number | bigint | string): string;
|