-
Notifications
You must be signed in to change notification settings - Fork 300
feat(express): migrate createAddress to typed routes #7136
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
Merged
danielzhao122
merged 3 commits into
master
from
WP-5418-express-migrate-api-v2-coin-wallet-id-address-to-typed-routes
Oct 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import * as t from 'io-ts'; | ||
| import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http'; | ||
| import { BitgoExpressError } from '../../schemas/error'; | ||
| import { EIP1559, ForwarderVersion, CreateAddressFormat } from '../../schemas/address'; | ||
|
|
||
| /** | ||
| * Path parameters for creating a wallet address | ||
| */ | ||
| export const CreateAddressParams = { | ||
| /** Coin ticker / chain identifier */ | ||
| coin: t.string, | ||
| /** The ID of the wallet. */ | ||
| walletId: t.string, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Request body for creating a wallet address | ||
| */ | ||
| export const CreateAddressBody = { | ||
| /** Address type for chains that support multiple address types */ | ||
| type: optional(t.string), | ||
| /** Chain on which the new address should be created. Default: 1 */ | ||
| chain: optional(t.number), | ||
| /** | ||
| * (ETH only) Specify forwarder version to use in address creation. | ||
| * 0: legacy forwarder; | ||
| * 1: fee-improved forwarder; | ||
| * 2: NFT-supported forwarder (v2 wallets); | ||
| * 3: MPC wallets; | ||
| * 4: EVM variants; | ||
| * 5: new MPC wallets with wallet-version 6 | ||
| */ | ||
| forwarderVersion: optional(ForwarderVersion), | ||
| /** EVM keyring reference address (EVM only) */ | ||
| evmKeyRingReferenceAddress: optional(t.string), | ||
| /** Create an address for the given token (OFC only) (eg. ofcbtc) */ | ||
| onToken: optional(t.string), | ||
| /** A human-readable label for the address (Max length: 250) */ | ||
| label: optional(t.string), | ||
| /** Whether the deployment should use a low priority fee key (ETH only) Default: false */ | ||
| lowPriority: optional(t.boolean), | ||
| /** Explicit gas price to use when deploying the forwarder contract (ETH only) */ | ||
| gasPrice: optional(t.union([t.number, t.string])), | ||
| /** EIP1559 fee parameters (ETH forwarderVersion: 0 wallets only) */ | ||
| eip1559: optional(EIP1559), | ||
| /** Format to use for the new address (e.g., 'cashaddr' for BCH) */ | ||
| format: optional(CreateAddressFormat), | ||
| /** Number of new addresses to create (maximum 250) */ | ||
| count: optional(t.number), | ||
| /** Base address of the wallet (if applicable) */ | ||
| baseAddress: optional(t.string), | ||
| /** When false, throw error if address verification is skipped */ | ||
| allowSkipVerifyAddress: optional(t.boolean), | ||
| } as const; | ||
|
|
||
| /** Response for creating a wallet address */ | ||
| export const CreateAddressResponse = { | ||
| 200: t.unknown, | ||
| 400: BitgoExpressError, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Create address for a wallet | ||
| * | ||
| * @operationId express.v2.wallet.createAddress | ||
| */ | ||
| export const PostCreateAddress = httpRoute({ | ||
| path: '/api/v2/{coin}/wallet/{walletId}/address', | ||
| method: 'POST', | ||
| request: httpRequest({ | ||
| params: CreateAddressParams, | ||
| body: CreateAddressBody, | ||
| }), | ||
| response: CreateAddressResponse, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import * as t from 'io-ts'; | ||
|
|
||
| export const ForwarderVersion = t.union([t.literal(0), t.literal(1), t.literal(2), t.literal(3), t.literal(4)]); | ||
|
|
||
| export const EIP1559 = t.type({ | ||
| maxFeePerGas: t.number, | ||
| maxPriorityFeePerGas: t.number, | ||
| }); | ||
|
|
||
| export const CreateAddressFormat = t.union([t.literal('base58'), t.literal('cashaddr')]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.