Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zilliqa-js/contract

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zilliqa-js/contract - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

7

dist/contract.d.ts
/// <reference types="bn.js" />
/// <reference types="long" />
import { Wallet, Transaction } from '@zilliqa-js/account';
import { Provider } from '@zilliqa-js/core';
import { BN } from '@zilliqa-js/util';
import { BN, Long } from '@zilliqa-js/util';
import { Contracts } from './factory';

@@ -44,3 +45,3 @@ import { ABI, ContractStatus, Init, State, Value } from './types';

prepareTx(tx: Transaction): Promise<Transaction>;
deploy(gasPrice: BN, gasLimit: BN): Promise<Contract>;
deploy(gasPrice: BN, gasLimit: Long): Promise<Contract>;
/**

@@ -53,5 +54,5 @@ * call

*/
call(transition: string, params: Value[], amount?: BN, gasLimit?: BN, gasPrice?: BN): Promise<Transaction>;
call(transition: string, params: Value[], amount?: BN, gasLimit?: Long, gasPrice?: BN): Promise<Transaction>;
getState(): Promise<State>;
}
//# sourceMappingURL=contract.d.ts.map

@@ -69,2 +69,3 @@ "use strict";

response = _a.sent();
console.log(response);
return [2 /*return*/, util_1.types.isError(response)

@@ -125,4 +126,4 @@ ? tx.setStatus(3 /* Rejected */)

if (amount === void 0) { amount = new util_1.BN(0); }
if (gasLimit === void 0) { gasLimit = new util_1.BN(1000); }
if (gasPrice === void 0) { gasPrice = new util_1.BN(10); }
if (gasLimit === void 0) { gasLimit = util_1.Long.fromNumber(1000); }
if (gasPrice === void 0) { gasPrice = new util_1.BN(100); }
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -129,0 +130,0 @@ var msg, err_2;

@@ -0,0 +0,0 @@ import { Wallet, Transaction } from '@zilliqa-js/account';

@@ -0,0 +0,0 @@ export * from './factory';

@@ -0,0 +0,0 @@ export declare const enum ContractStatus {

{
"name": "@zilliqa-js/contract",
"version": "0.2.3",
"version": "0.2.4",
"description": "Contract-related functionality.",

@@ -22,9 +22,9 @@ "main": "dist/index.js",

"dependencies": {
"@zilliqa-js/account": "^0.2.3",
"@zilliqa-js/blockchain": "^0.2.3",
"@zilliqa-js/core": "^0.2.3",
"@zilliqa-js/util": "^0.2.3",
"@zilliqa-js/account": "^0.2.4",
"@zilliqa-js/blockchain": "^0.2.4",
"@zilliqa-js/core": "^0.2.4",
"@zilliqa-js/util": "^0.2.4",
"hash.js": "^1.1.5"
},
"gitHead": "4dad7fce171666d934fffe0699213dd4b5d50b4d"
"gitHead": "3f0feb3c71926b1d3a6cb389d23bf8d9f452cfab"
}

@@ -170,3 +170,3 @@ # @zilliqa-js/contract

### `deploy(gasPrice: BN, gasLimit: BN): Promise<Contract>`
### `deploy(gasPrice: BN, gasLimit: Long): Promise<Contract>`

@@ -183,3 +183,3 @@ Deploys a contract to the blockchain. This method will automatically generate

- `gasPrice`: `BN` - an instance of `BN.js`.
- `gasLimit`: `BN` - an instance of `BN.js`.
- `gasLimit`: `Long` - an instance of `Long.js`.

@@ -193,3 +193,3 @@ **Returns**

### `call(transition: string, params: Value[], amount: BN = new BN(0), gasLimit: BN = new BN(1000), gasPrice: BN = new BN(10)): Promise<Transaction>`
### `call(transition: string, params: Value[], amount: BN = new BN(0), gasLimit: Long = Long.fromNumber(1000), gasPrice: BN = new BN(10)): Promise<Transaction>`

@@ -207,3 +207,3 @@ Calls a transition of the current contract. At the moment, this is a low-level

- `amount`: `BN` (Optional) - an instance of `BN.js`. Default: 0.
- `gasLimit`: `BN` (Optional) - an instance of `BN.js`. Default: 1000.
- `gasLimit`: `Long` (Optional) - an instance of `Long.js`. Default: 1000.
- `gasPrice`: `BN` (Optional) - an instance of `BN.js`. Default: 10.

@@ -210,0 +210,0 @@

import { Wallet, Transaction, TxStatus } from '@zilliqa-js/account';
import { RPCMethod, Provider, sign } from '@zilliqa-js/core';
import { BN, types } from '@zilliqa-js/util';
import { BN, Long, types } from '@zilliqa-js/util';

@@ -98,2 +98,4 @@ import { Contracts } from './factory';

console.log(response);
return types.isError(response)

@@ -104,3 +106,3 @@ ? tx.setStatus(TxStatus.Rejected)

async deploy(gasPrice: BN, gasLimit: BN): Promise<Contract> {
async deploy(gasPrice: BN, gasLimit: Long): Promise<Contract> {
if (!this.code || !this.init) {

@@ -154,4 +156,4 @@ throw new Error(

amount: BN = new BN(0),
gasLimit: BN = new BN(1000),
gasPrice: BN = new BN(10),
gasLimit: Long = Long.fromNumber(1000),
gasPrice: BN = new BN(100),
): Promise<Transaction> {

@@ -158,0 +160,0 @@ const msg = {

@@ -1,4 +0,5 @@

import BN from 'bn.js';
import { Account, Wallet } from '@zilliqa-js/account';
import { HTTPProvider } from '@zilliqa-js/core';
import { Account, Wallet } from '@zilliqa-js/account';
import { BN, Long } from '@zilliqa-js/util';
import { Contracts, Contract, ContractStatus } from '../src/index';

@@ -30,3 +31,3 @@ import { abi } from './test.abi';

)
.deploy(new BN(1), new BN(5000));
.deploy(new BN(1000), Long.fromNumber(5000));

@@ -33,0 +34,0 @@ expect(contract.status).toEqual(ContractStatus.Deployed);

@@ -1,5 +0,4 @@

import BN from 'bn.js';
import { Wallet } from '@zilliqa-js/account';
import { HTTPProvider } from '@zilliqa-js/core';
import { BN, Long } from '@zilliqa-js/util';

@@ -81,3 +80,3 @@ import fetch from 'jest-fetch-mock';

const deployed = await contract.deploy(new BN(1000), new BN(1000));
const deployed = await contract.deploy(new BN(1000), Long.fromNumber(1000));

@@ -127,3 +126,5 @@ expect(deployed.isDeployed()).toBeTruthy();

await expect(contract.deploy(new BN(1000), new BN(1000))).rejects.toThrow();
await expect(
contract.deploy(new BN(1000), Long.fromNumber(1000)),
).rejects.toThrow();
});

@@ -166,3 +167,3 @@

)
.deploy(new BN(1000), new BN(1000));
.deploy(new BN(1000), Long.fromNumber(1000));

@@ -219,3 +220,3 @@ expect(contract.isRejected()).toBeTruthy();

)
.deploy(new BN(1000), new BN(1000));
.deploy(new BN(1000), Long.fromNumber(1000));

@@ -297,3 +298,3 @@ expect(contract.isRejected).toBeTruthy();

)
.deploy(new BN(1000), new BN(1000));
.deploy(new BN(1000), Long.fromNumber(1000));

@@ -300,0 +301,0 @@ const callTx = await contract.call('myTransition', [

@@ -1,2 +0,2 @@

export const testContract = `(* HelloWorld contract *)
export const testContract = `(* Test contract *)

@@ -15,3 +15,2 @@ import ListUtils

let not_owner_code = Int32 1
let set_hello_code = Int32 2

@@ -29,17 +28,8 @@

transition setHello (msg : String)
is_owner = builtin eq owner _sender;
match is_owner with
| False =>
msg = {_tag : "Main"; _recipient : _sender; _amount : Uint128 0; code : not_owner_code};
msgs = one_msg msg;
send msgs
| True =>
welcome_msg := msg;
msg = {_tag : "Main"; _recipient : _sender; _amount : Uint128 0; code : set_hello_code};
msgs = one_msg msg;
send msgs
end
welcome_msg := msg;
msg = {_tag : "Main"; _recipient : _sender; _amount : Uint128 0; code : set_hello_code};
msgs = one_msg msg;
send msgs
end
transition getHello ()

@@ -46,0 +36,0 @@ r <- welcome_msg;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc