Create a new finite channel
import { DYNAMIC_LOGIC, CUSTOM_FEES } from '@tx-kit/sdk/constants' import { uplinkClient } from './config' import { uri, name, defaultAdmin, managers, transportLayer, setupActions } from './args' const { contractAddress } = await uplinkClient.createFiniteChannel({ uri, name, defaultAdmin, managers, transportLayer, setupActions })
{ contractAddress: Address, // address of the created channel event: Log }
string
const { contractAddress } = await uplinkClient.createFiniteChannel({ uri: 'ipfs://xyz', ... })
const { contractAddress } = await uplinkClient.createFiniteChannel({ name: 'My new channel', ... })
const { contractAddress } = await uplinkClient.createFiniteChannel({ defaultAdmin: '0xedcC867bc8B5FEBd0459af17a6f134F41f422f0C', ... })
string[]
const { contractAddress } = await uplinkClient.createFiniteChannel({ managers: ['0x1234567890123456789012345678901234567890'], ... })
SetupAction[]
const { contractAddress } = await uplinkClient.createFiniteChannel({ setupActions: [ { feeContract: CUSTOM_FEES, feeArgs: { channelTreasury: '0x1234567890123456789012345678901234567890', uplinkPercentage: 10, channelPercentage: 15, creatorPercentage: 60, mintReferralPercentage: 5, sponsorPercentage: 10, ethMintPrice: parseEther('0.000666'), erc20MintPrice: parseEther('0.000666'), erc20Contract: baseSepoliaWETH } }, { logicContract: DYNAMIC_LOGIC, creatorLogic: [new UniformInteractionPower(BigInt(10)).ifResultOf(baseSepoliaWETH, '0x70a08231', erc20BalanceOfData).gt(BigInt(1))], minterLogic: [new UniformInteractionPower(BigInt(10)).ifResultOf(baseSepoliaWETH, '0x70a08231', erc20BalanceOfData).gt(BigInt(1))] } ], ... })
FiniteTransportLayer
const { contractAddress } = await uplinkClient.createFiniteChannel({ transportLayer: { createStartInSeconds: blockTimestamp, mintStartInSeconds: blockTimestamp + 30, mintEndInSeconds: blockTimestamp + 60, rewards: { ranks: [1], allocations: [parseEther('0.000666')], totalAllocation: parseEther('0.000666'), token: NATIVE_TOKEN } }, ... })
TransactionOverrides
type TransactionOverrides = { accessList?: AccessList gas?: bigint maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint nonce?: number value?: bigint }
const { contractAddress } = await uplinkClient.createFiniteChannel({ ... transactionOverrides: { gas: 1000000n } })
const { address, data } = await uplinkClient.calldata.createFiniteChannel({...})
{ address: string, // address of the target contract data: string // calldata for the transaction }
const gas = await uplinkClient.estimateGas.createFiniteChannel({...})
bigint // gas estimate in wei