Skip to content
Merged
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
14 changes: 7 additions & 7 deletions core/cap-0079.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This CAP is aligned with the following Stellar Network Goals:

## Abstract

New host functions `strkey_to_address_v2` and `address_to_strkey_v2` for performing the conversions. These functions are similar to the existing `strkey_to_address`/`address_to_strkey`, but they can have a `MuxedAddressObject` as an output or input respectively.
New host functions `strkey_to_muxed_address` and `muxed_address_to_strkey` for performing the conversions. These functions are similar to the existing `strkey_to_address`/`address_to_strkey`, but they can have a `MuxedAddressObject` as an output or input respectively.

## Specification

Expand All @@ -53,7 +53,7 @@ index 945ada2c..b8d76d4d 100644
+ },
+ {
+ "export": "7",
+ "name": "strkey_to_address_v2",
+ "name": "strkey_to_muxed_address",
+ "args": [
+ {
+ "name": "strkey",
Expand All @@ -66,7 +66,7 @@ index 945ada2c..b8d76d4d 100644
+ },
+ {
+ "export": "8",
+ "name": "address_to_strkey_v2",
+ "name": "muxed_address_to_strkey",
+ "args": [
+ {
+ "name": "address",
Expand All @@ -83,16 +83,16 @@ index 945ada2c..b8d76d4d 100644

### Semantics

#### `address_to_strkey_v2` host function
#### `muxed_address_to_strkey` host function

`address_to_strkey_v2` accepts a single `Val` argument that can be either `AddressObject`, or `MuxedAddressObject`. `AddressObject` will be converted to an account (`G...`) or contract (`C...`) strkey corresponding to the address. `MuxedAddressObject` will be converted to a muxed account strkey (`M...`).
`muxed_address_to_strkey` accepts a single `Val` argument that can be either `AddressObject`, or `MuxedAddressObject`. `AddressObject` will be converted to an account (`G...`) or contract (`C...`) strkey corresponding to the address. `MuxedAddressObject` will be converted to a muxed account strkey (`M...`).

The function traps if a `Val` of invalid type is provided.


#### `strkey_to_address_v2` host function
#### `strkey_to_muxed_address` host function

`strkey_to_address_v2` accepts a single `Val` containing strkey in `BytesObject` or `StringObject`.
`strkey_to_muxed_address` accepts a single `Val` containing strkey in `BytesObject` or `StringObject`.

Valid `G...` and `C...` strkeys will be converted to corresponding `AddressObject`. Valid `M...` strkeys will be converted to corresponding `MuxedAddressObject`.

Expand Down
Loading