fix(sdk): migrate vault fee to tenths-of-bps (feeTenthsBps); @sipher/sdk 0.2.0#359
Merged
Conversation
@sipher/sdk renamed VaultConfig.feeBps to feeTenthsBps (integer tenths-of-a-bps, divide by 100_000). These two devnet scripts live outside the typecheck target and were silently reading undefined at runtime. Rename all vault-fee references consistently: local type fields, reads, the console echo, and the state/evidence record writes.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The on-chain
sipher_vaultprogram re-precisioned its fee from whole basis points to tenths of a basis point (fee_tenths_bps,u16at config offset 40, divisor100_000; e.g.75= 7.5 bps). This PR brings the TypeScript side in line and fixes a resulting 10× fee mis-report: three SDK sites decoded the raw tenths value but still divided by10_000, so against the live config they reported0.75%instead of0.075%(and the native-SOL path could trip its rent-exempt guard into false rejections).Changes
@sipher/sdk→ 0.2.0VaultConfig.feeBps→feeTenthsBps(integer). ConstantsDEFAULT_FEE_TENTHS_BPS = 100(0.1%, value-preserving) andMAX_FEE_TENTHS_BPS = 1000(1%).amount * feeTenthsBps / 100_000nat both withdraw builders (privacy.ts,privacy-sol.ts) and the decode (vault.ts).fee_tenths_bps; recon + devnet bootstrap/refund scripts migrated.1_500on2_000_000; the old divisor gave15_000) for both the SOL and SPL paths — the SPL path previously had no fee assertion.@sipher/agent— surfacesfeeTenthsBpswithfeePercent = feeTenthsBps / 1000. The static per-chain fee list (routes/chains.ts) is a separate concept and correctly stays whole-bps.examples/vault-privacy-provider— the reference adapter's fee field andpreviewWithdrawmigrated; generic design note updated.app—DepositTxResponsetype aligned with the deposit-tx route it consumes.Out of scope (intentionally unchanged)
sip_privacyis a separate program and stays whole-bps (÷10_000), including its skipped-byte layout comments inprivacy.ts/privacy-sol.ts.docs/sentinel/evidence/(point-in-time records).Verification
pnpm -r build+pnpm typecheckclean across all packages.@sipher/sdk120,@sipher/agent1718,examples/vault-privacy-provider22.docs/superpowers/.Note
Publishing
@sipher/sdk@0.2.0to npm is a separate follow-up, not part of this PR.