/** * ABI 코덱 + vendored ethers v5 namespace re-export. * * `support/erc20-helper/abi.mts` 가 lib 0.2.0 의 viem-style 리팩토링 때 사라졌으나, * locus-wallet-extension / locuschain-explorer-suite 가 동일 API 셰입에 의존하고 * 있어 같은 셰입을 lib 안에 다시 둔다 (양쪽 사이트의 자체 locus-ethers.ts 중복 * 해소가 목적). * * 이 모듈은 vendored ethers v5 (`libs/ethers.js-5.5.4-20bytes-addr/ethers.esm.min.js`) * 만 사용. `getContract.mts` 와 동일한 import 경로 — 외부 사용자는 자체 `ethers` * 패키지를 dep 으로 가질 필요 없다. * * 주소 길이는 20바이트(이더리움 표준). ABI 32바이트 슬롯의 마지막 40 hex 만 사용. */ /** * vendored ethers v5 namespace. 호출자가 `LocusEthers.BigNumber`, `LocusEthers.utils.id` * 등 namespace 함수를 자유롭게 쓸 수 있게 re-export. `import { ethers } from 'ethers'` * 를 외부 dep 으로 따로 갖지 않아도 lib 한 곳에서 가져갈 수 있다. * * vendored ethers 는 .d.ts 가 없어 type 위치 (`let x: LocusEthers.BigNumber`) 에 * 쓰이려면 namespace declaration 이 필요하다. declaration merging 으로 같은 이름의 * value (vendored ethers runtime) 와 namespace (type alias) 를 함께 export. */ export declare const LocusEthers: any; export declare namespace LocusEthers { type BigNumber = any; type BigNumberish = any; } export type AbiInput = { name?: string; type: string; value?: any; }; export type AbiFunctionItem = { name: string; inputs: AbiInput[]; outputs?: AbiInput[]; type?: string; stateMutability?: string; }; export declare const removeHexPrefix: (s: string) => string; export declare const convertJsonToFuncString: (item: { inputs: AbiInput[]; name?: string; }) => string; /** ABI 배열에서 이름으로 function 항목 찾기. 못 찾으면 undefined. */ export declare const findAbiFunction: (abi: readonly any[], name: string) => AbiFunctionItem | undefined; /** * 함수 selector. '0x' prefix 포함 10자 (4-byte hex + '0x'). * ethers v5 `Interface.getSighash(name)` 의 직접 동등. */ export declare const getFuncSelector: (abiItem: AbiFunctionItem) => string; /** * Locus chain `func` 필드용 base64-encoded data. * selector(0x 제외) + 선택적 args hex(0x 제외) 를 이어 붙여 `convertHexToData`. */ export declare const getFunc: (abiItem: AbiFunctionItem, args?: string) => string; /** * ABI 인자 인코드. '0x' prefix 포함. address 타입 입력이 locus 주소 형식 * (base32) 이면 `convertAddressToHex` 로 변환 후 전달. 이미 '0x' 로 시작하는 * hex 면 그대로 사용. * * `args` 가 생략되면 각 input 의 `value` 필드에서 값을 가져온다 — UI 측이 * `{ ...inputAbi, value: }` 형태로 augmented 한 inputs 를 * 그대로 넘기는 호출 패턴 (explorer-suite abi-item 등) 호환. */ export declare const encodeArgHex: (inputs: AbiInput[], args?: any[]) => string; /** * Locus chain `func` 응답 디코드. 결과는 `{ value, name?, type }[]`. * - address: locus 주소 문자열로 변환 * - BigNumber: 10진 string 으로 변환 * * `result` 는 base64-encoded chain data. 빈 결과 (`''`, `'0x'`) 는 `[]` 반환. */ export declare const decodeResult: (func: any, result: string) => { value: any; name?: string; type: string; }[]; /** * ERC20 `transfer(address,uint256)` call data 에서 to/amount 추출. * `funcData` 는 base64-encoded chain data. 4바이트 selector + 32바이트 to slot * + 32바이트 amount slot. to 는 슬롯의 마지막 20바이트 (이더리움 표준 주소). */ export declare const getTransferFuncArgs: (funcData: string) => { to: string; amount: string; };