diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 0b014660f4..8e6c577030 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -113,7 +113,7 @@ const RequestAirdropRpcResult = struct({ jsonrpc: struct.literal('2.0'), id: 'string', error: 'any?', - result: 'boolean?', + result: 'string?', }); /** @@ -218,14 +218,14 @@ export class Connection { /** * Request an allocation of tokens to the specified account */ - async requestAirdrop(to: PublicKey, amount: number): Promise { + async requestAirdrop(to: PublicKey, amount: number): Promise { const unsafeRes = await this._rpcRequest('requestAirdrop', [to, amount]); const res = RequestAirdropRpcResult(unsafeRes); if (res.error) { throw new Error(res.error.message); } assert(typeof res.result !== 'undefined'); - assert(res.result); + return res.result; } /** diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index 70c40a2f23..9f5a7d53ca 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -144,7 +144,7 @@ test('request airdrop', async () => { }, { error: null, - result: true, + result: '1WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk', } ]); mockRpc.push([ @@ -155,7 +155,7 @@ test('request airdrop', async () => { }, { error: null, - result: true, + result: '2WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk', } ]); mockRpc.push([ @@ -207,7 +207,7 @@ test('transaction', async () => { }, { error: null, - result: true, + result: '0WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk', } ]); mockRpc.push([ @@ -232,7 +232,7 @@ test('transaction', async () => { }, { error: null, - result: true, + result: '8WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk', } ]); mockRpc.push([