Skip to content

feat(core-sdk): add "None" fallback strategy to transfer authorization queue (BPIP-12)#1033

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/bpip-12-support-empty-entries
Open

feat(core-sdk): add "None" fallback strategy to transfer authorization queue (BPIP-12)#1033
Copilot wants to merge 3 commits into
mainfrom
copilot/bpip-12-support-empty-entries

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

encodeTransferAuthorizationEntry and executeMetaTransactionWithTokenTransferAuthorization had no way to express empty/fallback (0x) queue slots, forcing consumers of BPIP-12 commit-time meta-tx flows (createOfferAndCommit, createOfferCommitAndRedeem) to hand-roll queue encoding outside the SDK.

Changes

src/erc20/handler.ts

  • Extracts SignableTransferAuthorization as an internal base type for the four signable strategies
  • Adds { strategy: "None" } to UnsignedTransferAuthorization
  • Reworks TransferAuthorization as an explicit discriminated union — None requires no signature fields; all other strategies retain { r, s, v, signature }
  • encodeTransferAuthorizationEntry early-returns "0x" for strategy: "None", matching on-chain TokenTransferAuthorizationLib.discardNext semantics

tests/erc20/handler.test.ts

  • Adds unit test asserting { strategy: "None" } encodes to "0x"
  • Adds round-trip queue test for [None, ERC3009] asserting encoded output is ["0x", <strategy-1 entry>]

Usage

const queue: TransferAuthorization[] = [
  { strategy: "None" },       // leading empty slot — consumed by zero-amount seller-deposit transferFundsIn
  await signReceiveWithErc3009Authorization({ ... })  // buyer's price auth
];

await metaTx.handler.executeMetaTransactionWithTokenTransferAuthorization({
  ...args,
  transferAuthorizations: queue
});

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 26, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ levalleux-ludo
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Add support for fallback entries in token-transfer-authorization queues feat(core-sdk): add "None" fallback strategy to transfer authorization queue (BPIP-12) May 26, 2026
Copilot AI requested a review from levalleux-ludo May 26, 2026 14:20
@levalleux-ludo levalleux-ludo marked this pull request as ready for review May 28, 2026 16:42
Copilot AI review requested due to automatic review settings May 28, 2026 16:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a "None" fallback strategy to the transfer authorization queue used by BPIP-12 commit-time meta-tx flows. This allows consumers to express empty/skip slots (encoded as "0x") directly via the SDK rather than hand-rolling queue encoding.

Changes:

  • Extracts SignableTransferAuthorization base type and adds { strategy: "None" } variant to UnsignedTransferAuthorization / TransferAuthorization discriminated unions
  • encodeTransferAuthorizationEntry early-returns "0x" for the None strategy
  • Adds unit tests for the None encoding and a [None, ERC3009] round-trip

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
packages/core-sdk/src/erc20/handler.ts Introduces None strategy in transfer authorization types and encodeTransferAuthorizationEntry
packages/core-sdk/tests/erc20/handler.test.ts Adds tests for the new None strategy encoding behavior
package-lock.json Lockfile churn (removes some peer deps, marks build/test deps as dev)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core-sdk: support fallback / empty entries in token-transfer-authorization queues (BPIP-12)

4 participants