@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
53 lines (52 loc) • 1.29 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
// src/resources.ts
var resources_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__exportAll({
erc20: () => erc20,
native: () => native
});
/**
* Creates a native token resource declaration.
*
* @param chainId - The EVM chain ID the native token belongs to.
* @returns A {@link NativeResource} for use in flow input schemas.
*
* @example
* ```ts
* const builder = sdk.flow(1, {
* inputs: { eth: native(1) },
* });
* ```
*/
const native = (chainId) => ({
kind: "native",
chainId
});
/**
* Creates an ERC-20 token resource declaration.
*
* @param token - The `0x`-prefixed contract address of the ERC-20 token.
* @param chainId - The EVM chain ID the token is deployed on.
* @returns An {@link Erc20Resource} for use in flow input schemas.
*
* @example
* ```ts
* const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
* const builder = sdk.flow(1, {
* inputs: { usdc: erc20(USDC, 1) },
* });
* ```
*/
const erc20 = (token, chainId) => ({
kind: "erc20",
token,
chainId
});
exports.erc20 = erc20;
exports.native = native;
Object.defineProperty(exports, "resources_exports", {
enumerable: true,
get: function() {
return resources_exports;
}
});
//# sourceMappingURL=resources.cjs.map