Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Add support for server metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Morley Zhi committed May 15, 2020
1 parent 065b9a9 commit ad618bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar/wallet-sdk",
"version": "0.1.0-rc.1",
"version": "0.1.0-rc.2",
"description": "Libraries to help you write Stellar-enabled wallets in Javascript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
11 changes: 10 additions & 1 deletion src/data/DataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export interface DataProviderParams {
serverUrl: string;
accountOrKey: Account | string;
networkPassphrase: string;

// these are passed to `new Server`
metadata?: {
allowHttp?: boolean;
appName?: string;
appVersion?: string;
};
}

function isAccount(obj: any): obj is Account {
Expand Down Expand Up @@ -88,11 +95,13 @@ export class DataProvider {
throw new Error(`The provided key was not valid: ${accountKey}`);
}

const metadata = params.metadata || {};

this.callbacks = {};
this.errorHandlers = {};
this.networkPassphrase = params.networkPassphrase;
this.serverUrl = params.serverUrl;
this.server = new Server(this.serverUrl);
this.server = new Server(this.serverUrl, metadata);
this.accountKey = accountKey;
this._watcherTimeouts = {};
}
Expand Down

0 comments on commit ad618bd

Please sign in to comment.