@amadeus-protocol/sdk 1.0.6 → 1.0.7
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 +2 -2
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/contract-state.d.ts +59 -0
- package/dist/contract-state.d.ts.map +1 -0
- package/dist/contract-state.js +117 -0
- package/dist/contract-state.js.map +1 -0
- package/dist/contracts/abi-types.d.ts +87 -0
- package/dist/contracts/abi-types.d.ts.map +1 -0
- package/dist/contracts/abi-types.js +8 -0
- package/dist/contracts/abi-types.js.map +1 -0
- package/dist/contracts/coin.d.ts +42 -0
- package/dist/contracts/coin.d.ts.map +1 -0
- package/dist/contracts/coin.js +42 -0
- package/dist/contracts/coin.js.map +1 -0
- package/dist/contracts/contract-call.d.ts +49 -0
- package/dist/contracts/contract-call.d.ts.map +1 -0
- package/dist/contracts/contract-call.js +57 -0
- package/dist/contracts/contract-call.js.map +1 -0
- package/dist/contracts/contract.d.ts +113 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +107 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/lockup/abi.d.ts +62 -0
- package/dist/contracts/lockup/abi.d.ts.map +1 -0
- package/dist/contracts/lockup/abi.js +77 -0
- package/dist/contracts/lockup/abi.js.map +1 -0
- package/dist/contracts/lockup/calls.d.ts +23 -0
- package/dist/contracts/lockup/calls.d.ts.map +1 -0
- package/dist/contracts/lockup/calls.js +25 -0
- package/dist/contracts/lockup/calls.js.map +1 -0
- package/dist/contracts/lockup/helpers.d.ts +24 -0
- package/dist/contracts/lockup/helpers.d.ts.map +1 -0
- package/dist/contracts/lockup/helpers.js +49 -0
- package/dist/contracts/lockup/helpers.js.map +1 -0
- package/dist/contracts/lockup/index.d.ts +6 -0
- package/dist/contracts/lockup/index.d.ts.map +1 -0
- package/dist/contracts/lockup/index.js +6 -0
- package/dist/contracts/lockup/index.js.map +1 -0
- package/dist/contracts/lockup/parsers.d.ts +20 -0
- package/dist/contracts/lockup/parsers.d.ts.map +1 -0
- package/dist/contracts/lockup/parsers.js +60 -0
- package/dist/contracts/lockup/parsers.js.map +1 -0
- package/dist/contracts/lockup/storage-keys.d.ts +15 -0
- package/dist/contracts/lockup/storage-keys.d.ts.map +1 -0
- package/dist/contracts/lockup/storage-keys.js +78 -0
- package/dist/contracts/lockup/storage-keys.js.map +1 -0
- package/dist/contracts/lockup/types.d.ts +90 -0
- package/dist/contracts/lockup/types.d.ts.map +1 -0
- package/dist/contracts/lockup/types.js +7 -0
- package/dist/contracts/lockup/types.js.map +1 -0
- package/dist/contracts/lockup-prime/abi.d.ts +348 -0
- package/dist/contracts/lockup-prime/abi.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/abi.js +420 -0
- package/dist/contracts/lockup-prime/abi.js.map +1 -0
- package/dist/contracts/lockup-prime/calls.d.ts +53 -0
- package/dist/contracts/lockup-prime/calls.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/calls.js +60 -0
- package/dist/contracts/lockup-prime/calls.js.map +1 -0
- package/dist/contracts/lockup-prime/helpers.d.ts +38 -0
- package/dist/contracts/lockup-prime/helpers.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/helpers.js +147 -0
- package/dist/contracts/lockup-prime/helpers.js.map +1 -0
- package/dist/contracts/lockup-prime/index.d.ts +6 -0
- package/dist/contracts/lockup-prime/index.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/index.js +6 -0
- package/dist/contracts/lockup-prime/index.js.map +1 -0
- package/dist/contracts/lockup-prime/parsers.d.ts +25 -0
- package/dist/contracts/lockup-prime/parsers.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/parsers.js +68 -0
- package/dist/contracts/lockup-prime/parsers.js.map +1 -0
- package/dist/contracts/lockup-prime/storage-keys.d.ts +25 -0
- package/dist/contracts/lockup-prime/storage-keys.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/storage-keys.js +92 -0
- package/dist/contracts/lockup-prime/storage-keys.js.map +1 -0
- package/dist/contracts/lockup-prime/types.d.ts +116 -0
- package/dist/contracts/lockup-prime/types.d.ts.map +1 -0
- package/dist/contracts/lockup-prime/types.js +18 -0
- package/dist/contracts/lockup-prime/types.js.map +1 -0
- package/dist/crypto.js +1 -1
- package/dist/crypto.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/serialization.d.ts +22 -0
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +39 -2
- package/dist/serialization.js.map +1 -1
- package/dist/signing.d.ts +39 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +84 -0
- package/dist/signing.js.map +1 -0
- package/dist/transaction-builder.d.ts +135 -194
- package/dist/transaction-builder.d.ts.map +1 -1
- package/dist/transaction-builder.js +237 -288
- package/dist/transaction-builder.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { fromAtomicAma } from '../../conversion';
|
|
2
|
+
/**
|
|
3
|
+
* Parse raw lockup vault data string into intermediate format
|
|
4
|
+
* Format: {unlock_height}-{amount}-{symbol}
|
|
5
|
+
*
|
|
6
|
+
* @param dataStr - Raw vault data string from contract state
|
|
7
|
+
* @returns Parsed data or null if invalid
|
|
8
|
+
*/
|
|
9
|
+
export function parseRawLockupVaultData(dataStr) {
|
|
10
|
+
const match = dataStr.match(/^(\d+)-(\d+)-([A-Za-z]+)$/);
|
|
11
|
+
if (!match)
|
|
12
|
+
return null;
|
|
13
|
+
const unlockHeight = Number.parseInt(match[1], 10);
|
|
14
|
+
const amountFlat = Number.parseInt(match[2], 10);
|
|
15
|
+
const symbol = match[3];
|
|
16
|
+
if (Number.isNaN(unlockHeight) || unlockHeight < 0)
|
|
17
|
+
return null;
|
|
18
|
+
if (Number.isNaN(amountFlat) || amountFlat < 0)
|
|
19
|
+
return null;
|
|
20
|
+
if (symbol !== 'AMA')
|
|
21
|
+
return null;
|
|
22
|
+
return { unlockHeight, amountFlat, symbol };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse lockup vault data from contract state
|
|
26
|
+
* Format: {unlock_height}-{amount}-{symbol}
|
|
27
|
+
* These vaults are locked for 5 epochs (100,000 * 5 = 500,000 heights)
|
|
28
|
+
*
|
|
29
|
+
* @param vaultData - Raw vault data from contract state (string or Uint8Array)
|
|
30
|
+
* @param vaultIndex - The vault index
|
|
31
|
+
* @returns Parsed vault or null if invalid
|
|
32
|
+
*/
|
|
33
|
+
export function parseLockupVaultData(vaultData, vaultIndex) {
|
|
34
|
+
try {
|
|
35
|
+
const dataStr = typeof vaultData === 'string' ? vaultData : new TextDecoder().decode(vaultData);
|
|
36
|
+
const rawData = parseRawLockupVaultData(dataStr);
|
|
37
|
+
if (!rawData)
|
|
38
|
+
return null;
|
|
39
|
+
const { unlockHeight, amountFlat } = rawData;
|
|
40
|
+
const amount = fromAtomicAma(amountFlat);
|
|
41
|
+
// Regular lockup vaults created from early unlock are locked for 5 epochs
|
|
42
|
+
// 5 epochs = 100,000 * 5 = 500,000 heights
|
|
43
|
+
const lockHeight = Math.max(0, unlockHeight - 500_000);
|
|
44
|
+
// Approximate epochs: 1 epoch ~ 100,000 heights
|
|
45
|
+
const unlockEpoch = Math.floor(unlockHeight / 100_000);
|
|
46
|
+
const lockEpoch = Math.floor(lockHeight / 100_000);
|
|
47
|
+
return {
|
|
48
|
+
unlockEpoch,
|
|
49
|
+
lockEpoch,
|
|
50
|
+
amount,
|
|
51
|
+
vaultIndex,
|
|
52
|
+
vaultType: 'vesting',
|
|
53
|
+
unlockHeight
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../src/contracts/lockup/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAIhD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;IACxD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAA;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAA;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAE,CAAA;IAExB,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/D,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAC3D,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,IAAI,CAAA;IAEjC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CACnC,SAA8B,EAC9B,UAAkB;IAElB,IAAI,CAAC;QACJ,MAAM,OAAO,GACZ,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAEhF,MAAM,OAAO,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAA;QAEzB,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QAE5C,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;QAExC,0EAA0E;QAC1E,2CAA2C;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,CAAA;QAEtD,gDAAgD;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC,CAAA;QACtD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC,CAAA;QAElD,OAAO;YACN,WAAW;YACX,SAAS;YACT,MAAM;YACN,UAAU;YACV,SAAS,EAAE,SAAS;YACpB,YAAY;SACZ,CAAA;IACF,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAA;IACZ,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build vault key prefix for an account
|
|
3
|
+
* Format: bic:lockup:vault:{account_48bytes}:
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildLockupVaultKeyPrefix(accountBinary: Uint8Array): Uint8Array;
|
|
6
|
+
/**
|
|
7
|
+
* Extract vault index from key
|
|
8
|
+
* Key format: bic:lockup:vault:{account_48bytes}:{vault_index}
|
|
9
|
+
*
|
|
10
|
+
* Note: When using prefix queries, the key might be:
|
|
11
|
+
* - Full key: bic:lockup:vault:{account_48bytes}:{vault_index}
|
|
12
|
+
* - Suffix only: {vault_index} (just the part after the prefix)
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractLockupVaultIndexFromKey(key: string | Uint8Array): number | null;
|
|
15
|
+
//# sourceMappingURL=storage-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-keys.d.ts","sourceRoot":"","sources":["../../../src/contracts/lockup/storage-keys.ts"],"names":[],"mappings":"AAkCA;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAE/E;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CA2CtF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Lockup } from './helpers';
|
|
2
|
+
/**
|
|
3
|
+
* Generic function to build a storage key for an account
|
|
4
|
+
*/
|
|
5
|
+
function buildStorageKey(keyName, accountBinary, appendColon = false) {
|
|
6
|
+
const storageKey = Lockup.getStorageKey(keyName);
|
|
7
|
+
if (!storageKey) {
|
|
8
|
+
throw new Error(`Storage key '${keyName}' not found in ABI`);
|
|
9
|
+
}
|
|
10
|
+
const prefix = Lockup.getKeyPrefix(keyName);
|
|
11
|
+
if (!prefix) {
|
|
12
|
+
throw new Error(`Could not extract prefix for storage key '${keyName}'`);
|
|
13
|
+
}
|
|
14
|
+
const prefixBytes = new TextEncoder().encode(prefix);
|
|
15
|
+
const resultLength = prefixBytes.length + accountBinary.length + (appendColon ? 1 : 0);
|
|
16
|
+
const result = new Uint8Array(resultLength);
|
|
17
|
+
result.set(prefixBytes, 0);
|
|
18
|
+
result.set(accountBinary, prefixBytes.length);
|
|
19
|
+
if (appendColon) {
|
|
20
|
+
result[result.length - 1] = 0x3a; // ':'
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build vault key prefix for an account
|
|
26
|
+
* Format: bic:lockup:vault:{account_48bytes}:
|
|
27
|
+
*/
|
|
28
|
+
export function buildLockupVaultKeyPrefix(accountBinary) {
|
|
29
|
+
return buildStorageKey('vault', accountBinary, true);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Extract vault index from key
|
|
33
|
+
* Key format: bic:lockup:vault:{account_48bytes}:{vault_index}
|
|
34
|
+
*
|
|
35
|
+
* Note: When using prefix queries, the key might be:
|
|
36
|
+
* - Full key: bic:lockup:vault:{account_48bytes}:{vault_index}
|
|
37
|
+
* - Suffix only: {vault_index} (just the part after the prefix)
|
|
38
|
+
*/
|
|
39
|
+
export function extractLockupVaultIndexFromKey(key) {
|
|
40
|
+
try {
|
|
41
|
+
const keyBytes = typeof key === 'string' ? new TextEncoder().encode(key) : key;
|
|
42
|
+
const keyStr = typeof key === 'string' ? key : new TextDecoder().decode(key);
|
|
43
|
+
// Check if key is vault data format FIRST
|
|
44
|
+
// If key looks like vault data (e.g., '229427-75000000000000-AMA'), don't try to extract index
|
|
45
|
+
const isVaultDataFormat = /^\d+-\d+-[A-Za-z]+$/.test(keyStr);
|
|
46
|
+
if (isVaultDataFormat) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// If the key is very short (likely just the vault index suffix from prefix query)
|
|
50
|
+
if (keyBytes.length < 10) {
|
|
51
|
+
const directParse = Number.parseInt(keyStr, 10);
|
|
52
|
+
if (!Number.isNaN(directParse) && directParse >= 0) {
|
|
53
|
+
return directParse;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Find the last colon (':') byte (0x3A)
|
|
57
|
+
let lastColonIndex = -1;
|
|
58
|
+
for (let i = keyBytes.length - 1; i >= 0; i--) {
|
|
59
|
+
if (keyBytes[i] === 0x3a) {
|
|
60
|
+
lastColonIndex = i;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (lastColonIndex === -1 || lastColonIndex === keyBytes.length - 1) {
|
|
65
|
+
const wholeKeyParse = Number.parseInt(keyStr, 10);
|
|
66
|
+
return Number.isNaN(wholeKeyParse) ? null : wholeKeyParse;
|
|
67
|
+
}
|
|
68
|
+
// Extract vault index from after the last colon
|
|
69
|
+
const indexBytes = keyBytes.slice(lastColonIndex + 1);
|
|
70
|
+
const indexStr = new TextDecoder().decode(indexBytes);
|
|
71
|
+
const vaultIndex = Number.parseInt(indexStr, 10);
|
|
72
|
+
return Number.isNaN(vaultIndex) ? null : vaultIndex;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=storage-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-keys.js","sourceRoot":"","sources":["../../../src/contracts/lockup/storage-keys.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Definitions for Lockup smart contract
|
|
3
|
+
*
|
|
4
|
+
* Replaces Zod schemas with plain TypeScript types.
|
|
5
|
+
*/
|
|
6
|
+
/** Parsed Lockup vault (vesting vault) */
|
|
7
|
+
export interface LockupVault {
|
|
8
|
+
unlockEpoch: number;
|
|
9
|
+
lockEpoch: number;
|
|
10
|
+
amount: number;
|
|
11
|
+
vaultIndex: number;
|
|
12
|
+
vaultType: 'vesting';
|
|
13
|
+
unlockHeight?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Intermediate parse result from raw vault data string */
|
|
16
|
+
export interface RawLockupVaultData {
|
|
17
|
+
unlockHeight: number;
|
|
18
|
+
amountFlat: number;
|
|
19
|
+
symbol: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LockupAbiFunction {
|
|
22
|
+
type: 'function';
|
|
23
|
+
name: string;
|
|
24
|
+
inputs: LockupAbiInput[];
|
|
25
|
+
outputs: LockupAbiOutput[];
|
|
26
|
+
stateMutability: 'nonpayable' | 'payable' | 'view' | 'pure';
|
|
27
|
+
description?: string;
|
|
28
|
+
requirements?: string[];
|
|
29
|
+
storage?: {
|
|
30
|
+
reads?: LockupAbiStorageRead[];
|
|
31
|
+
writes?: LockupAbiStorageWrite[];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface LockupAbiInput {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
validation?: {
|
|
39
|
+
min?: string;
|
|
40
|
+
max?: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
};
|
|
43
|
+
enum?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface LockupAbiOutput {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface LockupAbiError {
|
|
51
|
+
name: string;
|
|
52
|
+
code: string;
|
|
53
|
+
description: string;
|
|
54
|
+
}
|
|
55
|
+
export interface LockupAbiStorage {
|
|
56
|
+
keys: LockupAbiStorageKey[];
|
|
57
|
+
}
|
|
58
|
+
export interface LockupAbiStorageKey {
|
|
59
|
+
name: string;
|
|
60
|
+
pattern: string;
|
|
61
|
+
type: 'mapping' | 'value' | 'array';
|
|
62
|
+
description: string;
|
|
63
|
+
valueFormat?: string;
|
|
64
|
+
valueSchema?: Record<string, any>;
|
|
65
|
+
query?: {
|
|
66
|
+
method: string;
|
|
67
|
+
endpoint: string;
|
|
68
|
+
prefix?: string;
|
|
69
|
+
key?: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface LockupAbiStorageRead {
|
|
74
|
+
key: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
value?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface LockupAbiStorageWrite {
|
|
79
|
+
key: string;
|
|
80
|
+
value?: string;
|
|
81
|
+
operation?: 'increment' | 'decrement' | 'create' | 'delete' | 'mint';
|
|
82
|
+
amount?: string;
|
|
83
|
+
duration?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
condition?: string;
|
|
86
|
+
writes?: LockupAbiStorageWrite[];
|
|
87
|
+
}
|
|
88
|
+
/** @deprecated Use `LockupVault` instead */
|
|
89
|
+
export type LockupVaultSchema = LockupVault;
|
|
90
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/contracts/lockup/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/contracts/lockup/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LockupPrime Smart Contract ABI
|
|
3
|
+
*
|
|
4
|
+
* Standard ABI format
|
|
5
|
+
* Based on: /root/node/ex/native/rdb/src/consensus/bic/lockup_prime.rs
|
|
6
|
+
*/
|
|
7
|
+
export declare const LOCKUP_PRIME_ABI: {
|
|
8
|
+
readonly contractName: "LockupPrime";
|
|
9
|
+
readonly contractVersion: "1.0.0";
|
|
10
|
+
readonly abi: readonly [{
|
|
11
|
+
readonly type: "function";
|
|
12
|
+
readonly name: "lock";
|
|
13
|
+
readonly inputs: readonly [{
|
|
14
|
+
readonly name: "amount";
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: "Amount in flat units (as string, must be > 1 flat unit)";
|
|
17
|
+
readonly validation: {
|
|
18
|
+
readonly min: "1";
|
|
19
|
+
readonly type: "i128";
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "tier";
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Lock tier";
|
|
25
|
+
readonly enum: readonly ["7d", "30d", "90d", "180d", "365d"];
|
|
26
|
+
}];
|
|
27
|
+
readonly outputs: readonly [];
|
|
28
|
+
readonly stateMutability: "nonpayable";
|
|
29
|
+
readonly description: "Lock AMA tokens for a specified tier to earn PRIME points";
|
|
30
|
+
readonly requirements: readonly ["amount > 1 flat unit", "sufficient AMA balance", "amount and tier must be UTF-8 encoded strings"];
|
|
31
|
+
readonly storage: {
|
|
32
|
+
readonly writes: readonly [{
|
|
33
|
+
readonly key: "bic:lockup_prime:vault:{caller}:{vault_index}";
|
|
34
|
+
readonly value: "{tier}-{multiplier}-{unlock_epoch}-{amount}";
|
|
35
|
+
readonly description: "Creates a new vault entry";
|
|
36
|
+
}, {
|
|
37
|
+
readonly key: "bic:lockup_prime:unique_index";
|
|
38
|
+
readonly operation: "increment";
|
|
39
|
+
readonly description: "Increments global vault index counter";
|
|
40
|
+
}, {
|
|
41
|
+
readonly key: "bic:coin:balance:{caller}:AMA";
|
|
42
|
+
readonly operation: "decrement";
|
|
43
|
+
readonly amount: "amount";
|
|
44
|
+
readonly description: "Deducts AMA from caller's balance";
|
|
45
|
+
}];
|
|
46
|
+
readonly reads: readonly [{
|
|
47
|
+
readonly key: "bic:coin:balance:{caller}:AMA";
|
|
48
|
+
readonly description: "Checks caller's AMA balance";
|
|
49
|
+
}];
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
readonly name: "unlock";
|
|
54
|
+
readonly inputs: readonly [{
|
|
55
|
+
readonly name: "vaultIndex";
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly description: "Vault index to unlock (as string, e.g., \"0\", \"1\", \"2\")";
|
|
58
|
+
}];
|
|
59
|
+
readonly outputs: readonly [];
|
|
60
|
+
readonly stateMutability: "nonpayable";
|
|
61
|
+
readonly description: "Unlock a vault and receive PRIME points (or penalty if early)";
|
|
62
|
+
readonly requirements: readonly ["vault must exist", "vault must belong to caller"];
|
|
63
|
+
readonly storage: {
|
|
64
|
+
readonly reads: readonly [{
|
|
65
|
+
readonly key: "bic:lockup_prime:vault:{caller}:{vault_index}";
|
|
66
|
+
readonly value: "{tier}-{multiplier}-{unlock_epoch}-{amount}";
|
|
67
|
+
readonly description: "Reads vault data";
|
|
68
|
+
}];
|
|
69
|
+
readonly writes: readonly [{
|
|
70
|
+
readonly key: "bic:lockup_prime:vault:{caller}:{vault_index}";
|
|
71
|
+
readonly operation: "delete";
|
|
72
|
+
readonly description: "Deletes vault after unlock";
|
|
73
|
+
}, {
|
|
74
|
+
readonly condition: "if current_epoch < unlock_epoch (early unlock)";
|
|
75
|
+
readonly writes: readonly [{
|
|
76
|
+
readonly key: "bic:coin:balance:{treasury}:AMA";
|
|
77
|
+
readonly operation: "increment";
|
|
78
|
+
readonly amount: "penalty (25% of amount)";
|
|
79
|
+
readonly description: "Penalty sent to treasury";
|
|
80
|
+
}, {
|
|
81
|
+
readonly key: "bic:lockup:vault:{caller}:{index}";
|
|
82
|
+
readonly operation: "create";
|
|
83
|
+
readonly amount: "disbursement (75% of amount)";
|
|
84
|
+
readonly duration: "5 epochs";
|
|
85
|
+
readonly description: "Remaining amount locked for 5 epochs";
|
|
86
|
+
}];
|
|
87
|
+
}, {
|
|
88
|
+
readonly condition: "if current_epoch >= unlock_epoch (normal unlock)";
|
|
89
|
+
readonly writes: readonly [{
|
|
90
|
+
readonly key: "bic:coin:balance:{caller}:PRIME";
|
|
91
|
+
readonly operation: "mint";
|
|
92
|
+
readonly amount: "amount * multiplier";
|
|
93
|
+
readonly description: "Mints PRIME points";
|
|
94
|
+
}, {
|
|
95
|
+
readonly key: "bic:coin:balance:{caller}:AMA";
|
|
96
|
+
readonly operation: "increment";
|
|
97
|
+
readonly amount: "amount";
|
|
98
|
+
readonly description: "Returns locked AMA";
|
|
99
|
+
}];
|
|
100
|
+
}];
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
readonly type: "function";
|
|
104
|
+
readonly name: "daily_checkin";
|
|
105
|
+
readonly inputs: readonly [{
|
|
106
|
+
readonly name: "vaultIndex";
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
readonly description: "Vault index for checkin (as string, e.g., \"0\", \"1\", \"2\")";
|
|
109
|
+
}];
|
|
110
|
+
readonly outputs: readonly [];
|
|
111
|
+
readonly stateMutability: "nonpayable";
|
|
112
|
+
readonly description: "Daily checkin to earn bonus PRIME points and maintain streak";
|
|
113
|
+
readonly requirements: readonly ["vault must exist", "must be within 2-epoch checkin window", "vault must belong to caller"];
|
|
114
|
+
readonly storage: {
|
|
115
|
+
readonly reads: readonly [{
|
|
116
|
+
readonly key: "bic:lockup_prime:vault:{caller}:{vault_index}";
|
|
117
|
+
readonly value: "{tier}-{multiplier}-{unlock_epoch}-{amount}";
|
|
118
|
+
readonly description: "Reads vault amount for bonus calculation";
|
|
119
|
+
}, {
|
|
120
|
+
readonly key: "bic:lockup_prime:next_checkin_epoch:{caller}";
|
|
121
|
+
readonly value: "epoch (as string)";
|
|
122
|
+
readonly description: "Next allowed checkin epoch";
|
|
123
|
+
}];
|
|
124
|
+
readonly writes: readonly [{
|
|
125
|
+
readonly condition: "if delta == 0 || delta == 1 (valid checkin)";
|
|
126
|
+
readonly writes: readonly [{
|
|
127
|
+
readonly key: "bic:lockup_prime:next_checkin_epoch:{caller}";
|
|
128
|
+
readonly value: "current_epoch + 2";
|
|
129
|
+
readonly description: "Updates next checkin epoch";
|
|
130
|
+
}, {
|
|
131
|
+
readonly key: "bic:coin:balance:{caller}:PRIME";
|
|
132
|
+
readonly operation: "mint";
|
|
133
|
+
readonly amount: "unlock_amount / 100";
|
|
134
|
+
readonly description: "Daily bonus (1% of locked amount)";
|
|
135
|
+
}, {
|
|
136
|
+
readonly key: "bic:lockup_prime:daily_streak:{caller}";
|
|
137
|
+
readonly operation: "increment";
|
|
138
|
+
readonly description: "Increments streak counter";
|
|
139
|
+
}, {
|
|
140
|
+
readonly condition: "if streak >= 30";
|
|
141
|
+
readonly writes: readonly [{
|
|
142
|
+
readonly key: "bic:lockup_prime:daily_streak:{caller}";
|
|
143
|
+
readonly value: "0";
|
|
144
|
+
readonly description: "Resets streak after bonus";
|
|
145
|
+
}, {
|
|
146
|
+
readonly key: "bic:coin:balance:{caller}:PRIME";
|
|
147
|
+
readonly operation: "mint";
|
|
148
|
+
readonly amount: "daily_bonus * 30";
|
|
149
|
+
readonly description: "Streak bonus (30x daily bonus)";
|
|
150
|
+
}];
|
|
151
|
+
}];
|
|
152
|
+
}, {
|
|
153
|
+
readonly condition: "if delta > 2 (missed checkin)";
|
|
154
|
+
readonly writes: readonly [{
|
|
155
|
+
readonly key: "bic:lockup_prime:next_checkin_epoch:{caller}";
|
|
156
|
+
readonly value: "current_epoch + 2";
|
|
157
|
+
readonly description: "Resets next checkin epoch";
|
|
158
|
+
}, {
|
|
159
|
+
readonly key: "bic:lockup_prime:daily_streak:{caller}";
|
|
160
|
+
readonly value: "0";
|
|
161
|
+
readonly description: "Resets streak to 0";
|
|
162
|
+
}];
|
|
163
|
+
}];
|
|
164
|
+
};
|
|
165
|
+
}];
|
|
166
|
+
readonly errors: readonly [{
|
|
167
|
+
readonly name: "invalid_args";
|
|
168
|
+
readonly code: "INVALID_ARGS";
|
|
169
|
+
readonly description: "Invalid number of arguments";
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "invalid_amount";
|
|
172
|
+
readonly code: "INVALID_AMOUNT";
|
|
173
|
+
readonly description: "Amount must be > 1 flat unit and valid i128";
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "invalid_tier";
|
|
176
|
+
readonly code: "INVALID_TIER";
|
|
177
|
+
readonly description: "Tier must be one of: 7d, 30d, 90d, 180d, 365d";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "insufficient_funds";
|
|
180
|
+
readonly code: "INSUFFICIENT_FUNDS";
|
|
181
|
+
readonly description: "Insufficient AMA balance";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "invalid_vault";
|
|
184
|
+
readonly code: "INVALID_VAULT";
|
|
185
|
+
readonly description: "Vault does not exist or does not belong to caller";
|
|
186
|
+
}, {
|
|
187
|
+
readonly name: "invalid_multiplier";
|
|
188
|
+
readonly code: "INVALID_MULTIPLIER";
|
|
189
|
+
readonly description: "Invalid multiplier value in vault data";
|
|
190
|
+
}, {
|
|
191
|
+
readonly name: "invalid_unlock_epoch";
|
|
192
|
+
readonly code: "INVALID_UNLOCK_EPOCH";
|
|
193
|
+
readonly description: "Invalid unlock epoch value in vault data";
|
|
194
|
+
}, {
|
|
195
|
+
readonly name: "invalid_unlock_amount";
|
|
196
|
+
readonly code: "INVALID_UNLOCK_AMOUNT";
|
|
197
|
+
readonly description: "Invalid unlock amount value in vault data";
|
|
198
|
+
}, {
|
|
199
|
+
readonly name: "invalid_next_checkin_epoch";
|
|
200
|
+
readonly code: "INVALID_NEXT_CHECKIN_EPOCH";
|
|
201
|
+
readonly description: "Invalid next checkin epoch value";
|
|
202
|
+
}];
|
|
203
|
+
readonly storage: {
|
|
204
|
+
readonly keys: readonly [{
|
|
205
|
+
readonly name: "vault";
|
|
206
|
+
readonly pattern: "bic:lockup_prime:vault:{account}:{vault_index}";
|
|
207
|
+
readonly type: "mapping";
|
|
208
|
+
readonly description: "Vault data for each account and vault index";
|
|
209
|
+
readonly valueFormat: "{tier}-{multiplier}-{unlock_epoch}-{amount}";
|
|
210
|
+
readonly valueSchema: {
|
|
211
|
+
readonly tier: {
|
|
212
|
+
readonly type: "string";
|
|
213
|
+
readonly enum: readonly ["7d", "30d", "90d", "180d", "365d"];
|
|
214
|
+
};
|
|
215
|
+
readonly multiplier: {
|
|
216
|
+
readonly type: "string";
|
|
217
|
+
readonly description: "Multiplier as string (e.g., \"17\", \"27\")";
|
|
218
|
+
readonly parseAs: "u64";
|
|
219
|
+
};
|
|
220
|
+
readonly unlock_epoch: {
|
|
221
|
+
readonly type: "string";
|
|
222
|
+
readonly description: "Unlock epoch as string";
|
|
223
|
+
readonly parseAs: "u64";
|
|
224
|
+
};
|
|
225
|
+
readonly amount: {
|
|
226
|
+
readonly type: "string";
|
|
227
|
+
readonly description: "Locked amount in flat units as string";
|
|
228
|
+
readonly parseAs: "u64";
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
readonly query: {
|
|
232
|
+
readonly method: "POST";
|
|
233
|
+
readonly endpoint: "/api/contract/get_prefix";
|
|
234
|
+
readonly prefix: "bic:lockup_prime:vault:{account_binary}:";
|
|
235
|
+
readonly description: "Get all vaults for an account. Returns array of [key, value] tuples.";
|
|
236
|
+
};
|
|
237
|
+
}, {
|
|
238
|
+
readonly name: "daily_streak";
|
|
239
|
+
readonly pattern: "bic:lockup_prime:daily_streak:{account}";
|
|
240
|
+
readonly type: "value";
|
|
241
|
+
readonly description: "Current daily checkin streak count";
|
|
242
|
+
readonly valueFormat: "string (number)";
|
|
243
|
+
readonly valueSchema: {
|
|
244
|
+
readonly type: "string";
|
|
245
|
+
readonly parseAs: "u64";
|
|
246
|
+
readonly description: "Streak count as string (e.g., \"5\", \"0\")";
|
|
247
|
+
};
|
|
248
|
+
readonly query: {
|
|
249
|
+
readonly method: "POST";
|
|
250
|
+
readonly endpoint: "/api/contract/get";
|
|
251
|
+
readonly key: "bic:lockup_prime:daily_streak:{account_binary}";
|
|
252
|
+
readonly description: "Get daily streak for an account";
|
|
253
|
+
};
|
|
254
|
+
}, {
|
|
255
|
+
readonly name: "next_checkin_epoch";
|
|
256
|
+
readonly pattern: "bic:lockup_prime:next_checkin_epoch:{account}";
|
|
257
|
+
readonly type: "value";
|
|
258
|
+
readonly description: "Next epoch when checkin is allowed";
|
|
259
|
+
readonly valueFormat: "string (number)";
|
|
260
|
+
readonly valueSchema: {
|
|
261
|
+
readonly type: "string";
|
|
262
|
+
readonly parseAs: "u64";
|
|
263
|
+
readonly description: "Epoch as string (e.g., \"145\", \"200\")";
|
|
264
|
+
};
|
|
265
|
+
readonly query: {
|
|
266
|
+
readonly method: "POST";
|
|
267
|
+
readonly endpoint: "/api/contract/get";
|
|
268
|
+
readonly key: "bic:lockup_prime:next_checkin_epoch:{account_binary}";
|
|
269
|
+
readonly description: "Get next checkin epoch for an account";
|
|
270
|
+
};
|
|
271
|
+
}, {
|
|
272
|
+
readonly name: "unique_index";
|
|
273
|
+
readonly pattern: "bic:lockup_prime:unique_index";
|
|
274
|
+
readonly type: "value";
|
|
275
|
+
readonly description: "Global vault index counter";
|
|
276
|
+
readonly valueFormat: "string (number)";
|
|
277
|
+
readonly valueSchema: {
|
|
278
|
+
readonly type: "string";
|
|
279
|
+
readonly parseAs: "u64";
|
|
280
|
+
readonly description: "Global counter as string";
|
|
281
|
+
};
|
|
282
|
+
readonly query: {
|
|
283
|
+
readonly method: "POST";
|
|
284
|
+
readonly endpoint: "/api/contract/get";
|
|
285
|
+
readonly key: "bic:lockup_prime:unique_index";
|
|
286
|
+
readonly description: "Get global vault index counter";
|
|
287
|
+
};
|
|
288
|
+
}];
|
|
289
|
+
};
|
|
290
|
+
readonly constants: {
|
|
291
|
+
readonly tiers: {
|
|
292
|
+
readonly '7d': {
|
|
293
|
+
readonly epochs: 10;
|
|
294
|
+
readonly multiplier: 13;
|
|
295
|
+
readonly label: "7 Days";
|
|
296
|
+
};
|
|
297
|
+
readonly '30d': {
|
|
298
|
+
readonly epochs: 45;
|
|
299
|
+
readonly multiplier: 17;
|
|
300
|
+
readonly label: "30 Days";
|
|
301
|
+
};
|
|
302
|
+
readonly '90d': {
|
|
303
|
+
readonly epochs: 135;
|
|
304
|
+
readonly multiplier: 27;
|
|
305
|
+
readonly label: "90 Days";
|
|
306
|
+
};
|
|
307
|
+
readonly '180d': {
|
|
308
|
+
readonly epochs: 270;
|
|
309
|
+
readonly multiplier: 35;
|
|
310
|
+
readonly label: "180 Days";
|
|
311
|
+
};
|
|
312
|
+
readonly '365d': {
|
|
313
|
+
readonly epochs: 547;
|
|
314
|
+
readonly multiplier: 54;
|
|
315
|
+
readonly label: "365 Days";
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
readonly values: {
|
|
319
|
+
readonly MIN_LOCK_AMOUNT: "1";
|
|
320
|
+
readonly DAILY_BONUS_PERCENTAGE: "100";
|
|
321
|
+
readonly STREAK_BONUS_THRESHOLD: "30";
|
|
322
|
+
readonly STREAK_BONUS_MULTIPLIER: "30";
|
|
323
|
+
readonly EARLY_UNLOCK_PENALTY: "0.25";
|
|
324
|
+
readonly EARLY_UNLOCK_LOCK_DURATION: "5";
|
|
325
|
+
readonly CHECKIN_WINDOW: "2";
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
readonly encoding: {
|
|
329
|
+
readonly args: {
|
|
330
|
+
readonly format: "UTF-8 encoded strings";
|
|
331
|
+
readonly description: "All function arguments must be UTF-8 encoded as Uint8Array using TextEncoder";
|
|
332
|
+
readonly example: {
|
|
333
|
+
readonly lock: readonly ["new TextEncoder().encode('1000000000000')", "new TextEncoder().encode('30d')"];
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
readonly storage: {
|
|
337
|
+
readonly keys: {
|
|
338
|
+
readonly format: "Binary (48 bytes for account)";
|
|
339
|
+
readonly description: "Storage keys use binary account addresses, not base58";
|
|
340
|
+
};
|
|
341
|
+
readonly values: {
|
|
342
|
+
readonly format: "UTF-8 strings";
|
|
343
|
+
readonly description: "All storage values are UTF-8 encoded strings";
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../../src/contracts/lockup-prime/abi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8ZnB,CAAA"}
|