You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -419,15 +418,14 @@ export class CFStorage implements Storage {
419
418
constnow=Date.now();
420
419
constinsertStmt=this.d1.prepare(
421
420
`INSERT OR IGNORE INTO nbtc_minting (tx_id, address_id, sender, vout, sui_recipient, amount, status, created_at, updated_at, sui_tx_id, retry_count)
422
-
VALUES (?, (SELECT a.id FROM nbtc_deposit_addresses a JOIN setups p ON a.setup_id = p.id WHERE p.btc_network = ? AND p.sui_network = ? AND p.nbtc_pkg = ? AND a.deposit_address = ?), ?, ?, ?, ?, '${MintTxStatus.Broadcasting}', ?, ?, NULL, 0)`,
421
+
VALUES (?,
422
+
(SELECT a.id FROM nbtc_deposit_addresses a WHERE a.deposit_address = ?),
Copy file name to clipboardExpand all lines: packages/sui-indexer/README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,20 @@ UTXOs are stored in the `nbtc_utxos` table in the D1 database.
116
116
117
117
**Key Concept:** The database acts as a cache of the on-chain state. The `SuiIndexer` ensures this cache stays synchronized with the canonical state on the Sui blockchain.
118
118
119
+
## IKA Coin Management
120
+
121
+
We use IKA coins to pay for presign/sign requests. The coin selection logic lives in `packages/lib/src/coin-ops.ts`.
122
+
123
+
### How it works
124
+
125
+
1.`fetchAllIkaCoins()` grabs all IKA coins for the signer
126
+
2.`selectCoins()` picks coins to hit the target amount (takes first 80, then sorts by balance if needed)
127
+
3.`prepareCoin()` merges them if we need multiple coins
128
+
129
+
### Concurrency
130
+
131
+
The process is not safe for parallel workload. See the doc comment in `fetchAllIkaCoins`.
132
+
119
133
## API
120
134
121
135
This package exposes [Cloudflare RPC](../../README.md#cloudflare-rpc).
0 commit comments