@blyz/blyz-sdk
v0.0.3
Published
Blyz SDK for deploying and managing Ethereum smart contracts
Readme
BLYZ SDK
Minimal TypeScript SDK that signs and launches tokens via the Blyz v4 Fair Launch Factory contract.
Requirements
- Node.js 18+ and Yarn 1.22
- Access to a Base RPC endpoint (Sepolia or Mainnet) and a funded deployer wallet
- Sufficient funds on that wallet (gas + launch capital)
- Blyz v4 Fair Launch Factory contract address for the network you plan to target
Install
Install dependencies with Yarn (recommended) or npm:
# Yarn
yarn install
# npm
npm installConfigure environment variables
- Copy the template and adjust the values:
cp .env.example .env - Edit
.envand provide the secrets:PRIVATE_KEY– 32-byte hex string (with0xprefix) for the deployer wallet that will pay gas. Keep it safe.BASE_RPC_URL– HTTPS RPC endpoint for the Base network you target. The example uses Sepolia.BLYZ_TOKEN_PROTOCOL_ADDRESS– Blyz v4 Fair Launch Factory contract address supplied by the Blyz team for the selected network. The TypeScript examples load these from.envwhile the CLI expects them via flags or the JSON config file directly.
Configure BlyzTokenV4
If you run the example script, edit the tokenConfig inside examples/v4/deployToken.ts. Each field maps directly to the on-chain deployment payload:
| Field | Description |
| --- | --- |
| name | Full ERC20 name (e.g. Example Token). |
| symbol | Short uppercase ticker (e.g. EXT). |
| metadataCid | IPFS CID of the token artwork stored on IPFS (image file). |
| initialTick | Initial Uniswap v4 pool tick that sets the starting spot price;
| creatorAddress | Address registered as the project creator and payout recipient (not necessarily the actual author). |
| pairToken | Address of the asset you pair against (WETH, USDC, etc.); use the zero address to pair with native ETH. |
| amountIn | BigInt representing how much of the pairToken (in wei) you deposit when creating the pool. |
Run the sample deployment
- Ensure the
.envfile is ready and adjust the sample config inexamples/v4/deployToken.tsif needed. - Execute the script:
The script invokes# Yarn yarn example:deploy:token # npm npm run example:deploy:tokents-node examples/v4/deployToken.ts, instantiatesBlyz, and submitsBlyzTokenV4to the factory defined in.env. - For production builds, compile the SDK and import the generated code from
dist/:# Yarn yarn build # npm npm run build
Deploy with the CLI
If you prefer to deploy via the CLI instead of running the TypeScript example, use the bundled binary:
- Create a JSON file with your token data (you can also supply all values via flags):
{ "name": "Example Token", "symbol": "EXT", "metadataCid": "ipfs://cid", "initialTick": 115200, "creatorAddress": "0xdDEA2b19867531c5fa7003E6d83f6ab37E8872Dd", "pairToken": "0x0000000000000000000000000000000000000000", "amountIn": "200000000000000000" } - Run the CLI (bin name:
blyz-sdk):
You can override any field inline, for example:yarn build npx blyz-sdk deploy --config ./token.config.json \ --private-key 0xYOUR_PRIVATE_KEY \ --rpc-url https://sepolia.base.org \ --fair-launch-factory-address 0xfCA4A96066D1039676B48915901ba400197AB1a6
If you want the command available globally (withoutnpx blyz-sdk deploy --config ./token.config.json --symbol NEW --amount-in 200000000000000000 \ --private-key 0xYOUR_PRIVATE_KEY \ --rpc-url https://sepolia.base.org \ --fair-launch-factory-address 0xfCA4A96066D1039676B48915901ba400197AB1a6npx), link it once from the repo:
To remove the global link later:yarn build npm link # registers the blyz-sdk binary globally # now anywhere: blyz-sdk deploy --config ./token.config.json --dry-run \ --private-key 0xYOUR_PRIVATE_KEY \ --rpc-url https://sepolia.base.org \ --fair-launch-factory-address 0xfCA4A96066D1039676B48915901ba400197AB1a6npm unlink -g blyz-sdk. (If you want to run it without building, the TypeScript entry still works:yarn cli deploy --config ./token.config.json.)
The CLI supports the following options:
| Flag | Description |
| --- | --- |
| --config <path> | Path to a JSON file (structure shown above). |
| --name <string> | ERC20 name. |
| --symbol <string> | ERC20 ticker. |
| --metadata-cid <string> | Token artwork CID. |
| --initial-tick <int> | Starting Blyz pool tick. |
| --creator-address <hex> | Address registered as the creator. |
| --pair-token <hex> | Counterpart token (zero-address means native ETH). |
| --amount-in <wei> | Pair token amount expressed in wei. |
| --private-key <hex> | Signer private key. |
| --rpc-url <http(s)> | RPC endpoint. |
| --fair-launch-factory-address <hex> | Factory contract address. |
| --dry-run | Validate input and print the steps without broadcasting the transaction. |
Note:
--configand inline token flags are mutually exclusive. Supply the full token definition in a JSON file or entirely via flags—never both in the same command. Connection details (privateKey,rpcUrl,fairLaunchFactoryAddress) must be provided via flags; the CLI does not read.envor connection fields in the token JSON.
Example run
$ npm run example:deploy:token
> [email protected] example:deploy:token
> ts-node examples/v4/deployToken.ts
Loading Blyz configuration
Configuration ready
signer: 0xdDEA2b19867531c5fa7003E6d83f6ab37E8872Dd
factoryAddress: 0xfCA4A96066D1039676B48915901ba400197AB1a6
Blyz client initialized
Deploying token
name: Example Token
symbol: EXT
Transaction broadcasted
transactionHash: 0xf01ac218f61c7591483b60650d2107e8436c21fc88d7071b4a9e888486ec1862
Deployment confirmed
tokenAddress: 0x7455ED2D8913F218e2Ec659fd017CFD0D6C19eD3
blockNumber: 33372096
gasUsed: 2342787Tip: keep a separate
.envper environment (e.g..env.sepolia,.env.mainnet) and export the right one before running the script.
