Skip to content

Commit

Permalink
Exporting all the classes from transaction. Making sure kind is surfa…
Browse files Browse the repository at this point in the history
…ced in error if missing in schema
  • Loading branch information
ilblackdragon committed Sep 4, 2020
1 parent 2c542d9 commit 81f6403
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
17 changes: 8 additions & 9 deletions lib/transaction.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion lib/transaction.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/utils/rpc_errors.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export function functionCallAccessKey(receiverId: string, methodNames: String[],

export class IAction extends Assignable {}

class CreateAccount extends IAction {}
class DeployContract extends IAction { code: Uint8Array; }
class FunctionCall extends IAction { methodName: string; args: Uint8Array; gas: BN; deposit: BN; }
class Transfer extends IAction { deposit: BN; }
class Stake extends IAction { stake: BN; publicKey: PublicKey; }
class AddKey extends IAction { publicKey: PublicKey; accessKey: AccessKey; }
class DeleteKey extends IAction { publicKey: PublicKey; }
class DeleteAccount extends IAction { beneficiaryId: string; }
export class CreateAccount extends IAction {}
export class DeployContract extends IAction { code: Uint8Array; }
export class FunctionCall extends IAction { methodName: string; args: Uint8Array; gas: BN; deposit: BN; }
export class Transfer extends IAction { deposit: BN; }
export class Stake extends IAction { stake: BN; publicKey: PublicKey; }
export class AddKey extends IAction { publicKey: PublicKey; accessKey: AccessKey; }
export class DeleteKey extends IAction { publicKey: PublicKey; }
export class DeleteAccount extends IAction { beneficiaryId: string; }

export function createAccount(): Action {
return new Action({createAccount: new CreateAccount({}) });
Expand Down
2 changes: 2 additions & 0 deletions src/utils/rpc_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function walkSubtype(errorObj, schema, result, typeName) {
}
return walkSubtype(error, schema, result, errorTypeName);
} else {
// TODO: is this the right thing to do?
result.kind = errorObj;
return typeName;
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/rpc_errors.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81f6403

Please sign in to comment.