Update airdrop return type

This commit is contained in:
Michael Vines
2018-09-12 17:41:20 -07:00
parent ad5390bbae
commit fa5f3d81fd
2 changed files with 7 additions and 7 deletions

View File

@ -113,7 +113,7 @@ const RequestAirdropRpcResult = struct({
jsonrpc: struct.literal('2.0'), jsonrpc: struct.literal('2.0'),
id: 'string', id: 'string',
error: 'any?', error: 'any?',
result: 'boolean?', result: 'string?',
}); });
/** /**
@ -218,14 +218,14 @@ export class Connection {
/** /**
* Request an allocation of tokens to the specified account * Request an allocation of tokens to the specified account
*/ */
async requestAirdrop(to: PublicKey, amount: number): Promise<void> { async requestAirdrop(to: PublicKey, amount: number): Promise<TransactionSignature> {
const unsafeRes = await this._rpcRequest('requestAirdrop', [to, amount]); const unsafeRes = await this._rpcRequest('requestAirdrop', [to, amount]);
const res = RequestAirdropRpcResult(unsafeRes); const res = RequestAirdropRpcResult(unsafeRes);
if (res.error) { if (res.error) {
throw new Error(res.error.message); throw new Error(res.error.message);
} }
assert(typeof res.result !== 'undefined'); assert(typeof res.result !== 'undefined');
assert(res.result); return res.result;
} }
/** /**

View File

@ -144,7 +144,7 @@ test('request airdrop', async () => {
}, },
{ {
error: null, error: null,
result: true, result: '1WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk',
} }
]); ]);
mockRpc.push([ mockRpc.push([
@ -155,7 +155,7 @@ test('request airdrop', async () => {
}, },
{ {
error: null, error: null,
result: true, result: '2WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk',
} }
]); ]);
mockRpc.push([ mockRpc.push([
@ -207,7 +207,7 @@ test('transaction', async () => {
}, },
{ {
error: null, error: null,
result: true, result: '0WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk',
} }
]); ]);
mockRpc.push([ mockRpc.push([
@ -232,7 +232,7 @@ test('transaction', async () => {
}, },
{ {
error: null, error: null,
result: true, result: '8WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk',
} }
]); ]);
mockRpc.push([ mockRpc.push([