Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ jobs:
- name: Run tests for packages
run: pnpm run test:packages
env:
VITE_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
VITE_BTC_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_BTC_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_BTC_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
4 changes: 2 additions & 2 deletions apps/next/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NEXT_PUBLIC_SERVICE_URL=
NEXT_PUBLIC_SERVICE_TOKEN=
NEXT_PUBLIC_BTC_SERVICE_URL=
NEXT_PUBLIC_BTC_SERVICE_TOKEN=
4 changes: 2 additions & 2 deletions apps/next/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default function Home() {
const networkType = NetworkType.TESTNET;

const service = BtcAssetsApi.fromToken(
process.env.NEXT_PUBLIC_SERVICE_URL!,
process.env.NEXT_PUBLIC_SERVICE_TOKEN!,
process.env.NEXT_PUBLIC_BTC_SERVICE_URL!,
process.env.NEXT_PUBLIC_BTC_SERVICE_TOKEN!,
);
const source = new DataSource(service, networkType);

Expand Down
4 changes: 2 additions & 2 deletions apps/vite/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_SERVICE_URL=
VITE_SERVICE_TOKEN=
VITE_BTC_SERVICE_URL=
VITE_BTC_SERVICE_TOKEN=
5 changes: 4 additions & 1 deletion apps/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ function App() {
async function send() {
const networkType = NetworkType.TESTNET;

const service = BtcAssetsApi.fromToken(import.meta.env.VITE_SERVICE_URL!, import.meta.env.VITE_SERVICE_TOKEN!);
const service = BtcAssetsApi.fromToken(
import.meta.env.VITE_BTC_SERVICE_URL!,
import.meta.env.VITE_BTC_SERVICE_TOKEN!,
);
const source = new DataSource(service, networkType);

const psbt = await sendBtc({
Expand Down
6 changes: 3 additions & 3 deletions packages/btc/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_SERVICE_URL= # URL of the service
VITE_SERVICE_TOKEN= # JWT token to access the service
VITE_SERVICE_ORIGIN= # URL representing your token's domain
VITE_BTC_SERVICE_URL= # URL of the service
VITE_BTC_SERVICE_TOKEN= # JWT token to access the service
VITE_BTC_SERVICE_ORIGIN= # URL representing your token's domain
6 changes: 3 additions & 3 deletions packages/btc/tests/shared/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const config = networkTypeToConfig(networkType);
export const network = config.network;

export const service = BtcAssetsApi.fromToken(
process.env.VITE_SERVICE_URL!,
process.env.VITE_SERVICE_TOKEN!,
process.env.VITE_SERVICE_ORIGIN!,
process.env.VITE_BTC_SERVICE_URL!,
process.env.VITE_BTC_SERVICE_TOKEN!,
process.env.VITE_BTC_SERVICE_ORIGIN!,
);

export const source = new DataSource(service, networkType);
Expand Down
6 changes: 3 additions & 3 deletions packages/service/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_SERVICE_URL= # URL of the service
VITE_SERVICE_TOKEN= # JWT token to access the service
VITE_SERVICE_ORIGIN= # URL representing your token's domain
VITE_BTC_SERVICE_URL= # URL of the service
VITE_BTC_SERVICE_TOKEN= # JWT token to access the service
VITE_BTC_SERVICE_ORIGIN= # URL representing your token's domain
12 changes: 6 additions & 6 deletions packages/service/tests/Service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe(
() => {
const btcAddress = 'tb1qm06rvrq8jyyckzc5v709u7qpthel9j4d9f7nh3';
const service = BtcAssetsApi.fromToken(
process.env.VITE_SERVICE_URL!,
process.env.VITE_SERVICE_TOKEN!,
process.env.VITE_SERVICE_ORIGIN!,
process.env.VITE_BTC_SERVICE_URL!,
process.env.VITE_BTC_SERVICE_TOKEN!,
process.env.VITE_BTC_SERVICE_ORIGIN!,
);

describe('Initiation and token generation', () => {
it('Generate a valid token', async () => {
const serviceWithApp = new BtcAssetsApi({
url: process.env.VITE_SERVICE_URL!,
url: process.env.VITE_BTC_SERVICE_URL!,
app: 'btc-test-app',
domain: 'btc-test.app',
origin: 'https://btc-test.app',
Expand All @@ -36,14 +36,14 @@ describe(
expect(
() =>
new BtcAssetsApi({
url: process.env.VITE_SERVICE_URL!,
url: process.env.VITE_BTC_SERVICE_URL!,
domain: 'https://btc-test.app',
}),
).toThrow(`${ErrorMessages[ErrorCodes.ASSETS_API_INVALID_PARAM]}: domain`);
});
it('Try generate token without the "app" param', async () => {
const serviceWithoutApp = new BtcAssetsApi({
url: process.env.VITE_SERVICE_URL!,
url: process.env.VITE_BTC_SERVICE_URL!,
domain: 'btc-test.app',
});

Expand Down