Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/stellar-wallet-snap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Retry transient RPC and Horizon failures with bounded timeouts and circuit breaking ([#551](https://github.com/MetaMask/internal-snaps/pull/551))
- Transaction submission still uses the raw RPC client and does not apply the fetch policy.

### Fixed

- Fix `onAmountInput` to accept optional destination as `toAddress` instead of `to` ([#558](https://github.com/MetaMask/internal-snaps/pull/558))
Comment thread
stanleyyconsensys marked this conversation as resolved.
Resolved

## [2.0.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Preflight-validates a send amount while the user types (balance and fee checks o
- `accountId` — keyring account UUID
- `assetId` — CAIP-19 classic / SEP-41 / slip44 asset (`scope` is derived from `assetId`)
- `value` — positive amount string (human-readable units)
- `to` — optional Stellar destination; ignored for preflight (always a self-transfer so destination errors surface in `confirmSend`)
- `toAddress` — optional Stellar destination; ignored for preflight (always a self-transfer so destination errors surface in `confirmSend`)

**Response**

Expand Down Expand Up @@ -67,7 +67,7 @@ sequenceDiagram
participant Meta as AssetMetadataService
participant Tx as TransactionService

Client->>Handler: onAmountInput { accountId, assetId, value, to? }
Client->>Handler: onAmountInput { accountId, assetId, value, toAddress? }
Handler->>Resolver: resolve from keyring state
Resolver-->>Handler: account, wallet, onChainAccount
Handler->>Meta: resolve(assetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ describe('OnAmountInputJsonRpcRequestStruct', () => {
...baseWireRequest.params,
assetId: slip44AssetId,
value: '1.0000001',
to: stellarAddress,
toAddress: stellarAddress,
},
},
expectedScope: 'stellar:pubnet',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const OnAmountInputParamsWireStruct = object({
KnownCaip19Slip44IdStruct,
]),
value: nonempty(string()),
to: optional(StellarAddressStruct),
toAddress: optional(StellarAddressStruct),
});

const OnAmountInputParamsStruct = assign(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('OnAmountInputHandler', () => {
overrides: Partial<
Pick<
OnAmountInputJsonRpcRequest['params'],
'accountId' | 'assetId' | 'value' | 'to'
'accountId' | 'assetId' | 'value' | 'toAddress'
>
> = {},
) {
Expand Down Expand Up @@ -221,10 +221,10 @@ describe('OnAmountInputHandler', () => {
);
});

it('uses the sender as destination even when params.to is set', async () => {
it('uses the sender as destination even when params.toAddress is set', async () => {
const { handler, onChainAccount, createValidatedSendTransaction } = setup();

await handler.handle(baseRequest({ to: destinationAddress }));
await handler.handle(baseRequest({ toAddress: destinationAddress }));

expect(createValidatedSendTransaction).toHaveBeenCalledWith({
onChainAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class OnAmountInputHandler extends BaseClientRequestHandler<
* repeated amount checks stay responsive.
*
* @param resolved - Keyring account, persisted on-chain snapshot, and wallet.
* @param request - JSON-RPC request with `assetId` and `value` (positive amount string). Optional `to` is ignored; destination validation happens in `confirmSend` (`scope` is derived from `assetId`).
* @param request - JSON-RPC request with `assetId` and `value` (positive amount string). Optional `toAddress` is ignored; destination validation happens in `confirmSend` (`scope` is derived from `assetId`).
* @returns Validation result with `valid` and optional error codes.
*/
protected async execute(
Expand Down
Loading