Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: rename btc_sendmany to sendBitcoin #73

Merged
merged 5 commits into from
Oct 15, 2024
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["bech32", "p2wpkh", "sendmany", "syncpack"]
"cSpell.words": ["bech32", "p2wpkh", "syncpack"]
}
32 changes: 9 additions & 23 deletions packages/keyring-api/docs/btc-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,26 @@
Here we document the Bitcoin methods that an account Snap may implement to
support requests originated from dapps.

## btc_sendmany
## sendBitcoin

This method is similar to the `sendmany` RPC method from Bitcoin Core, but its
parameters are passed in an object instead of an array, and are named in
camelCase. Also, dummy values aren't allowed.
Send bitcoins to one or more recipients.

### Parameters

- **Transaction intent (required)**
- Type: `object`
- Properties:
- `amounts`
- `recipients`
- Description: A JSON object with recipient addresses and amounts.
- Type: `object`
- Properties:
- `[key]: string`: Address of the recipient
- `[value]: string`: Amount to send to the recipient in BTC
- `comment` (optional)
- Description: A comment.
- Type: `string`
- `subtractFeeFrom` (optional)
- Description: The fee will be equally deducted from the amount of each
selected address. Those recipients will receive less bitcoins than you
enter in their corresponding amount field. If no addresses are specified
here, the sender pays the fee.
- Type: `array`
- Items:
- Type: `string`
- `[key]: string`: Address of the recipient.
- `[value]: string`: Amount to send to the recipient in **BTC**.
- `replaceable` (optional)
- Description: Allow this transaction to be replaced by a transaction
with higher fees via BIP 125.
- Type: `boolean`
- Default: `true`

### Returns

Expand All @@ -51,15 +39,13 @@ camelCase. Also, dummy values aren't allowed.

```json
{
"method": "btc_sendmany",
"method": "sendBitcoin",
"params": {
"amounts": {
"recipients": {
"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl": "0.01",
"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3": "0.02"
},
"comment": "testing",
"subtractFeeFrom": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl"],
"replaceable": false
"replaceable": true
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions packages/keyring-api/src/btc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BtcP2wpkhAddressStruct = refine(
*/
export enum BtcMethod {
// General transaction methods
SendMany = 'btc_sendmany',
SendBitcoin = 'sendBitcoin',
}

export const BtcP2wpkhAccountStruct = object({
Expand All @@ -44,7 +44,7 @@ export const BtcP2wpkhAccountStruct = object({
/**
* Account supported methods.
*/
methods: array(enums([`${BtcMethod.SendMany}`])),
methods: array(enums([`${BtcMethod.SendBitcoin}`])),
});

export type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;