Open BenKurrek opened 1 year ago
@BenKurrek There is a lot of code that is complex and not relevant to the problem. Can you please write a separate 3 lines test that throws the same error?
In the following code snippet, I attempt to get the access key information for the root account
test.near
but an error is thrown. (Full test here).const network = 'sandbox'; let networkConfig = { networkId: 'localnet', viewAccountId: 'test.near', nodeUrl: rpcPort, walletUrl: `https://wallet.${network}.near.org`, helperUrl: `https://helper.${network}.near.org`, }; const keyStore = new InMemoryKeyStore(); const near = new Near({ ...networkConfig, keyStore, headers: {} }); const signerId = "test.near"; const account = new Account(near.connection, signerId); const { provider } = account.connection; const key = await root.getKey(); const queryUrl = `access_key/${signerId}/${key!.getPublicKey().toString()}`; const accessKey: any = await provider.query( queryUrl, "" ); console.log(`accessKey: ${JSON.stringify(accessKey)}`)
This should return the access key information but instead, it throws an error:
Error (TypedError) { context: undefined, type: 'UntypedError', message: '[-32700] Parse error: Failed parsing args: invalid type: sequence, expected struct RpcQueryRequest', }
To reproduce this issue:
- clone https://github.com/keypom/trial-accounts
- checkout ben/workspaces-bug
- install deps
- run the test command
yarn test
@BenKurrek I think you could replace
const accessKey: any = await provider.query(
queryUrl,
""
);
to
const accessKey: any = await provider.query({
"request_type": "view_access_key",
"finality": "final",
"account_id": signerId,
"public_key": key!.getPublicKey().toString()
}
);
according to the near rpc api of access-keys,which will pass the tests
In the following code snippet, I attempt to get the access key information for the root account
test.near
but an error is thrown. (Full test here).This should return the access key information but instead, it throws an error:
To reproduce this issue:
yarn test