@ton/ton 14.0.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ class WalletContractV5Beta {
19
19
  static create(args) {
20
20
  const walletId = {
21
21
  networkGlobalId: args.walletId?.networkGlobalId ?? -239,
22
- workChain: args?.walletId?.workChain ?? 0,
22
+ workchain: args?.walletId?.workchain ?? 0,
23
23
  subwalletNumber: args?.walletId?.subwalletNumber ?? 0,
24
24
  walletVersion: args?.walletId?.walletVersion ?? 'v5'
25
25
  };
@@ -38,7 +38,7 @@ class WalletContractV5Beta {
38
38
  .storeBit(0) // Empty plugins dict
39
39
  .endCell();
40
40
  this.init = { code, data };
41
- this.address = (0, core_1.contractAddress)(this.walletId.workChain, { code, data });
41
+ this.address = (0, core_1.contractAddress)(this.walletId.workchain, { code, data });
42
42
  }
43
43
  /**
44
44
  * Get Wallet Balance
@@ -94,7 +94,7 @@ describe('WalletContractV5Beta', () => {
94
94
  });
95
95
  it('should add extension', async () => {
96
96
  const extensionKey = (0, randomTestKey_1.randomTestKey)('v5-treasure-extension');
97
- const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workChain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
97
+ const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workchain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
98
98
  let seqno = await wallet.getSeqno();
99
99
  const extensions = await getExtensionsArray(wallet);
100
100
  const extensionAlreadyAdded = extensions.some(address => address.equals(extensionContract.address));
@@ -143,7 +143,7 @@ describe('WalletContractV5Beta', () => {
143
143
  }, 60000);
144
144
  it('should remove extension', async () => {
145
145
  const extensionKey = (0, randomTestKey_1.randomTestKey)('v5-treasure-extension');
146
- const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workChain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
146
+ const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workchain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
147
147
  const seqno = await wallet.getSeqno();
148
148
  const extensions = await getExtensionsArray(wallet);
149
149
  const extensionAlreadyAdded = extensions.some(address => address.equals(extensionContract.address));
@@ -157,7 +157,7 @@ describe('WalletContractV5Beta', () => {
157
157
  });
158
158
  it('should send internal transfer via relayer', async () => {
159
159
  const relaerKey = (0, randomTestKey_1.randomTestKey)('v5-treasure-relayer');
160
- const relayerContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workChain: 0, networkGlobalId: -3 }, publicKey: relaerKey.publicKey }));
160
+ const relayerContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workchain: 0, networkGlobalId: -3 }, publicKey: relaerKey.publicKey }));
161
161
  const seqno = await wallet.getSeqno();
162
162
  const relayerSeqno = await relayerContract.getSeqno();
163
163
  await relayerContract.sendTransfer({
@@ -185,7 +185,7 @@ describe('WalletContractV5Beta', () => {
185
185
  it('should disable secret key auth, send extension-auth tx, and enable it again', async () => {
186
186
  /* firstly add an extension that will take the control over the wallet */
187
187
  const extensionKey = (0, randomTestKey_1.randomTestKey)('v5-treasure-extension');
188
- const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workChain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
188
+ const extensionContract = client.open(WalletContractV5Beta_1.WalletContractV5Beta.create({ walletId: { workchain: 0, networkGlobalId: -3 }, publicKey: extensionKey.publicKey }));
189
189
  let seqno = await wallet.getSeqno();
190
190
  const extensions = await getExtensionsArray(wallet);
191
191
  const extensionAlreadyAdded = extensions.some(address => address.equals(extensionContract.address));
@@ -6,7 +6,7 @@ export interface WalletIdV5Beta {
6
6
  * -239 is mainnet, -3 is testnet
7
7
  */
8
8
  readonly networkGlobalId: number;
9
- readonly workChain: number;
9
+ readonly workchain: number;
10
10
  readonly subwalletNumber: number;
11
11
  }
12
12
  export declare function loadWalletIdV5Beta(value: bigint | Buffer | Slice): WalletIdV5Beta;
@@ -10,20 +10,20 @@ function loadWalletIdV5Beta(value) {
10
10
  Buffer.from(value.toString(16), 'hex') :
11
11
  value instanceof core_1.Slice ? value.loadBuffer(10) : value, 0, 80));
12
12
  const networkGlobalId = bitReader.loadInt(32);
13
- const workChain = bitReader.loadInt(8);
13
+ const workchain = bitReader.loadInt(8);
14
14
  const walletVersionRaw = bitReader.loadUint(8);
15
15
  const subwalletNumber = bitReader.loadUint(32);
16
16
  const walletVersion = Object.entries(walletV5BetaVersionsSerialisation).find(([_, value]) => value === walletVersionRaw)?.[0];
17
17
  if (walletVersion === undefined) {
18
18
  throw new Error(`Can't deserialize walletId: unknown wallet version ${walletVersionRaw}`);
19
19
  }
20
- return { networkGlobalId, workChain, walletVersion, subwalletNumber };
20
+ return { networkGlobalId, workchain, walletVersion, subwalletNumber };
21
21
  }
