Update airdrop return type
This commit is contained in:
@ -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<void> {
|
||||
async requestAirdrop(to: PublicKey, amount: number): Promise<TransactionSignature> {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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([
|
||||
|
Reference in New Issue
Block a user