Skip to content

Commit

Permalink
feat: update fromSeed fn (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Sumin <[email protected]>
  • Loading branch information
justinenerio and Merculiar authored Nov 25, 2024
1 parent 9025a3a commit 7db0f75
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Using the generated `seed`, initialize the client:
const client = await BrijPartnerClient.fromSeed(seed);
```

For production use:

```Javascript
const client = await BrijPartnerClient.fromSeed(seed, AppConfig.prod());
```

## React to an Order

Once you receive a notification from the incoming webhook, you can retrieve the `orderId` from the JSON-encoded body.
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export declare class BrijPartnerClient {
getPublicKeyBytes: () => Promise<Uint8Array>;
getPrivateKeyBytes: () => Promise<Uint8Array>;
}>;
static fromSeed(seed: string): Promise<BrijPartnerClient>;
static fromSeed(seed: string, appConfig?: AppConfig): Promise<BrijPartnerClient>;
private init;
private generateAuthToken;
private createToken;
Expand Down
7 changes: 4 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brij-partner-sdk",
"version": "0.3.1",
"version": "0.3.2",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
13 changes: 4 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ export class AppConfig {
}

static demo() {
return new AppConfig(
'https://kyc-backend-oxvpvdtvzq-ew.a.run.app/',
'https://kyc-backend-orders-402681483920.europe-west1.run.app/'
);
return new AppConfig("https://storage-demo.brij.fi/", "https://orders-demo.brij.fi/");
}

static production() {
return new AppConfig(
'https://storage.brij.fi/',
'https://orders.brij.fi/'
);
return new AppConfig("https://storage.brij.fi/", "https://orders.brij.fi/");
}

static custom(storageBaseUrl: string, orderBaseUrl: string) {
Expand Down Expand Up @@ -167,7 +161,7 @@ export class BrijPartnerClient {
};
}

static async fromSeed(seed: string): Promise<BrijPartnerClient> {
static async fromSeed(seed: string, appConfig?: AppConfig): Promise<BrijPartnerClient> {
const decoded = base58.decode(seed);
const authKeyPair = nacl.sign.keyPair.fromSeed(decoded);

Expand All @@ -180,6 +174,7 @@ export class BrijPartnerClient {
return authKeyPair.publicKey;
},
},
appConfig,
});

await client.init();
Expand Down

0 comments on commit 7db0f75

Please sign in to comment.