feat(payments): add interactive Squid funding to payments fund - #637
feat(payments): add interactive Squid funding to payments fund#637snissn wants to merge 27 commits into
Conversation
0a25c66 to
2f3b0f5
Compare
|
@codex review |
|
@codex review |
|
@codex review |
|
@codex review Please review exact head |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
src/payments/squid-funding.ts:170
acquirePaymentShortfalls()callsvalidateFundingSourceOptions()but ignores itsfalsereturn value. If this function is ever called with missing source options, it will continue and fail later withUnsupported source chain: (missing)(or hit theas stringcasts), which is a confusing error path. Make this fail closed with a clear error (or return early) when no source options were provided.
export async function acquirePaymentShortfalls(input: AcquirePaymentShortfallsInput): Promise<void> {
const destinationRequirements = requirements(input)
if (destinationRequirements.length === 0) return
validateFundingSourceOptions(input.options)
if (input.synapse.chain.id !== filecoinMainnet.id) {
src/payments/squid-funding.ts:255
- If
unlink(path)fails afterexecuteSquidFunding()succeeds, this function will throw and make the CLI treat the acquisition as failed even though tokens may already have been acquired on-chain. Marker cleanup should be best-effort to avoid turning a successful route into a reported failure.
await unlink(path)
|
I think the unresolved question here is how to handle the squid integrator id. This context is for a CLI, so each user would be running it separately. It definitely doesn't make sense for each user to have their own squid id. I think we need to decide one of these two options, with a) possibly being invalid and b) being my preference. a) we are OK with our squid application id being in the repo/publicaly accessible and users simply use it (Dependent on seeing the TOS and expectations of the squid id) My immediate follow up is to look into the squid api key / id details and see if it's meant to be a public facing application ID or a private API "key" |
|
OK so it looks like it is not a secret and is an identifier more like a username
I personally went through the steps here https://docs.squidrouter.com/getting-started/integrator-quickstart for an identifier labeled |
|
OK Great so since it's a public identifier, i'll update the PR to use the one I generated, and if we want to we can update it to different key than |
|
Added the public Filecoin Squid integrator ID as the default in |
|
Updated this PR to the published |
|
Updated the CLI to Local validation passed: frozen install, build, 69 test files (755 passed, 11 skipped), type-check, lint, and diff checks. Independent review found no issues. |
|
Updated to |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Updated the CLI to |
What changed
This adds an optional way for interactive
payments fundto acquire the FIL needed for gas and the USDFC needed for a requested Filecoin Pay deposit.native, address, or an unambiguous symbol in Squid's current catalog.Direct wallet funding remains the default. Squid is not contacted unless all four source options are supplied and the wallet has a positive FIL or USDFC shortfall. This path is limited to Filecoin Mainnet, interactive terminals, and owner private-key authentication.
payments setup --auto, Calibration, and devnet are unchanged.Provider route planning and transaction execution use the published
@filecoin-project/squid-evm-fundingv0.3.1package. Filecoin Pin ships with the public Filecoin Squid integrator ID and supportsSQUID_INTEGRATOR_IDas an optional override.If a process stops after confirmation, a small pending marker blocks another acquisition attempt until the user verifies both chains and removes it.
This supersedes #630, which implemented the provider, automatic-setup integration, persistence framework, fixtures, and smoke-test tooling directly in Filecoin Pin.
Checks
@filecoin-project/squid-evm-funding@0.3.1pnpm run buildpnpm test— 755 passing, 11 skipped across 69 filesRemaining validation
No funded mainnet route has been executed at this exact Filecoin Pin and library revision. A low-value capped run still needs to verify FIL and USDFC arrival, the Filecoin Pay deposit, and a rerun without a second acquisition.
Tracked in snissn/filecoin-pin#31.