diff --git a/src/index.js b/src/index.js index 9a77f81..16e27df 100644 --- a/src/index.js +++ b/src/index.js @@ -237,14 +237,16 @@ export type WalletRecrods = { records?: WalletRecord[], } -declare enum NymRole { - TRUSTEE = 0, - STEWARD = 2, - TRUST_ANCHOR = 101, - ENDORSER = 101, - NETWORK_MONITOR = 201, +const nymRoleValues = { + TRUSTEE: 0, + STEWARD: 2, + TRUST_ANCHOR: 101, + ENDORSER: 101, + NETWORK_MONITOR: 201, } +export type NymRole = $Keys + export type GetNymResponse = { did: Did; verkey: Verkey; @@ -387,15 +389,18 @@ export default { // pool - createPoolLedgerConfig(poolName: string, poolConfig: string): Promise { - return IndySdk.createPoolLedgerConfig(poolName, poolConfig) + createPoolLedgerConfig(poolName: string, poolConfig: {}): Promise { + return IndySdk.createPoolLedgerConfig(poolName, JSON.stringify(poolConfig)); }, - openPoolLedger(poolName: string, poolConfig: string): Promise { + openPoolLedger(poolName: string, poolConfig: {} | undefined): Promise { if (Platform.OS === 'ios') { - return IndySdk.openLedger(poolName, poolConfig) + return IndySdk.openLedger(poolName, JSON.stringify(poolConfig)); + } + if (poolConfig === undefined) { + return IndySdk.openPoolLedger(poolName, null); } - return IndySdk.openPoolLedger(poolName, poolConfig) + return IndySdk.openPoolLedger(poolName, JSON.stringify(poolConfig)); }, setProtocolVersion(protocolVersion: number): Promise { @@ -410,7 +415,7 @@ export default { if (Platform.OS === 'ios') { return JSON.parse(await IndySdk.submitRequest(request, poolHandle)) } - return JSON.parse(await IndySdk.submitRequest(ph, JSON.stringify(request))) + return JSON.parse(await IndySdk.submitRequest(poolHandle, JSON.stringify(request))) }, async buildGetSchemaRequest(submitterDid: Did, id: string): Promise { @@ -630,11 +635,11 @@ export default { return IndySdk.deleteWalletRecord(wh, type, id) }, - async getWalletRecord(wh: WalletHandle, type: string, id: string): Promise { + async getWalletRecord(wh: WalletHandle, type: string, id: string, options: {}): Promise { if (Platform.OS == 'ios') { throw new Error(`Unsupported platform! ${Platform.OS}`) } - return JSON.parse(await IndySdk.getWalletRecord(wh, type, id)) + return JSON.parse(await IndySdk.getWalletRecord(wh, type, id, JSON.stringify(options))) }, async openWalletSearch(wh: WalletHandle, type: string, query: {}, options: {}): Promise {