diff --git a/.circleci/config.yml b/.circleci/config.yml index 834465be..d87107e7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ commands: command: | apt-get -qq update apt-get -qq install python curl git gcc - curl --proto '=https' --tlsv1.2 -sSL https://get.oasis.dev | python - --toolchain 19.41 + curl --proto '=https' --tlsv1.2 -sSL https://get.oasis.dev | python - --toolchain unstable npm install -g lerna npm install -g yarn diff --git a/packages/client/README.md b/packages/client/README.md index ebd9e378..f057b876 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -114,7 +114,7 @@ const privateKey = '0x1ad288d73cd2fff6ecf0a5bf167f59e9944559cd70f66cb70170702a0b // Wallet for signing and paying for transactions. const wallet = new oasis.Wallet(privateKey); -// Etheruem gateway responsible for signing transactions. +// Ethereum gateway responsible for signing transactions. const gateway = new oasis.gateways.Web3Gateway('wss://web3.devnet.oasiscloud.io/ws', wallet); // Configure the gateway to use. diff --git a/packages/common/src/bytes.ts b/packages/common/src/bytes.ts index 91ae2e03..838173f5 100644 --- a/packages/common/src/bytes.ts +++ b/packages/common/src/bytes.ts @@ -107,7 +107,7 @@ export function encodeUtf8(input: string): Uint8Array { /** * Converts the given byte array to a number. Cannot parse a number - * larger than u64, specifically, 2**53-1 (javascripts max number). + * larger than u64, specifically, 2**53-1 (javascript's max number). */ export function toNumber(bytes: Uint8Array, le = false): number { if (bytes.length > 8) { diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index e50d9549..b3050f7d 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -4,7 +4,7 @@ export { Db, LocalStorage, DummyStorage } from './db'; export { sleep } from './utils'; /** - * Lighteweight wrapper for bytes with an easy hex conversion. + * Lightweight wrapper for bytes with an easy hex conversion. */ export abstract class Bytes { private _bytes: Uint8Array; diff --git a/packages/gateway/src/api.ts b/packages/gateway/src/api.ts index 263ebd63..8411874d 100644 --- a/packages/gateway/src/api.ts +++ b/packages/gateway/src/api.ts @@ -28,7 +28,7 @@ export const RpcApi: DeveloperGatewayApi = { }; /** - * Retrieives the public key for a service. + * Retrieves the public key for a service. */ export const PublicKeyApi: DeveloperGatewayApi = { url: 'v0/api/service/getPublicKey', diff --git a/packages/service/src/coder/oasis.ts b/packages/service/src/coder/oasis.ts index d0293fb6..7d8abc7b 100644 --- a/packages/service/src/coder/oasis.ts +++ b/packages/service/src/coder/oasis.ts @@ -43,7 +43,12 @@ export class OasisCoder implements RpcCoder { } public async decodeSubscriptionEvent(e: any, _idl: Idl): Promise { - const event = cbor.decode(bytes.parseHex(e.data)); + const eventBytes = bytes.parseHex(e.data); + const payloadSize = new Uint32Array( + new Uint8Array(eventBytes.slice(0, 4)) + )[0]; + const payloadBytes = eventBytes.slice(4, payloadSize + 4); + const event = cbor.decode(payloadBytes); return camelCaseKeys(event, { deep: true }); } diff --git a/packages/service/test/service.spec.ts b/packages/service/test/service.spec.ts index f7c63667..aba8ea0b 100644 --- a/packages/service/test/service.spec.ts +++ b/packages/service/test/service.spec.ts @@ -107,7 +107,7 @@ describe('Service', () => { const request = await txDataPromise; - // Then the receipient should be able to decrypt it. + // Then the recipient should be able to decrypt it. const decoder = new ConfidentialGatewayRequestDecoder(keys.privateKey); const plaintext = await decoder.decode(request.data); diff --git a/packages/service/test/utils.ts b/packages/service/test/utils.ts index 26f5af45..dfbb3a83 100644 --- a/packages/service/test/utils.ts +++ b/packages/service/test/utils.ts @@ -77,7 +77,7 @@ export class RpcRequestMockOasisGateway extends EmptyOasisGateway { } /** - * Provider that deploys a contract with a fixed adress. + * Provider that deploys a contract with a fixed address. */ export class DeployMockOasisGateway extends RpcRequestMockOasisGateway { /** diff --git a/packages/web3/src/web3/provider.ts b/packages/web3/src/web3/provider.ts index 3d7a89db..3cd5ebe7 100644 --- a/packages/web3/src/web3/provider.ts +++ b/packages/web3/src/web3/provider.ts @@ -9,7 +9,7 @@ import { TransactionFactory, UnpreparedTransaction } from '../transaction'; * Web3Provider is the brains behind the `Web3` class' implementation, exposing * the `send` method, that is responsible for making the JSON RPC request to * the Web3 gateway server. It acts as a sort of middle man to ensure requests - * are handled properly and signed by a wallet when needed. Specficially, it + * are handled properly and signed by a wallet when needed. Specifically, it * * - Transforms rpc requests to their desired behavior, e.g., converts * eth_sendTransaction to eth_sendRawTransaction. diff --git a/packages/web3/src/websocket.ts b/packages/web3/src/websocket.ts index a8c80505..945a946a 100644 --- a/packages/web3/src/websocket.ts +++ b/packages/web3/src/websocket.ts @@ -14,7 +14,7 @@ const ERROR_FORWARD_THRESHOLD = 2; * expires. * * Some RPCs like oasis_invoke are synchronous at the gateway and so this is - * a bit high. We should bring this down once we remove all synchrous rpcs. + * a bit high. We should bring this down once we remove all synchronous rpcs. */ const REQUEST_TIMEOUT_DURATION = 30000; @@ -128,7 +128,7 @@ export class JsonRpcWebSocket implements JsonRpc { this.lifecycle.emit('open'); // We were asked to close this websocket while connecting, - // so finish the jobn. + // so finish the job. if (this.closeOnOpen) { this.websocket.close(CloseEvent.NORMAL); return;