Skip to content

Commit

Permalink
fix(api): refactor types (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit authored Feb 26, 2024
1 parent 343d0fb commit 05b9846
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.36.7

_02/26/2024_

### Changes
https://github.com/gear-tech/gear-js/pull/1490
- Refactor types

## 0.36.6

_02/15/2024_
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gear-js/api",
"version": "0.36.6",
"version": "0.36.7",
"description": "A JavaScript library that provides functionality to connect GEAR Component APIs.",
"main": "cjs/index.js",
"module": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion api/src/Gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class GearGas {
*/
async initUpload(
sourceId: HexString,
code: HexString | Buffer,
code: HexString | Buffer | Uint8Array,
payload: PayloadType,
value?: Value,
allowOtherPanics?: boolean,
Expand Down
2 changes: 1 addition & 1 deletion api/src/GearApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class GearApi extends ApiPromise {

static async create(options?: GearApiOptions): Promise<GearApi> {
const api = new GearApi(options);
await api.isReady;
await api.isReadyOrError;
return api;
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class GearProgram extends GearTransaction {
validateGasLimit(args.gasLimit, this._api);

const salt = args.salt || randomAsHex(20);
const code = this._api.createType('Bytes', Array.from(args.code)) as Bytes;
const code = typeof args.code === 'string' ? args.code : this._api.createType('Bytes', Array.from(args.code));

const payload = encodePayload(args.initPayload, metaOrHexRegistry, 'init', typeIndexOrTypeName);
const codeId = generateCodeHash(code);
Expand Down
2 changes: 1 addition & 1 deletion api/src/types/interfaces/program/extrinsic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SubmittableExtrinsic } from '@polkadot/api/types';
import { GasLimit, Value } from '../../common';

export interface V1010ProgramUploadOptions {
code: Buffer | Uint8Array;
code: HexString | Buffer | Uint8Array;
salt?: `0x${string}`;
initPayload?: AnyJson;
gasLimit: GasLimit;
Expand Down

0 comments on commit 05b9846

Please sign in to comment.