@amadeus-protocol/sdk 1.0.8 → 1.1.1
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 +215 -30
- package/dist/api/chain.d.ts +144 -117
- package/dist/api/chain.d.ts.map +1 -1
- package/dist/api/chain.js +175 -146
- package/dist/api/chain.js.map +1 -1
- package/dist/api/contract.d.ts +78 -60
- package/dist/api/contract.d.ts.map +1 -1
- package/dist/api/contract.js +102 -75
- package/dist/api/contract.js.map +1 -1
- package/dist/api/epoch.d.ts +65 -66
- package/dist/api/epoch.d.ts.map +1 -1
- package/dist/api/epoch.js +90 -98
- package/dist/api/epoch.js.map +1 -1
- package/dist/api/peer.d.ts +77 -78
- package/dist/api/peer.d.ts.map +1 -1
- package/dist/api/peer.js +93 -94
- package/dist/api/peer.js.map +1 -1
- package/dist/api/proof.d.ts +44 -23
- package/dist/api/proof.d.ts.map +1 -1
- package/dist/api/proof.js +56 -29
- package/dist/api/proof.js.map +1 -1
- package/dist/api/transaction.d.ts +68 -69
- package/dist/api/transaction.d.ts.map +1 -1
- package/dist/api/transaction.js +84 -84
- package/dist/api/transaction.js.map +1 -1
- package/dist/api/wallet.d.ts +36 -37
- package/dist/api/wallet.d.ts.map +1 -1
- package/dist/api/wallet.js +47 -50
- package/dist/api/wallet.js.map +1 -1
- package/dist/client.d.ts +66 -68
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +231 -276
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +13 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +49 -45
- package/dist/constants.js.map +1 -1
- package/dist/contract-state.d.ts +6 -3
- package/dist/contract-state.d.ts.map +1 -1
- package/dist/contract-state.js +88 -106
- package/dist/contract-state.js.map +1 -1
- package/dist/contracts/abi-types.d.ts +32 -32
- package/dist/contracts/abi-types.d.ts.map +1 -1
- package/dist/contracts/coin.d.ts +13 -20
- package/dist/contracts/coin.d.ts.map +1 -1
- package/dist/contracts/coin.js +42 -38
- package/dist/contracts/coin.js.map +1 -1
- package/dist/contracts/contract-call.d.ts +14 -16
- package/dist/contracts/contract-call.d.ts.map +1 -1
- package/dist/contracts/contract-call.js +45 -54
- package/dist/contracts/contract-call.js.map +1 -1
- package/dist/contracts/contract.d.ts +24 -55
- package/dist/contracts/contract.d.ts.map +1 -1
- package/dist/contracts/contract.js +63 -101
- package/dist/contracts/contract.js.map +1 -1
- package/dist/contracts/lockup/abi.d.ts +54 -51
- package/dist/contracts/lockup/abi.d.ts.map +1 -1
- package/dist/contracts/lockup/abi.js +65 -74
- package/dist/contracts/lockup/abi.js.map +1 -1
- package/dist/contracts/lockup/helpers.d.ts +22 -18
- package/dist/contracts/lockup/helpers.d.ts.map +1 -1
- package/dist/contracts/lockup/helpers.js +44 -47
- package/dist/contracts/lockup/helpers.js.map +1 -1
- package/dist/contracts/lockup/parsers.d.ts +7 -3
- package/dist/contracts/lockup/parsers.d.ts.map +1 -1
- package/dist/contracts/lockup/parsers.js +51 -55
- package/dist/contracts/lockup/parsers.js.map +1 -1
- package/dist/contracts/lockup/storage-keys.d.ts +5 -2
- package/dist/contracts/lockup/storage-keys.d.ts.map +1 -1
- package/dist/contracts/lockup/storage-keys.js +54 -70
- package/dist/contracts/lockup/storage-keys.js.map +1 -1
- package/dist/contracts/lockup/types.d.ts +73 -70
- package/dist/contracts/lockup/types.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/abi.d.ts +328 -325
- package/dist/contracts/lockup-prime/abi.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/abi.js +397 -417
- package/dist/contracts/lockup-prime/abi.js.map +1 -1
- package/dist/contracts/lockup-prime/helpers.d.ts +35 -31
- package/dist/contracts/lockup-prime/helpers.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/helpers.js +131 -137
- package/dist/contracts/lockup-prime/helpers.js.map +1 -1
- package/dist/contracts/lockup-prime/parsers.d.ts +9 -5
- package/dist/contracts/lockup-prime/parsers.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/parsers.js +61 -61
- package/dist/contracts/lockup-prime/parsers.js.map +1 -1
- package/dist/contracts/lockup-prime/storage-keys.d.ts +7 -4
- package/dist/contracts/lockup-prime/storage-keys.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/storage-keys.js +64 -80
- package/dist/contracts/lockup-prime/storage-keys.js.map +1 -1
- package/dist/contracts/lockup-prime/types.d.ts +92 -89
- package/dist/contracts/lockup-prime/types.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/types.js +12 -13
- package/dist/contracts/lockup-prime/types.js.map +1 -1
- package/dist/contracts/nft/abi.d.ts +104 -0
- package/dist/contracts/nft/abi.d.ts.map +1 -0
- package/dist/contracts/nft/abi.js +135 -0
- package/dist/contracts/nft/abi.js.map +1 -0
- package/dist/contracts/nft/helpers.d.ts +21 -0
- package/dist/contracts/nft/helpers.d.ts.map +1 -0
- package/dist/contracts/nft/helpers.js +61 -0
- package/dist/contracts/nft/helpers.js.map +1 -0
- package/dist/contracts/nft/types.d.ts +47 -0
- package/dist/contracts/nft/types.d.ts.map +1 -0
- package/dist/conversion.d.ts +5 -2
- package/dist/conversion.d.ts.map +1 -1
- package/dist/conversion.js +45 -50
- package/dist/conversion.js.map +1 -1
- package/dist/crypto.d.ts +14 -16
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +121 -140
- package/dist/crypto.js.map +1 -1
- package/dist/encoding.d.ts +11 -8
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.js +123 -144
- package/dist/encoding.js.map +1 -1
- package/dist/encryption.d.ts +15 -12
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +119 -117
- package/dist/encryption.js.map +1 -1
- package/dist/explorer.d.ts +10 -7
- package/dist/explorer.d.ts.map +1 -1
- package/dist/explorer.js +51 -48
- package/dist/explorer.js.map +1 -1
- package/dist/formatters.d.ts +8 -5
- package/dist/formatters.d.ts.map +1 -1
- package/dist/formatters.js +67 -68
- package/dist/formatters.js.map +1 -1
- package/dist/index.d.ts +42 -55
- package/dist/index.js +39 -55
- package/dist/mnemonic.d.ts +12 -9
- package/dist/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic.js +105 -114
- package/dist/mnemonic.js.map +1 -1
- package/dist/networks.d.ts +14 -17
- package/dist/networks.d.ts.map +1 -1
- package/dist/networks.js +40 -36
- package/dist/networks.js.map +1 -1
- package/dist/schemas.js +75 -79
- package/dist/schemas.js.map +1 -1
- package/dist/sdk.d.ts +69 -65
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +126 -117
- package/dist/sdk.js.map +1 -1
- package/dist/serialization.d.ts +8 -18
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +207 -260
- package/dist/serialization.js.map +1 -1
- package/dist/signing.js +67 -67
- package/dist/signing.js.map +1 -1
- package/dist/transaction-builder.d.ts +175 -184
- package/dist/transaction-builder.d.ts.map +1 -1
- package/dist/transaction-builder.js +295 -344
- package/dist/transaction-builder.js.map +1 -1
- package/dist/transaction-errors.d.ts +10 -12
- package/dist/transaction-errors.d.ts.map +1 -1
- package/dist/transaction-errors.js +145 -166
- package/dist/transaction-errors.js.map +1 -1
- package/dist/types.d.ts +530 -450
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +169 -183
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +24 -26
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +194 -192
- package/dist/validation.js.map +1 -1
- package/package.json +4 -3
- package/dist/api/index.d.ts +0 -8
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -8
- package/dist/api/index.js.map +0 -1
- package/dist/contracts/abi-types.js +0 -8
- package/dist/contracts/abi-types.js.map +0 -1
- package/dist/contracts/index.d.ts +0 -7
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js +0 -7
- package/dist/contracts/index.js.map +0 -1
- package/dist/contracts/lockup/calls.d.ts +0 -23
- package/dist/contracts/lockup/calls.d.ts.map +0 -1
- package/dist/contracts/lockup/calls.js +0 -25
- package/dist/contracts/lockup/calls.js.map +0 -1
- package/dist/contracts/lockup/index.d.ts +0 -6
- package/dist/contracts/lockup/index.d.ts.map +0 -1
- package/dist/contracts/lockup/index.js +0 -6
- package/dist/contracts/lockup/index.js.map +0 -1
- package/dist/contracts/lockup/types.js +0 -7
- package/dist/contracts/lockup/types.js.map +0 -1
- package/dist/contracts/lockup-prime/calls.d.ts +0 -53
- package/dist/contracts/lockup-prime/calls.d.ts.map +0 -1
- package/dist/contracts/lockup-prime/calls.js +0 -60
- package/dist/contracts/lockup-prime/calls.js.map +0 -1
- package/dist/contracts/lockup-prime/index.d.ts +0 -6
- package/dist/contracts/lockup-prime/index.d.ts.map +0 -1
- package/dist/contracts/lockup-prime/index.js +0 -6
- package/dist/contracts/lockup-prime/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schemas.d.ts +0 -67
- package/dist/schemas.d.ts.map +0 -1
- package/dist/signing.d.ts +0 -39
- package/dist/signing.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","
|
|
1
|
+
{"version":3,"file":"contract.js","names":[],"sources":["../../src/contracts/contract.ts"],"sourcesContent":["/**\n * ABI-Driven Contract Factory\n *\n * Generates fully-typed contract interfaces from `as const` ABI definitions,\n * similar to viem's getContract() or ethers typechain.\n *\n * Each function declared in the ABI becomes a typed method on the contract\n * object — with autocomplete for function names and typed params derived\n * from the ABI inputs.\n *\n * @example\n * ```ts\n * import { createContract, LOCKUP_PRIME_ABI, toAtomicAma } from '@amadeus-protocol/sdk'\n *\n * // Unsigned — returns ContractCall for TransactionBuilder.signCall()\n * const lockupPrime = createContract(LOCKUP_PRIME_ABI)\n * const call = lockupPrime.lock({ amount: toAtomicAma(100).toString(), tier: '30d' })\n * const { txHash, txPacked } = TransactionBuilder.signCall(privateKey, call)\n *\n * // Signed — bind a private key, methods return BuildTransactionResult directly\n * const signed = createContract(LOCKUP_PRIME_ABI).connect(privateKey)\n * const result = signed.lock({ amount: toAtomicAma(100).toString(), tier: '30d' })\n * ```\n */\n\nimport type { BuildTransactionResult } from '../types'\nimport { signContractCall } from '../signing'\nimport type { AbiDefinition, AbiInput } from './abi-types'\nimport type { ContractCall } from './contract-call'\nimport { buildContractCall } from './contract-call'\n\n// ── Type-level ABI → Method mapping ─────────────────────────────────\n\n/**\n * Map an ABI inputs tuple to a params object: `{ inputName: string }`\n */\ntype InputsToParams<Inputs extends readonly AbiInput[]> = {\n\treadonly [I in Inputs[number] as I['name']]: string\n}\n\n/**\n * For each function in the ABI, generate a typed method signature.\n *\n * - Functions with inputs → `(params: { name: string, ... }) => ContractCall`\n * - Functions without inputs → `() => ContractCall`\n */\ntype ContractMethods<TAbi extends AbiDefinition> = {\n\treadonly [F in TAbi['abi'][number] as F['name']]: F['inputs'] extends readonly []\n\t\t? () => ContractCall\n\t\t: (params: InputsToParams<F['inputs']>) => ContractCall\n}\n\n/**\n * Same as ContractMethods but methods return signed `BuildTransactionResult`.\n */\ntype SignedContractMethods<TAbi extends AbiDefinition> = {\n\treadonly [F in TAbi['abi'][number] as F['name']]: F['inputs'] extends readonly []\n\t\t? () => BuildTransactionResult\n\t\t: (params: InputsToParams<F['inputs']>) => BuildTransactionResult\n}\n\n// ── Public types ────────────────────────────────────────────────────\n\n/**\n * A typed contract interface generated from an ABI definition.\n *\n * Each ABI function is exposed as a method that returns a `ContractCall`\n * (ready for `TransactionBuilder.signCall()`).\n *\n * Call `.connect(privateKey)` to get a `SignedContract` where methods\n * return `BuildTransactionResult` directly.\n */\nexport type TypedContract<TAbi extends AbiDefinition> = ContractMethods<TAbi> & {\n\t/** The original ABI definition */\n\treadonly abi: TAbi\n\t/** Contract name extracted from ABI */\n\treadonly contractName: TAbi['contractName']\n\t/**\n\t * Bind a signer to produce a `SignedContract` where every method\n\t * derives keys, builds, and signs in one step.\n\t *\n\t * @param privateKey - Base58 encoded private key (seed)\n\t */\n\tconnect(privateKey: string): SignedContract<TAbi>\n}\n\n/**\n * A signer-bound contract interface.\n *\n * Every ABI function is a method that returns `BuildTransactionResult`\n * (txHash + txPacked ready for submission).\n */\nexport type SignedContract<TAbi extends AbiDefinition> = SignedContractMethods<TAbi> & {\n\t/** The original ABI definition */\n\treadonly abi: TAbi\n\t/** Contract name extracted from ABI */\n\treadonly contractName: TAbi['contractName']\n}\n\n// ── Factory functions ───────────────────────────────────────────────\n\n/**\n * Create a typed contract interface from an ABI definition.\n *\n * Returns an object where each ABI function is a method with fully typed\n * params (derived from ABI inputs) and autocomplete on function names.\n *\n * @param abi - An ABI definition object (must be declared `as const`)\n * @returns A typed `TypedContract<TAbi>` with methods for each ABI function\n *\n * @example\n * ```ts\n * import { createContract, LOCKUP_PRIME_ABI, LOCKUP_ABI, toAtomicAma } from '@amadeus-protocol/sdk'\n *\n * // Each ABI function becomes a typed method:\n * const lockupPrime = createContract(LOCKUP_PRIME_ABI)\n * lockupPrime.lock({ amount: toAtomicAma(100).toString(), tier: '30d' }) // typed\n * lockupPrime.unlock({ vaultIndex: '3' }) // typed\n * lockupPrime.daily_checkin({ vaultIndex: '7' }) // typed\n *\n * // Sign the call:\n * const call = lockupPrime.lock({ amount: '100000000000', tier: '30d' })\n * const { txHash, txPacked } = TransactionBuilder.signCall(privateKey, call)\n *\n * // Or bind a signer:\n * const signed = lockupPrime.connect(privateKey)\n * const result = signed.lock({ amount: '100000000000', tier: '30d' })\n * ```\n */\nexport function createContract<TAbi extends AbiDefinition>(abi: TAbi): TypedContract<TAbi> {\n\tif (!abi || typeof abi !== 'object') {\n\t\tthrow new Error('Invalid ABI: expected an object')\n\t}\n\tif (typeof abi.contractName !== 'string' || !abi.contractName) {\n\t\tthrow new Error('Invalid ABI: missing or empty \"contractName\"')\n\t}\n\tif (!Array.isArray(abi.abi)) {\n\t\tthrow new Error(`Invalid ABI for ${abi.contractName}: \"abi\" must be an array of functions`)\n\t}\n\tfor (const fn of abi.abi) {\n\t\tif (fn.type !== 'function') {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid ABI for ${abi.contractName}: entry \"${fn.name ?? '?'}\" has type \"${fn.type}\", expected \"function\"`\n\t\t\t)\n\t\t}\n\t\tif (typeof fn.name !== 'string' || !fn.name) {\n\t\t\tthrow new Error(`Invalid ABI for ${abi.contractName}: function entry missing \"name\"`)\n\t\t}\n\t\tif (!Array.isArray(fn.inputs)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid ABI for ${abi.contractName}: function \"${fn.name}\" missing \"inputs\" array`\n\t\t\t)\n\t\t}\n\t}\n\n\tconst contract: Record<string, unknown> = {\n\t\tabi,\n\t\tcontractName: abi.contractName,\n\t\tconnect(privateKey: string) {\n\t\t\treturn createSignedContract(abi, privateKey)\n\t\t}\n\t}\n\n\tfor (const fn of abi.abi) {\n\t\tcontract[fn.name] = (params?: Record<string, string>) => {\n\t\t\treturn buildContractCall(abi, fn.name as never, (params ?? {}) as never)\n\t\t}\n\t}\n\n\treturn contract as TypedContract<TAbi>\n}\n\n/**\n * Create a signer-bound contract where each method builds + signs in one step.\n */\nfunction createSignedContract<TAbi extends AbiDefinition>(\n\tabi: TAbi,\n\tprivateKey: string\n): SignedContract<TAbi> {\n\tconst contract: Record<string, unknown> = {\n\t\tabi,\n\t\tcontractName: abi.contractName\n\t}\n\n\tfor (const fn of abi.abi) {\n\t\tcontract[fn.name] = (params?: Record<string, string>) => {\n\t\t\tconst call = buildContractCall(abi, fn.name as never, (params ?? {}) as never)\n\t\t\treturn signContractCall(privateKey, call)\n\t\t}\n\t}\n\n\treturn contract as SignedContract<TAbi>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIA,SAAgB,eAA2C,KAAgC;CAC1F,IAAI,CAAC,OAAO,OAAO,QAAQ,UAC1B,MAAM,IAAI,MAAM,kCAAkC;CAEnD,IAAI,OAAO,IAAI,iBAAiB,YAAY,CAAC,IAAI,cAChD,MAAM,IAAI,MAAM,iDAA+C;CAEhE,IAAI,CAAC,MAAM,QAAQ,IAAI,IAAI,EAC1B,MAAM,IAAI,MAAM,mBAAmB,IAAI,aAAa,uCAAuC;CAE5F,KAAK,MAAM,MAAM,IAAI,KAAK;EACzB,IAAI,GAAG,SAAS,YACf,MAAM,IAAI,MACT,mBAAmB,IAAI,aAAa,WAAW,GAAG,QAAQ,IAAI,cAAc,GAAG,KAAK,wBACpF;EAEF,IAAI,OAAO,GAAG,SAAS,YAAY,CAAC,GAAG,MACtC,MAAM,IAAI,MAAM,mBAAmB,IAAI,aAAa,iCAAiC;EAEtF,IAAI,CAAC,MAAM,QAAQ,GAAG,OAAO,EAC5B,MAAM,IAAI,MACT,mBAAmB,IAAI,aAAa,cAAc,GAAG,KAAK,0BAC1D;;CAIH,MAAM,WAAoC;EACzC;EACA,cAAc,IAAI;EAClB,QAAQ,YAAoB;GAC3B,OAAO,qBAAqB,KAAK,WAAW;;EAE7C;CAED,KAAK,MAAM,MAAM,IAAI,KACpB,SAAS,GAAG,SAAS,WAAoC;EACxD,OAAO,kBAAkB,KAAK,GAAG,MAAgB,UAAU,EAAE,CAAW;;CAI1E,OAAO;;;;;AAMR,SAAS,qBACR,KACA,YACuB;CACvB,MAAM,WAAoC;EACzC;EACA,cAAc,IAAI;EAClB;CAED,KAAK,MAAM,MAAM,IAAI,KACpB,SAAS,GAAG,SAAS,WAAoC;EAExD,OAAO,iBAAiB,YADX,kBAAkB,KAAK,GAAG,MAAgB,UAAU,EAAE,CAC3B,CAAC;;CAI3C,OAAO"}
|
|
@@ -1,62 +1,65 @@
|
|
|
1
|
+
//#region src/contracts/lockup/abi.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Lockup Smart Contract ABI
|
|
3
4
|
*
|
|
4
5
|
* Standard ABI format
|
|
5
6
|
* Based on: /root/node/ex/native/rdb/src/consensus/bic/lockup.rs
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}];
|
|
18
|
-
readonly outputs: readonly [];
|
|
19
|
-
readonly stateMutability: "nonpayable";
|
|
20
|
-
readonly description: "Unlock a vault and receive locked tokens";
|
|
21
|
-
readonly requirements: readonly ["vault must exist", "vault must belong to caller", "entry_height >= unlock_height"];
|
|
22
|
-
readonly storage: {
|
|
23
|
-
readonly reads: readonly [{
|
|
24
|
-
readonly key: "bic:lockup:vault:{caller}:{vault_index}";
|
|
25
|
-
readonly value: "{unlock_height}-{amount}-{symbol}";
|
|
26
|
-
readonly description: "Reads vault data";
|
|
27
|
-
}];
|
|
28
|
-
readonly writes: readonly [{
|
|
29
|
-
readonly key: "bic:lockup:vault:{caller}:{vault_index}";
|
|
30
|
-
readonly operation: "delete";
|
|
31
|
-
readonly description: "Deletes vault after unlock";
|
|
32
|
-
}, {
|
|
33
|
-
readonly key: "bic:coin:balance:{caller}:AMA";
|
|
34
|
-
readonly operation: "increment";
|
|
35
|
-
readonly amount: "amount";
|
|
36
|
-
readonly description: "Returns locked AMA tokens";
|
|
37
|
-
}];
|
|
38
|
-
};
|
|
8
|
+
declare const LOCKUP_ABI: {
|
|
9
|
+
readonly contractName: "Lockup";
|
|
10
|
+
readonly contractVersion: "1.0.0";
|
|
11
|
+
readonly abi: readonly [{
|
|
12
|
+
readonly type: "function";
|
|
13
|
+
readonly name: "unlock";
|
|
14
|
+
readonly inputs: readonly [{
|
|
15
|
+
readonly name: "vaultIndex";
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "Vault index to unlock (as string, e.g., \"0\", \"1\", \"2\")";
|
|
39
18
|
}];
|
|
19
|
+
readonly outputs: readonly [];
|
|
20
|
+
readonly stateMutability: "nonpayable";
|
|
21
|
+
readonly description: "Unlock a vault and receive locked tokens";
|
|
22
|
+
readonly requirements: readonly ["vault must exist", "vault must belong to caller", "entry_height >= unlock_height"];
|
|
40
23
|
readonly storage: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
readonly description: "Get all vaults for an account";
|
|
57
|
-
};
|
|
58
|
-
}];
|
|
24
|
+
readonly reads: readonly [{
|
|
25
|
+
readonly key: "bic:lockup:vault:{caller}:{vault_index}";
|
|
26
|
+
readonly value: "{unlock_height}-{amount}-{symbol}";
|
|
27
|
+
readonly description: "Reads vault data";
|
|
28
|
+
}];
|
|
29
|
+
readonly writes: readonly [{
|
|
30
|
+
readonly key: "bic:lockup:vault:{caller}:{vault_index}";
|
|
31
|
+
readonly operation: "delete";
|
|
32
|
+
readonly description: "Deletes vault after unlock";
|
|
33
|
+
}, {
|
|
34
|
+
readonly key: "bic:coin:balance:{caller}:AMA";
|
|
35
|
+
readonly operation: "increment";
|
|
36
|
+
readonly amount: "amount";
|
|
37
|
+
readonly description: "Returns locked AMA tokens";
|
|
38
|
+
}];
|
|
59
39
|
};
|
|
60
|
-
|
|
40
|
+
}];
|
|
41
|
+
readonly storage: {
|
|
42
|
+
readonly keys: readonly [{
|
|
43
|
+
readonly name: "vault";
|
|
44
|
+
readonly pattern: "bic:lockup:vault:{account}:{index}";
|
|
45
|
+
readonly type: "mapping";
|
|
46
|
+
readonly description: "Lockup vault storage key";
|
|
47
|
+
readonly valueFormat: "string";
|
|
48
|
+
readonly valueSchema: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly format: "{unlock_height}-{amount}-{symbol}";
|
|
51
|
+
readonly description: "Vault data format: unlock_height-amount-symbol";
|
|
52
|
+
};
|
|
53
|
+
readonly query: {
|
|
54
|
+
readonly method: "POST";
|
|
55
|
+
readonly endpoint: "/contract/get_prefix";
|
|
56
|
+
readonly prefix: "bic:lockup:vault:{account_binary}:";
|
|
57
|
+
readonly description: "Get all vaults for an account";
|
|
58
|
+
};
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
61
|
+
readonly errors: readonly [];
|
|
61
62
|
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { LOCKUP_ABI };
|
|
62
65
|
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abi.d.ts","
|
|
1
|
+
{"version":3,"file":"abi.d.ts","names":[],"sources":["../../../src/contracts/lockup/abi.ts"],"mappings":";;AAMA;;;;;cAAa,UAAA;EAAA"}
|
|
@@ -1,77 +1,68 @@
|
|
|
1
|
+
//#region src/contracts/lockup/abi.ts
|
|
1
2
|
/**
|
|
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
|
-
format: '{unlock_height}-{amount}-{symbol}',
|
|
64
|
-
description: 'Vault data format: unlock_height-amount-symbol'
|
|
65
|
-
},
|
|
66
|
-
query: {
|
|
67
|
-
method: 'POST',
|
|
68
|
-
endpoint: '/contract/get_prefix',
|
|
69
|
-
prefix: 'bic:lockup:vault:{account_binary}:',
|
|
70
|
-
description: 'Get all vaults for an account'
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
errors: []
|
|
3
|
+
* Lockup Smart Contract ABI
|
|
4
|
+
*
|
|
5
|
+
* Standard ABI format
|
|
6
|
+
* Based on: /root/node/ex/native/rdb/src/consensus/bic/lockup.rs
|
|
7
|
+
*/
|
|
8
|
+
const LOCKUP_ABI = {
|
|
9
|
+
contractName: "Lockup",
|
|
10
|
+
contractVersion: "1.0.0",
|
|
11
|
+
abi: [{
|
|
12
|
+
type: "function",
|
|
13
|
+
name: "unlock",
|
|
14
|
+
inputs: [{
|
|
15
|
+
name: "vaultIndex",
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Vault index to unlock (as string, e.g., \"0\", \"1\", \"2\")"
|
|
18
|
+
}],
|
|
19
|
+
outputs: [],
|
|
20
|
+
stateMutability: "nonpayable",
|
|
21
|
+
description: "Unlock a vault and receive locked tokens",
|
|
22
|
+
requirements: [
|
|
23
|
+
"vault must exist",
|
|
24
|
+
"vault must belong to caller",
|
|
25
|
+
"entry_height >= unlock_height"
|
|
26
|
+
],
|
|
27
|
+
storage: {
|
|
28
|
+
reads: [{
|
|
29
|
+
key: "bic:lockup:vault:{caller}:{vault_index}",
|
|
30
|
+
value: "{unlock_height}-{amount}-{symbol}",
|
|
31
|
+
description: "Reads vault data"
|
|
32
|
+
}],
|
|
33
|
+
writes: [{
|
|
34
|
+
key: "bic:lockup:vault:{caller}:{vault_index}",
|
|
35
|
+
operation: "delete",
|
|
36
|
+
description: "Deletes vault after unlock"
|
|
37
|
+
}, {
|
|
38
|
+
key: "bic:coin:balance:{caller}:AMA",
|
|
39
|
+
operation: "increment",
|
|
40
|
+
amount: "amount",
|
|
41
|
+
description: "Returns locked AMA tokens"
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
}],
|
|
45
|
+
storage: { keys: [{
|
|
46
|
+
name: "vault",
|
|
47
|
+
pattern: "bic:lockup:vault:{account}:{index}",
|
|
48
|
+
type: "mapping",
|
|
49
|
+
description: "Lockup vault storage key",
|
|
50
|
+
valueFormat: "string",
|
|
51
|
+
valueSchema: {
|
|
52
|
+
type: "string",
|
|
53
|
+
format: "{unlock_height}-{amount}-{symbol}",
|
|
54
|
+
description: "Vault data format: unlock_height-amount-symbol"
|
|
55
|
+
},
|
|
56
|
+
query: {
|
|
57
|
+
method: "POST",
|
|
58
|
+
endpoint: "/contract/get_prefix",
|
|
59
|
+
prefix: "bic:lockup:vault:{account_binary}:",
|
|
60
|
+
description: "Get all vaults for an account"
|
|
61
|
+
}
|
|
62
|
+
}] },
|
|
63
|
+
errors: []
|
|
76
64
|
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { LOCKUP_ABI };
|
|
67
|
+
|
|
77
68
|
//# sourceMappingURL=abi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abi.js","
|
|
1
|
+
{"version":3,"file":"abi.js","names":[],"sources":["../../../src/contracts/lockup/abi.ts"],"sourcesContent":["/**\n * Lockup Smart Contract ABI\n *\n * Standard ABI format\n * Based on: /root/node/ex/native/rdb/src/consensus/bic/lockup.rs\n */\nexport const LOCKUP_ABI = {\n\tcontractName: 'Lockup',\n\tcontractVersion: '1.0.0',\n\tabi: [\n\t\t{\n\t\t\ttype: 'function',\n\t\t\tname: 'unlock',\n\t\t\tinputs: [\n\t\t\t\t{\n\t\t\t\t\tname: 'vaultIndex',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'Vault index to unlock (as string, e.g., \"0\", \"1\", \"2\")'\n\t\t\t\t}\n\t\t\t],\n\t\t\toutputs: [],\n\t\t\tstateMutability: 'nonpayable',\n\t\t\tdescription: 'Unlock a vault and receive locked tokens',\n\t\t\trequirements: [\n\t\t\t\t'vault must exist',\n\t\t\t\t'vault must belong to caller',\n\t\t\t\t'entry_height >= unlock_height'\n\t\t\t],\n\t\t\tstorage: {\n\t\t\t\treads: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: 'bic:lockup:vault:{caller}:{vault_index}',\n\t\t\t\t\t\tvalue: '{unlock_height}-{amount}-{symbol}',\n\t\t\t\t\t\tdescription: 'Reads vault data'\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\twrites: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: 'bic:lockup:vault:{caller}:{vault_index}',\n\t\t\t\t\t\toperation: 'delete',\n\t\t\t\t\t\tdescription: 'Deletes vault after unlock'\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tkey: 'bic:coin:balance:{caller}:AMA',\n\t\t\t\t\t\toperation: 'increment',\n\t\t\t\t\t\tamount: 'amount',\n\t\t\t\t\t\tdescription: 'Returns locked AMA tokens'\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t],\n\tstorage: {\n\t\tkeys: [\n\t\t\t{\n\t\t\t\tname: 'vault',\n\t\t\t\tpattern: 'bic:lockup:vault:{account}:{index}',\n\t\t\t\ttype: 'mapping',\n\t\t\t\tdescription: 'Lockup vault storage key',\n\t\t\t\tvalueFormat: 'string',\n\t\t\t\tvalueSchema: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tformat: '{unlock_height}-{amount}-{symbol}',\n\t\t\t\t\tdescription: 'Vault data format: unlock_height-amount-symbol'\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tendpoint: '/contract/get_prefix',\n\t\t\t\t\tprefix: 'bic:lockup:vault:{account_binary}:',\n\t\t\t\t\tdescription: 'Get all vaults for an account'\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t},\n\terrors: []\n} as const\n"],"mappings":";;;;;;;AAMA,MAAa,aAAa;CACzB,cAAc;CACd,iBAAiB;CACjB,KAAK,CACJ;EACC,MAAM;EACN,MAAM;EACN,QAAQ,CACP;GACC,MAAM;GACN,MAAM;GACN,aAAa;GACb,CACD;EACD,SAAS,EAAE;EACX,iBAAiB;EACjB,aAAa;EACb,cAAc;GACb;GACA;GACA;GACA;EACD,SAAS;GACR,OAAO,CACN;IACC,KAAK;IACL,OAAO;IACP,aAAa;IACb,CACD;GACD,QAAQ,CACP;IACC,KAAK;IACL,WAAW;IACX,aAAa;IACb,EACD;IACC,KAAK;IACL,WAAW;IACX,QAAQ;IACR,aAAa;IACb,CACD;GACD;EACD,CACD;CACD,SAAS,EACR,MAAM,CACL;EACC,MAAM;EACN,SAAS;EACT,MAAM;EACN,aAAa;EACb,aAAa;EACb,aAAa;GACZ,MAAM;GACN,QAAQ;GACR,aAAa;GACb;EACD,OAAO;GACN,QAAQ;GACR,UAAU;GACV,QAAQ;GACR,aAAa;GACb;EACD,CACD,EACD;CACD,QAAQ,EAAE;CACV"}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LockupAbiError, LockupAbiFunction, LockupAbiStorageKey } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/contracts/lockup/helpers.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Lockup Contract Interface
|
|
4
6
|
* Provides access to contract ABI and transaction building utilities
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
declare class Lockup {
|
|
9
|
+
/** Get function ABI by name */
|
|
10
|
+
static getFunction(name: string): LockupAbiFunction | undefined;
|
|
11
|
+
/** Get error by code */
|
|
12
|
+
static getError(_code: string): LockupAbiError | undefined;
|
|
13
|
+
/** Get storage key by name */
|
|
14
|
+
static getStorageKey(name: string): LockupAbiStorageKey | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Build transaction arguments for a function
|
|
17
|
+
* @deprecated Use `buildContractCall(LOCKUP_ABI, functionName, params)` or
|
|
18
|
+
* the typed builder `buildLockupUnlock({ vaultIndex })` instead.
|
|
19
|
+
*/
|
|
20
|
+
static buildArgs(functionName: string, params: Record<string, any>): Uint8Array[];
|
|
21
|
+
/** Get contract name */
|
|
22
|
+
static getContractName(): string;
|
|
23
|
+
/** Get key prefix for a storage key name */
|
|
24
|
+
static getKeyPrefix(keyName: string): string | undefined;
|
|
23
25
|
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Lockup };
|
|
24
28
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/contracts/lockup/helpers.ts"],"mappings":";;;;;AAOA;;cAAa,MAAA;EAEsB;EAAA,OAA3B,WAAA,CAAY,IAAA,WAAe,iBAAA;EAUE;EAAA,OAL7B,QAAA,CAAS,KAAA,WAAgB,cAAA;EAcqC;EAAA,OAT9D,aAAA,CAAc,IAAA,WAAe,mBAAA;EAS2C;;;;;EAAA,OAAxE,SAAA,CAAU,YAAA,UAAsB,MAAA,EAAQ,MAAA,gBAAsB,UAAA;EAdrC;EAAA,OAgCzB,eAAA,CAAA;EA3Bc;EAAA,OAgCd,YAAA,CAAa,OAAA;AAAA"}
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import { LOCKUP_ABI } from
|
|
1
|
+
import { LOCKUP_ABI } from "./abi.js";
|
|
2
|
+
//#region src/contracts/lockup/helpers.ts
|
|
2
3
|
/**
|
|
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
|
-
const storageKey = this.getStorageKey(keyName);
|
|
46
|
-
return storageKey?.pattern.split('{')[0];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
4
|
+
* Lockup Contract Interface
|
|
5
|
+
* Provides access to contract ABI and transaction building utilities
|
|
6
|
+
*/
|
|
7
|
+
var Lockup = class {
|
|
8
|
+
/** Get function ABI by name */
|
|
9
|
+
static getFunction(name) {
|
|
10
|
+
return LOCKUP_ABI.abi.find((f) => f.name === name);
|
|
11
|
+
}
|
|
12
|
+
/** Get error by code */
|
|
13
|
+
static getError(_code) {}
|
|
14
|
+
/** Get storage key by name */
|
|
15
|
+
static getStorageKey(name) {
|
|
16
|
+
return LOCKUP_ABI.storage.keys.find((k) => k.name === name);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build transaction arguments for a function
|
|
20
|
+
* @deprecated Use `buildContractCall(LOCKUP_ABI, functionName, params)` or
|
|
21
|
+
* the typed builder `buildLockupUnlock({ vaultIndex })` instead.
|
|
22
|
+
*/
|
|
23
|
+
static buildArgs(functionName, params) {
|
|
24
|
+
const func = this.getFunction(functionName);
|
|
25
|
+
if (!func) throw new Error(`Function ${functionName} not found`);
|
|
26
|
+
const args = [];
|
|
27
|
+
for (const input of func.inputs) {
|
|
28
|
+
const value = params[input.name];
|
|
29
|
+
if (value === void 0) throw new Error(`Missing parameter: ${input.name}`);
|
|
30
|
+
args.push(new TextEncoder().encode(String(value)));
|
|
31
|
+
}
|
|
32
|
+
return args;
|
|
33
|
+
}
|
|
34
|
+
/** Get contract name */
|
|
35
|
+
static getContractName() {
|
|
36
|
+
return LOCKUP_ABI.contractName;
|
|
37
|
+
}
|
|
38
|
+
/** Get key prefix for a storage key name */
|
|
39
|
+
static getKeyPrefix(keyName) {
|
|
40
|
+
return this.getStorageKey(keyName)?.pattern.split("{")[0];
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Lockup };
|
|
45
|
+
|
|
49
46
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","
|
|
1
|
+
{"version":3,"file":"helpers.js","names":[],"sources":["../../../src/contracts/lockup/helpers.ts"],"sourcesContent":["import { LOCKUP_ABI } from './abi'\nimport type { LockupAbiError, LockupAbiFunction, LockupAbiStorageKey } from './types'\n\n/**\n * Lockup Contract Interface\n * Provides access to contract ABI and transaction building utilities\n */\nexport class Lockup {\n\t/** Get function ABI by name */\n\tstatic getFunction(name: string): LockupAbiFunction | undefined {\n\t\treturn LOCKUP_ABI.abi.find((f) => f.name === name) as unknown as LockupAbiFunction\n\t}\n\n\t/** Get error by code */\n\tstatic getError(_code: string): LockupAbiError | undefined {\n\t\treturn undefined\n\t}\n\n\t/** Get storage key by name */\n\tstatic getStorageKey(name: string): LockupAbiStorageKey | undefined {\n\t\treturn LOCKUP_ABI.storage.keys.find((k) => k.name === name)\n\t}\n\n\t/**\n\t * Build transaction arguments for a function\n\t * @deprecated Use `buildContractCall(LOCKUP_ABI, functionName, params)` or\n\t * the typed builder `buildLockupUnlock({ vaultIndex })` instead.\n\t */\n\tstatic buildArgs(functionName: string, params: Record<string, any>): Uint8Array[] {\n\t\tconst func = this.getFunction(functionName)\n\t\tif (!func) {\n\t\t\tthrow new Error(`Function ${functionName} not found`)\n\t\t}\n\n\t\tconst args: Uint8Array[] = []\n\t\tfor (const input of func.inputs) {\n\t\t\tconst value = params[input.name]\n\t\t\tif (value === undefined) {\n\t\t\t\tthrow new Error(`Missing parameter: ${input.name}`)\n\t\t\t}\n\t\t\targs.push(new TextEncoder().encode(String(value)))\n\t\t}\n\t\treturn args\n\t}\n\n\t/** Get contract name */\n\tstatic getContractName(): string {\n\t\treturn LOCKUP_ABI.contractName\n\t}\n\n\t/** Get key prefix for a storage key name */\n\tstatic getKeyPrefix(keyName: string): string | undefined {\n\t\tconst storageKey = this.getStorageKey(keyName)\n\t\treturn storageKey?.pattern.split('{')[0]\n\t}\n}\n"],"mappings":";;;;;;AAOA,IAAa,SAAb,MAAoB;;CAEnB,OAAO,YAAY,MAA6C;EAC/D,OAAO,WAAW,IAAI,MAAM,MAAM,EAAE,SAAS,KAAK;;;CAInD,OAAO,SAAS,OAA2C;;CAK3D,OAAO,cAAc,MAA+C;EACnE,OAAO,WAAW,QAAQ,KAAK,MAAM,MAAM,EAAE,SAAS,KAAK;;;;;;;CAQ5D,OAAO,UAAU,cAAsB,QAA2C;EACjF,MAAM,OAAO,KAAK,YAAY,aAAa;EAC3C,IAAI,CAAC,MACJ,MAAM,IAAI,MAAM,YAAY,aAAa,YAAY;EAGtD,MAAM,OAAqB,EAAE;EAC7B,KAAK,MAAM,SAAS,KAAK,QAAQ;GAChC,MAAM,QAAQ,OAAO,MAAM;GAC3B,IAAI,UAAU,KAAA,GACb,MAAM,IAAI,MAAM,sBAAsB,MAAM,OAAO;GAEpD,KAAK,KAAK,IAAI,aAAa,CAAC,OAAO,OAAO,MAAM,CAAC,CAAC;;EAEnD,OAAO;;;CAIR,OAAO,kBAA0B;EAChC,OAAO,WAAW;;;CAInB,OAAO,aAAa,SAAqC;EAExD,OADmB,KAAK,cAAc,QACrB,EAAE,QAAQ,MAAM,IAAI,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LockupVault, RawLockupVaultData } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/contracts/lockup/parsers.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Parse raw lockup vault data string into intermediate format
|
|
4
6
|
* Format: {unlock_height}-{amount}-{symbol}
|
|
@@ -6,7 +8,7 @@ import type { LockupVault, RawLockupVaultData } from './types';
|
|
|
6
8
|
* @param dataStr - Raw vault data string from contract state
|
|
7
9
|
* @returns Parsed data or null if invalid
|
|
8
10
|
*/
|
|
9
|
-
|
|
11
|
+
declare function parseRawLockupVaultData(dataStr: string): RawLockupVaultData | null;
|
|
10
12
|
/**
|
|
11
13
|
* Parse lockup vault data from contract state
|
|
12
14
|
* Format: {unlock_height}-{amount}-{symbol}
|
|
@@ -16,5 +18,7 @@ export declare function parseRawLockupVaultData(dataStr: string): RawLockupVault
|
|
|
16
18
|
* @param vaultIndex - The vault index
|
|
17
19
|
* @returns Parsed vault or null if invalid
|
|
18
20
|
*/
|
|
19
|
-
|
|
21
|
+
declare function parseLockupVaultData(vaultData: string | Uint8Array, vaultIndex: number): LockupVault | null;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { parseLockupVaultData, parseRawLockupVaultData };
|
|
20
24
|
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.d.ts","
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","names":[],"sources":["../../../src/contracts/lockup/parsers.ts"],"mappings":";;;;;AAWA;;;;;iBAAgB,uBAAA,CAAwB,OAAA,WAAkB,kBAAA;;;;;;;;;;iBAwB1C,oBAAA,CACf,SAAA,WAAoB,UAAA,EACpB,UAAA,WACE,WAAA"}
|