Skip to content

Commit

Permalink
Rename onrampToken param to sessionToken (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveviselli-cb authored Jan 25, 2024
1 parent ce2f91e commit 9bef569
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

## [2.0.0] - 2024-01-25
- [BREAKING CHANGE] Rename `onrampToken` parameter to `sessionToken`

## [1.10.0] - 2024-01-11
- Add `onrampToken` parameter

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coinbase/cbpay-js",
"version": "1.10.0",
"version": "2.0.0",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions src/onramp/generateOnRampURL.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ describe('generateOnrampURL', () => {
expect(url.searchParams.get('appId')).toEqual('test');
});

it('should support onrampToken', () => {
it('should support sessionToken', () => {
const url = new URL(
generateOnRampURL({
onrampToken: 'test',
sessionToken: 'test',
}),
);
expect(url.origin).toEqual('https://pay.coinbase.com');
expect(url.pathname).toEqual('/buy/select-asset');
expect(url.searchParams.get('onrampToken')).toEqual('test');
expect(url.searchParams.get('sessionToken')).toEqual('test');
});

it('generates URL with empty destination wallets', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/onramp/generateOnRampURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { DEFAULT_HOST } from '../config';
import { OnRampAppParams } from '../types/onramp';

export type GenerateOnRampURLOptions = {
/** This & destinationWallets or onrampToken are required. */
/** This & destinationWallets or sessionToken are required. */
appId?: string;
destinationWallets?: OnRampAppParams['destinationWallets'];
host?: string;
/** This or appId & destinationWallets are required. */
onrampToken?: string;
sessionToken?: string;
} & Omit<OnRampAppParams, 'destinationWallets'>;

export const generateOnRampURL = ({
Expand Down

0 comments on commit 9bef569

Please sign in to comment.