22
22
  exports.loadWalletIdV5Beta = loadWalletIdV5Beta;
23
23
  function storeWalletIdV5Beta(walletId) {
24
24
  return (builder) => {
25
25
  builder.storeInt(walletId.networkGlobalId, 32);
26
- builder.storeInt(walletId.workChain, 8);
26
+ builder.storeInt(walletId.workchain, 8);
27
27
  builder.storeUint(walletV5BetaVersionsSerialisation[walletId.walletVersion], 8);
28
28
  builder.storeUint(walletId.subwalletNumber, 32);
29
29
  };
@@ -7,13 +7,13 @@ describe('Wallet V5Beta wallet id', () => {
7
7
  const walletId = {
8
8
  walletVersion: 'v5',
9
9
  networkGlobalId: -239,
10
- workChain: 0,
10
+ workchain: 0,
11
11
  subwalletNumber: 0
12
12
  };
13
13
  const actual = (0, core_1.beginCell)().store((0, WalletV5BetaWalletId_1.storeWalletIdV5Beta)(walletId)).endCell();
14
14
  const expected = (0, core_1.beginCell)()
15
15
  .storeInt(walletId.networkGlobalId, 32)
16
- .storeInt(walletId.workChain, 8)
16
+ .storeInt(walletId.workchain, 8)
17
17
  .storeUint(0, 8)
18
18
  .storeUint(walletId.subwalletNumber, 32)
19
19
  .endCell();
@@ -23,12 +23,12 @@ describe('Wallet V5Beta wallet id', () => {
23
23
  const expected = {
24
24
  walletVersion: 'v5',
25
25
  networkGlobalId: -239,
26
- workChain: 0,
26
+ workchain: 0,
27
27
  subwalletNumber: 0
28
28
  };
29
29
  const actual = (0, WalletV5BetaWalletId_1.loadWalletIdV5Beta)((0, core_1.beginCell)()
30
30
  .storeInt(expected.networkGlobalId, 32)
31
- .storeInt(expected.workChain, 8)
31
+ .storeInt(expected.workchain, 8)
32
32
  .storeUint(0, 8)
33
33
  .storeUint(expected.subwalletNumber, 32)
34
34
  .endCell().beginParse());
@@ -38,13 +38,13 @@ describe('Wallet V5Beta wallet id', () => {
38
38
  const walletId = {
39
39
  walletVersion: 'v5',
40
40
  networkGlobalId: -3,
41
- workChain: -1,
41
+ workchain: -1,
42
42
  subwalletNumber: 1234
43
43
  };
44
44
  const actual = (0, core_1.beginCell)().store((0, WalletV5BetaWalletId_1.storeWalletIdV5Beta)(walletId)).endCell();
45
45
  const expected = (0, core_1.beginCell)()
46
46
  .storeInt(walletId.networkGlobalId, 32)
47
- .storeInt(walletId.workChain, 8)
47
+ .storeInt(walletId.workchain, 8)
48
48
  .storeUint(0, 8)
49
49
  .storeUint(walletId.subwalletNumber, 32)
50
50
  .endCell();
@@ -54,12 +54,12 @@ describe('Wallet V5Beta wallet id', () => {
54
54
  const expected = {
55
55
  walletVersion: 'v5',
56
56
  networkGlobalId: -239,
57
- workChain: -1,
57
+ workchain: -1,
58
58
  subwalletNumber: 1
59
59
  };
60
60
  const actual = (0, WalletV5BetaWalletId_1.loadWalletIdV5Beta)((0, core_1.beginCell)()
61
61
  .storeInt(expected.networkGlobalId, 32)
62
- .storeInt(expected.workChain, 8)
62
+ .storeInt(expected.workchain, 8)
63
63
  .storeUint(0, 8)
64
64
  .storeUint(expected.subwalletNumber, 32)
65
65
  .endCell().beginParse());
@@ -39,7 +39,7 @@ export declare class WalletContractV5R1 implements Contract {
39
39
  walletId?: Maybe<WalletIdV5R1<C>>;
40
40
  publicKey: Buffer;
41
41
  } : {
42
- workChain?: number;
42
+ workchain?: number;
43
43
  publicKey: Buffer;
44
44
  walletId?: Maybe<Partial<WalletIdV5R1<C>>>;
45
45
  }): WalletContractV5R1;
@@ -13,23 +13,23 @@ const createWalletTransfer_1 = require("../signing/createWalletTransfer");
13
13
  const WalletV5R1WalletId_1 = require("./WalletV5R1WalletId");
14
14
  class WalletContractV5R1 {
15
15
  static create(args) {
16
- let workChain = 0;
17
- if ('workChain' in args && args.workChain != undefined) {
18
- workChain = args.workChain;
16
+ let workchain = 0;
17
+ if ('workchain' in args && args.workchain != undefined) {
18
+ workchain = args.workchain;
19
19
  }
20
- if (args.walletId?.context && (0, WalletV5R1WalletId_1.isWalletIdV5R1ClientContext)(args.walletId.context) && args.walletId.context.workChain != undefined) {
21
- workChain = args.walletId.context.workChain;
20
+ if (args.walletId?.context && (0, WalletV5R1WalletId_1.isWalletIdV5R1ClientContext)(args.walletId.context) && args.walletId.context.workchain != undefined) {
21
+ workchain = args.walletId.context.workchain;
22
22
  }
23
- return new WalletContractV5R1(workChain, args.publicKey, {
23
+ return new WalletContractV5R1(workchain, args.publicKey, {
24
24
  networkGlobalId: args.walletId?.networkGlobalId ?? -239,
25
25
  context: args.walletId?.context ?? {
26
- workChain: 0,
26
+ workchain: 0,
27
27
  walletVersion: 'v5r1',
28
28
  subwalletNumber: 0
29
29
  }
30
30
  });
31
31
  }
32
- constructor(workChain, publicKey, walletId) {
32
+ constructor(workchain, publicKey, walletId) {
33
33
  this.publicKey = publicKey;
34
34
  this.walletId = walletId;
35
35
  this.walletId = walletId;
@@ -43,7 +43,7 @@ class WalletContractV5R1 {
43
43
  .storeBit(0) // Empty plugins dict
44
44
  .endCell();
45
45
  this.init = { code, data };
46
- this.address = (0, core_1.contractAddress)(workChain, { code, data });
46
+ this.address = (0, core_1.contractAddress)(workchain, { code, data });
47
47
  }
48
48
  /**
49
49
  * Get Wallet Balance
@@ -31,7 +31,7 @@ export interface WalletIdV5R1<C extends WalletIdV5R1ClientContext | WalletIdV5R1
31
31
  }
32
32
  export interface WalletIdV5R1ClientContext {
33
33
  readonly walletVersion: 'v5r1';
34
- readonly workChain: number;
34
+ readonly workchain: number;
35
35
  readonly subwalletNumber: number;
36
36
  }
37
37
  /**
@@ -21,7 +21,7 @@ function loadWalletIdV5R1(value, networkGlobalId) {
21
21
  const bitReader = (0, core_1.beginCell)().storeInt(context, 32).endCell().beginParse();
22
22
  const isClientContext = bitReader.loadUint(1);
23
23
  if (isClientContext) {
24
- const workChain = bitReader.loadInt(8);
24
+ const workchain = bitReader.loadInt(8);
25
25
  const walletVersionRaw = bitReader.loadUint(8);
26
26
  const subwalletNumber = bitReader.loadUint(15);
27
27
  const walletVersion = Object.entries(walletV5R1VersionsSerialisation).find(([_, value]) => value === walletVersionRaw)?.[0];
@@ -32,7 +32,7 @@ function loadWalletIdV5R1(value, networkGlobalId) {
32
32
  networkGlobalId,
33
33
  context: {
34
34
  walletVersion,
35
- workChain,
35
+ workchain,
36
36
  subwalletNumber
37
37
  }
38
38
  };
@@ -52,7 +52,7 @@ function storeWalletIdV5R1(walletId) {
52
52
  if (isWalletIdV5R1ClientContext(walletId.context)) {
53
53
  context = (0, core_1.beginCell)()
54
54
  .storeUint(1, 1)
55
- .storeInt(walletId.context.workChain, 8)
55
+ .storeInt(walletId.context.workchain, 8)
56
56
  .storeUint(walletV5R1VersionsSerialisation[walletId.context.walletVersion], 8)
57
57
  .storeUint(walletId.context.subwalletNumber, 15)
58
58
  .endCell().beginParse().loadInt(32);
@@ -8,14 +8,14 @@ describe('Wallet V5R1 wallet id', () => {
8
8
  networkGlobalId: -239,
9
9
  context: {
10
10
  walletVersion: 'v5r1',
11
- workChain: 0,
11
+ workchain: 0,
12
12
  subwalletNumber: 0
13
13
  }
14
14
  };
15
15
  const actual = (0, core_1.beginCell)().store((0, WalletV5R1WalletId_1.storeWalletIdV5R1)(walletId)).endCell();
16
16
  const context = (0, core_1.beginCell)()
17
17
  .storeUint(1, 1)
18
- .storeInt(walletId.context.workChain, 8)
18
+ .storeInt(walletId.context.workchain, 8)
19
19
  .storeUint(0, 8)
20
20
  .storeUint(walletId.context.subwalletNumber, 15)
21
21
  .endCell().beginParse().loadInt(32);
@@ -27,13 +27,13 @@ describe('Wallet V5R1 wallet id', () => {
27
27
  networkGlobalId: -239,
28
28
  context: {
29
29
  walletVersion: 'v5r1',
30
- workChain: 0,
30
+ workchain: 0,
31
31
  subwalletNumber: 0
32
32
  }
33
33
  };
34
34
  const context = (0, core_1.beginCell)()
35
35
  .storeUint(1, 1)
36
- .storeInt(expected.context.workChain, 8)
36
+ .storeInt(expected.context.workchain, 8)
37
37
  .storeUint(0, 8)
38
38
  .storeUint(expected.context.subwalletNumber, 15)
39
39
  .endCell().beginParse().loadInt(32);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/ton",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "repository": "https://github.com/ton-org/ton.git",
5
5
  "author": "Whales Corp. <developers@whalescorp.com>",
6
6
  "license": "MIT",