Prerequisites
Before starting, make sure you have:- Completed our TypeScript and Node.js Setup Guide.
- Got your API key from the Bags Developer Portal.
- A Solana wallet with SOL or USDC to pay the incorporation fee.
- A launched token mint address.
- Installed the additional dependencies for this guide:
1. Set Up Environment Variables
This guide requires your walletβs private key. Add it to your base.env file:
You can export your private key from wallets like Bags, Phantom, or Backpack.
2. The Incorporation Script
Here is the complete script for incorporating a token. Save it asincorporate-token.ts.
The incorporation flow is split into three separate functions that you call at different stages:
createPaymentAndSubmitDetailsβ creates the payment, signs it on-chain, and submits incorporation details. Returns each founderβs form URL.checkIncorporationStatusβ checks whether all founders have completed their forms and the project is ready for incorporation.startIncorporationProcessβ triggers the incorporation once all founders have completed their forms.
formUrl with them so they can complete their verification. Founders may take hours or days to finish, so these functions are designed to be called independently.
3. Understanding Share Allocation
The incorporation share and all founder shares are expressed in basis points (1 bps = 0.01%). The total must always equal exactly 10,000 bps (100%).| Parameter | Range | Description |
|---|---|---|
incorporationShareBasisPoint | 2000β3000 | The incorporation entityβs share (20β30%) |
Each founderβs shareBasisPoint | 0β10000 | Each founderβs ownership share |
shareBasisPoint values + incorporationShareBasisPoint = 10,000.
Here are some valid allocation examples:
| Founders | Founder Shares | Incorporation Share | Total |
|---|---|---|---|
| 1 founder | 7000 (70%) | 3000 (30%) | 10000 |
| 2 founders | 4000 + 3000 (70%) | 3000 (30%) | 10000 |
| 3 founders | 3000 + 3000 + 2000 (80%) | 2000 (20%) | 10000 |
You can have between 1 and 10 founders per incorporation. Each founder must provide a valid email, ISO 3166-1 alpha-3 country codes for nationality and tax residency (e.g.
USA, GBR, DEU), and a residential address.4. Payment Options
ThepayWithSol parameter controls how the incorporation fee is paid:
payWithSol | Behavior |
|---|---|
false (default) | The payer pays directly in USDC. The wallet must hold enough USDC to cover the fee. |
true | The payment transaction performs an exact-output swap from SOL to USDC, matching the required USDC amount. The wallet must hold enough SOL. |
priceUSDC field in the response reflects the incorporation price in USDC. When paying with SOL, the transaction handles the swap automatically β no extra steps are needed.
5. Understanding Founder Forms
After you submit incorporation details, each founder in the response will have aformUrl β a unique URL where the founder completes all required verification steps (KYC, PEP questionnaire, and IP attribution acknowledgment).
Each founder must open their formUrl and complete all required fields.
The projectβs isReadyForIncorporation flag becomes true only when every founder has completed their form.
You can check individual founder progress at any time using checkIncorporationStatus() (which calls sdk.incorporation.getDetails() and sdk.incorporation.list() under the hood).
6. Run Your Script
The script has three functions you call at different stages. Update the bottom ofincorporate-token.ts to uncomment the function you need, then run:
isReadyForIncorporation is true, start the incorporation:
Founders may take hours or days to complete their forms. You can call
checkIncorporationStatus() as many times as needed to monitor progress before triggering the final step.7. Troubleshooting
Common errors you may encounter:- Share basis points donβt sum to 10000: The sum of all founder
shareBasisPointvalues plusincorporationShareBasisPointmust equal exactly 10,000. - Incorporation share out of range:
incorporationShareBasisPointmust be between 2000 (20%) and 3000 (30%). - Invalid country code: Nationality and tax residency must use ISO 3166-1 alpha-3 codes (3 letters, e.g.
USA,GBR,DEU). - Invalid payer wallet: Ensure the wallet address is a valid Solana public key.
- Insufficient funds: The payer wallet needs enough SOL or USDC to cover the incorporation fee.
- Payment not confirmed: The payment transaction must be confirmed on-chain before submitting incorporation details.
- Prerequisites not met:
startIncorporationwill fail if any founder hasnβt completed KYC, PEP forms, or IP attribution. - Too many/few founders: You must have between 1 and 10 founders.
- Company names: You must provide exactly 3 preferred company names.
