Skip to content

Commit

Permalink
doc: add origin usages to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ShookLyngs committed Mar 6, 2024
1 parent 84e1490 commit 7979ec5
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ If you don't have a token (API-Key) of the service for your app:
```typescript
import { BtcAssetsApi } from '@rgbpp-sdk/btc';

const service = BtcAssetsApi.fromApp(
'btc_assets_api_url',
'your_app_name',
'your_domain'
);
const service = new BtcAssetsApi({
url: 'https://your-btc-assets-api.url',
app: 'your-test-app-name',
domain: 'your.app',
});

// Generate a token for your app
await service.init();
Expand All @@ -32,8 +32,28 @@ Instead, if you already have a token for your app:
import { BtcAssetsApi } from '@rgbpp-sdk/btc';

const service = BtcAssetsApi.fromToken(
'btc_assets_api_url',
'your_token'
'https://your-btc-assets-api.url',
'token'
);
```

When initializing the service in Node.js, you should pass an extra `origin` param, which should be a URL matching your domain, or matching the domain of your token:
```typescript
import { BtcAssetsApi } from '@rgbpp-sdk/btc';

// Without token
const service = new BtcAssetsApi({
url: 'https://your-btc-assets-api.url',
app: 'your-test-app-name',
domain: 'your.app',
origin: 'https://your.app'
});

// With token
const service = BtcAssetsApi.fromToken(
'https://your-btc-assets-api.url',
'token',
'https://your.app'
);
```

Expand Down

0 comments on commit 7979ec5

Please sign in to comment.