gSwap for Uniswap Users
gSwap uses familiar concentrated-liquidity ideas, but its contract and transaction model are different from Uniswap V3.
| Concept | Uniswap V3 | gSwap SDK |
|---|---|---|
| Pool identity | Token addresses plus fee | Registered trading symbols plus fee |
| Token input | ERC-20 address | Symbol or GalaChain class key |
| Amounts | Raw integer units | Human-readable decimal strings |
| Quote | Quoter contract call | Backend offline quote engine |
| Write path | Router transaction | Signed DTO through Chain Gateway |
| Confirmation | Transaction receipt | Queued swap acknowledgement, then SubmittedTransaction.confirm() |
| Position identity | NFT tokenId | Pool, owner, and tick range; no positionId |
| Fee tiers | Deployment-specific | 0, 500, 3000, 10000 |
Quotes
Uniswap's quoteExactInputSingle is replaced by a read-only SDK method. An
omitted fee compares every available v2 tier:
const quote = await gSwap.quoting.quoteExactInput('GWETH', 'GUSDC', '0.1');
console.log(quote.feeTier, quote.amountOut, quote.totalFees);
const exactOutput = await gSwap.quoting.quoteExactOutput('GWETH', 'GUSDC', '3000', 3000);
Swaps
The v2 SDK accepts the same exact-input/exact-output intent, but the slippage fields are explicit and the signer is configured on the client:
const tx = await gSwap.swaps.swap('GWETH', 'GUSDC', quote.feeTier, {
exactIn: '0.1',
amountOutMinimum: quote.amountOut,
});
console.log(tx.mode, tx.uniqueKey, tx.transactionId);
const applied = await tx.confirm();
console.log(applied.result);
The Chain Gateway receives the signed DTO at
/v1/chain/asset/dex-contract/RequestTrade. The acknowledgement is queued, so
confirm() reads the applied outcome from apply-results. There is no router
ABI, bundler, or socket event subscription. Persist tx.uniqueKey so an
uncertain submit or confirmation can be checked again without resubmitting.
Liquidity
Uniswap's NFT mint is a gSwap AddLiquidity write. The position is merged by pool, owner, and tick range, and an add operation supplies exactly one deposit side:
const tx = await gSwap.positions.addLiquidityByTicks({
token0: 'GUSDC',
token1: 'GWETH',
fee: 3000,
tickLower: -6000,
tickUpper: 6000,
amount: '3000',
amountIsToken0: true,
});
await tx.confirm();
Use addLiquidityByPrice when a UI collects token1-per-token0 prices. The SDK
converts prices to spacing-aligned ticks. Spacing is 200 for fee 0, 10
for 500, 60 for 3000, and 200 for 10000.
removeLiquidity takes an optional token withdrawal quantity. Omitting both
quantities closes the position and sweeps fees. collectPositionFees always
sweeps the complete accrued balance; there is no partial collect amount.
Identity and signing
Uniswap users often think in terms of an EVM address. GalaChain has two alias
families: native keys resolve registered client|<24-hex> identities, while
personal-sign browser wallets resolve bare eth|<40-hex> identities.
The signers come from @gala-chain/gala-core-sdk. PrivateKeySigner is native, GalaWalletSigner is native (personal-sign is
opt-in and needs a wallet build with the phantom-signer fix), and
BrowserWalletSigner uses EIP-1193 personal-sign by default (an opt-in
{ scheme: 'eip712' } signs typed data, which also resolves a registered
client| alias). Nothing else in v2 uses EIP-712.
See Signing and Identity and Migration from 0.x for the complete mapping.