fuels
Version:
Fuel TS SDK
1 lines • 6.28 kB
Source Map (JSON)
{"version":3,"sources":["../src/index.ts","../src/cli/utils/createConfig.ts","../src/cli/types.ts"],"sourcesContent":["// exporting wrapped `@fuels/vm-asm` for convenience\nexport * as FuelAsm from '@fuels/vm-asm';\n\n// Exporting CLI entrypoint for programatic API\nexport * from './cli/index';\n\n// Exporting all sub-packages\nexport { Script } from '@fuel-ts/script';\nexport * from '@fuel-ts/abi-coder';\nexport * from '@fuel-ts/account';\nexport * from '@fuel-ts/account/configs';\nexport * from '@fuel-ts/address';\nexport * from '@fuel-ts/address/configs';\nexport * from '@fuel-ts/contract';\nexport * from '@fuel-ts/crypto';\nexport * from '@fuel-ts/errors';\nexport * from '@fuel-ts/hasher';\nexport * from '@fuel-ts/math';\nexport * from '@fuel-ts/math/configs';\nexport * from '@fuel-ts/program';\nexport * from '@fuel-ts/recipes';\nexport * from '@fuel-ts/transactions';\nexport * from '@fuel-ts/transactions/configs';\nexport * from '@fuel-ts/utils';\n","import type { UserFuelsConfig } from '../types';\n\nexport function createConfig(config: UserFuelsConfig) {\n return config;\n}\n","import type { JsonAbi } from '@fuel-ts/abi-coder';\nimport type { DeployContractOptions } from '@fuel-ts/contract';\n\nexport enum Commands {\n build = 'build',\n deploy = 'deploy',\n dev = 'dev',\n init = 'init',\n versions = 'versions',\n node = 'node',\n}\n\nexport type CommandEvent =\n | {\n type: Commands.build;\n data: void;\n }\n | {\n type: Commands.deploy;\n data: DeployedData;\n }\n | {\n type: Commands.dev;\n data: void;\n }\n | {\n type: Commands.init;\n data: void;\n }\n | {\n type: Commands.versions;\n data: void;\n }\n | {\n type: Commands.node;\n data: void;\n };\n\nexport type DeployedContract = {\n name: string;\n contractId: string;\n};\n\nexport type DeployedScript = {\n path: string;\n loaderBytecode: Uint8Array;\n abi: JsonAbi;\n};\n\nexport type DeployedPredicate = DeployedScript & {\n predicateRoot: string;\n};\n\nexport type DeployedData = {\n contracts?: DeployedContract[];\n scripts?: DeployedScript[];\n predicates?: DeployedPredicate[];\n};\n\nexport type ContractDeployOptions = {\n contracts: DeployedContract[];\n contractName: string;\n contractPath: string;\n};\n\nexport type OptionsFunction = (\n options: ContractDeployOptions\n) => DeployContractOptions | Promise<DeployContractOptions>;\n\nexport type FuelsEventListener<CType extends Commands> = (\n config: FuelsConfig,\n data: Extract<CommandEvent, { type: CType }>['data']\n) => void | Promise<void>;\n\nexport type UserFuelsConfig = {\n /** Relative directory path to Forc workspace */\n workspace?: string;\n /** List of relative directory paths to Sway contracts */\n contracts?: string[];\n /** List of relative directory paths to Sway predicates */\n predicates?: string[];\n /** List of relative directory paths to Sway scripts */\n scripts?: string[];\n /** Relative directory path for generating Typescript definitions */\n output: string;\n\n /**\n * Wallet private key, used when deploying contracts.\n * Should ideally come from env — `process.env.MY_PRIVATE_KEY`\n */\n privateKey?: string;\n\n /**\n * Contracts will be deployed using this provider.\n * Default: http://localhost:4000/v1/graphql\n */\n providerUrl?: string;\n\n /**\n * Relative path to directory containing custom configurations for `fuel-core`, such as:\n * - chainConfig.json\n * - metadata.json\n * - stateConfig.json\n */\n snapshotDir?: string;\n\n /** Static of dyanmic deploy configs to be used when deploying contracts */\n deployConfig?: DeployContractOptions | OptionsFunction;\n\n /** If set to false, you will need to spin up a Fuel core node by yourself */\n autoStartFuelCore?: boolean;\n\n /** If set, will use absolute path to forc binary */\n forcPath?: string;\n\n /** If set, will use absolute path to forc binary */\n fuelCorePath?: string;\n\n /**\n * Port to use when starting a `fuel-core` node\n * Default: first free port, starting from 4000\n */\n fuelCorePort?: number;\n\n /**\n * Aditional forc build flags to be used when compiling contracts.\n * Default: []\n * Example:\n * forcBuildFlags: ['--release'];\n */\n forcBuildFlags?: string[];\n\n /**\n * Function callback, will be called after a successful build operation\n *\n * @param config - The loaded `fuels.config.ts`\n */\n onBuild?: FuelsEventListener<Commands.build>;\n\n /**\n * Function callback, will be called after a successful deploy operation\n *\n * @param config - The loaded `fuels.config.ts`\n * @param data - the deployed contracts\n */\n onDeploy?: FuelsEventListener<Commands.deploy>;\n\n /**\n * Function callback, will be called after a successful dev operation\n *\n * @param config - The loaded `fuels.config.ts`\n */\n onDev?: FuelsEventListener<Commands.dev>;\n\n /**\n * Function callback, will be called after a successful Node refresh operation\n *\n * @param config - The loaded `fuels.config.ts`\n */\n onNode?: FuelsEventListener<Commands.node>;\n\n /**\n * Function callback, will be called in case of errors\n * @param config - Configuration in use\n * @param error - Original error object\n */\n onFailure?: (config: FuelsConfig, error: Error) => void | Promise<void>;\n};\n\nexport type FuelsConfig = UserFuelsConfig &\n Required<\n Pick<\n UserFuelsConfig,\n | 'contracts'\n | 'predicates'\n | 'scripts'\n | 'deployConfig'\n | 'autoStartFuelCore'\n | 'forcPath'\n | 'fuelCorePath'\n | 'providerUrl'\n | 'forcBuildFlags'\n >\n > & {\n basePath: string;\n configPath: string;\n buildMode: 'debug' | 'release';\n };\n"],"mappings":";;;;AACA,YAAY,aAAa;;;ACClB,SAAS,aAAa,QAAyB;AACpD,SAAO;AACT;AAFgB;;;ACCT,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,WAAQ;AACR,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,UAAO;AACP,EAAAA,UAAA,cAAW;AACX,EAAAA,UAAA,UAAO;AANG,SAAAA;AAAA,GAAA;;;AFIZ,SAAS,cAAc;AACvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":["Commands"]}