-
Notifications
You must be signed in to change notification settings - Fork 458
/
constants.ts
71 lines (61 loc) 路 2.46 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Copyright 漏 2022 Lisk Foundation
*
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*/
export const CROSS_CHAIN_COMMAND_NAME_TRANSFER = 'transferCrossChain';
export const ADDRESS_LENGTH = 20;
export const MAX_DATA_LENGTH = 64;
export const MIN_MODULE_NAME_LENGTH = 1;
export const MAX_MODULE_NAME_LENGTH = 32;
export const MAX_TRANSACTION_AMOUNT = '9223372036854775807';
export const CCM_STATUS_OK = 0;
export const CCM_STATUS_TOKEN_NOT_SUPPORTED = 64;
export const CCM_STATUS_PROTOCOL_VIOLATION = 65;
export const MIN_RETURN_FEE_PER_BYTE_BEDDOWS = BigInt(1000);
export const CHAIN_ID_LENGTH = 4;
export const HASH_LENGTH = 32;
/** The local token ID is a ID that is unique within a specific blockchain for a particular kind of token.
* It is exactly 4bytes (=8 characters) long. */
export const LOCAL_ID_LENGTH = 4;
/**
* `TokenID`s must be exactly 8 bytes (16 characters) long.
*
* The first 4 bytes correspond to the `chainID`, see {@link CHAIN_ID_LENGTH }.
* The last 4 bytes to the local ID, see {@link LOCAL_ID_LENGTH }.
* */
export const TOKEN_ID_LENGTH = CHAIN_ID_LENGTH + LOCAL_ID_LENGTH;
export const LOCAL_ID_LSK = Buffer.alloc(LOCAL_ID_LENGTH, 0);
export const USER_ACCOUNT_INITIALIZATION_FEE = BigInt(5000000);
export const ESCROW_ACCOUNT_INITIALIZATION_FEE = BigInt(5000000);
export const defaultConfig = {
userAccountInitializationFee: USER_ACCOUNT_INITIALIZATION_FEE.toString(),
escrowAccountInitializationFee: ESCROW_ACCOUNT_INITIALIZATION_FEE.toString(),
};
export const EMPTY_BYTES = Buffer.alloc(0);
export const enum TokenEventResult {
SUCCESSFUL = 0,
FAIL_INSUFFICIENT_BALANCE = 1,
DATA_TOO_LONG = 2,
INVALID_TOKEN_ID = 3,
TOKEN_NOT_SUPPORTED = 4,
INSUFFICIENT_LOCKED_AMOUNT = 5,
RECOVER_FAIL_INVALID_INPUTS = 6,
RECOVER_FAIL_INSUFFICIENT_ESCROW = 7,
MINT_FAIL_NON_NATIVE_TOKEN = 8,
MINT_FAIL_TOTAL_SUPPLY_TOO_BIG = 9,
MINT_FAIL_TOKEN_NOT_INITIALIZED = 10,
TOKEN_ID_NOT_AVAILABLE = 11,
TOKEN_ID_NOT_NATIVE = 12,
INSUFFICIENT_ESCROW_BALANCE = 13,
INVALID_RECEIVING_CHAIN = 14,
}
export type TokenErrorEventResult = Exclude<TokenEventResult, TokenEventResult.SUCCESSFUL>;