@haneullabs/haneul 2.4.0 → 2.5.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.
Files changed (82) hide show
  1. package/dist/bcs/bcs.mjs +1 -1
  2. package/dist/bcs/bcs.mjs.map +1 -1
  3. package/dist/bcs/index.d.mts +4 -4
  4. package/dist/client/core-resolver.mjs +2 -2
  5. package/dist/client/core-resolver.mjs.map +1 -1
  6. package/dist/client/core.mjs +1 -1
  7. package/dist/client/core.mjs.map +1 -1
  8. package/dist/cryptography/keypair.d.mts +1 -1
  9. package/dist/cryptography/keypair.mjs +3 -3
  10. package/dist/cryptography/keypair.mjs.map +1 -1
  11. package/dist/cryptography/publickey.d.mts +1 -1
  12. package/dist/cryptography/publickey.mjs +2 -2
  13. package/dist/cryptography/publickey.mjs.map +1 -1
  14. package/dist/cryptography/signature.d.mts +6 -6
  15. package/dist/grpc/proto/haneul/rpc/v2/ledger_service.client.d.mts +4 -4
  16. package/dist/grpc/proto/haneul/rpc/v2/move_package_service.client.d.mts +4 -4
  17. package/dist/grpc/proto/haneul/rpc/v2/state_service.client.d.mts +4 -4
  18. package/dist/grpc/proto/haneul/rpc/v2/subscription_service.client.d.mts +4 -4
  19. package/dist/grpc/proto/haneul/rpc/v2/system_state.d.mts +2 -2
  20. package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs +1 -1
  21. package/dist/grpc/proto/haneul/rpc/v2/system_state.mjs.map +1 -1
  22. package/dist/grpc/proto/haneul/rpc/v2/transaction_execution_service.client.d.mts +4 -4
  23. package/dist/jsonRpc/client.d.mts +5 -5
  24. package/dist/jsonRpc/client.d.mts.map +1 -1
  25. package/dist/jsonRpc/client.mjs +56 -56
  26. package/dist/jsonRpc/client.mjs.map +1 -1
  27. package/dist/jsonRpc/core.mjs +6 -6
  28. package/dist/jsonRpc/core.mjs.map +1 -1
  29. package/dist/jsonRpc/index.d.mts +4 -4
  30. package/dist/jsonRpc/index.mjs +2 -2
  31. package/dist/jsonRpc/types/generated.d.mts +14 -14
  32. package/dist/jsonRpc/types/generated.d.mts.map +1 -1
  33. package/dist/jsonRpc/types/index.d.mts +2 -2
  34. package/dist/jsonRpc/types/params.d.mts +8 -8
  35. package/dist/jsonRpc/types/params.d.mts.map +1 -1
  36. package/dist/multisig/publickey.d.mts +1 -1
  37. package/dist/multisig/publickey.mjs +1 -1
  38. package/dist/multisig/publickey.mjs.map +1 -1
  39. package/dist/multisig/signer.mjs +2 -2
  40. package/dist/multisig/signer.mjs.map +1 -1
  41. package/dist/transactions/Commands.mjs +3 -3
  42. package/dist/transactions/Commands.mjs.map +1 -1
  43. package/dist/transactions/executor/caching.mjs +1 -1
  44. package/dist/transactions/executor/caching.mjs.map +1 -1
  45. package/dist/transactions/executor/parallel.mjs +3 -3
  46. package/dist/transactions/executor/parallel.mjs.map +1 -1
  47. package/dist/transactions/executor/serial.mjs +1 -1
  48. package/dist/transactions/executor/serial.mjs.map +1 -1
  49. package/dist/utils/haneul-types.d.mts +2 -2
  50. package/dist/utils/haneul-types.d.mts.map +1 -1
  51. package/dist/utils/haneul-types.mjs +2 -2
  52. package/dist/utils/haneul-types.mjs.map +1 -1
  53. package/dist/utils/index.d.mts +2 -2
  54. package/dist/utils/index.mjs +2 -2
  55. package/dist/verify/verify.mjs +1 -1
  56. package/dist/verify/verify.mjs.map +1 -1
  57. package/dist/zklogin/publickey.d.mts +1 -1
  58. package/dist/zklogin/publickey.d.mts.map +1 -1
  59. package/dist/zklogin/publickey.mjs +9 -9
  60. package/dist/zklogin/publickey.mjs.map +1 -1
  61. package/package.json +199 -199
  62. package/src/bcs/bcs.ts +1 -1
  63. package/src/client/core-resolver.ts +2 -2
  64. package/src/client/core.ts +1 -1
  65. package/src/cryptography/keypair.ts +3 -3
  66. package/src/cryptography/publickey.ts +2 -2
  67. package/src/grpc/proto/haneul/rpc/v2/system_state.ts +3 -3
  68. package/src/jsonRpc/client.ts +57 -57
  69. package/src/jsonRpc/core.ts +7 -7
  70. package/src/jsonRpc/index.ts +1 -1
  71. package/src/jsonRpc/types/generated.ts +13 -13
  72. package/src/jsonRpc/types/params.ts +7 -7
  73. package/src/multisig/publickey.ts +1 -1
  74. package/src/multisig/signer.ts +2 -2
  75. package/src/transactions/Commands.ts +3 -3
  76. package/src/transactions/executor/caching.ts +1 -1
  77. package/src/transactions/executor/parallel.ts +3 -3
  78. package/src/transactions/executor/serial.ts +1 -1
  79. package/src/utils/haneul-types.ts +1 -1
  80. package/src/utils/index.ts +1 -1
  81. package/src/verify/verify.ts +1 -1
  82. package/src/zklogin/publickey.ts +9 -9
@@ -298,7 +298,7 @@ export interface GetDynamicFieldsParams {
298
298
  signal?: AbortSignal;
299
299
  }
300
300
  /** Return the latest HANEUL system state object on-chain. */
301
- export interface GetLatestSuiSystemStateParams {
301
+ export interface GetLatestHaneulSystemStateParams {
302
302
  signal?: AbortSignal;
303
303
  }
304
304
  /**
@@ -329,7 +329,7 @@ export interface GetStakesParams {
329
329
  }
330
330
  /** Return one or more [DelegatedStake]. If a Stake was withdrawn its status will be Unstaked. */
331
331
  export interface GetStakesByIdsParams {
332
- stakedSuiIds: string[];
332
+ stakedHaneulIds: string[];
333
333
  signal?: AbortSignal;
334
334
  }
335
335
  /** Return total supply for a coin */
@@ -503,7 +503,7 @@ export interface UnsafePayParams {
503
503
  * use this first coin as gas coin object. 3. the balance of the first input coin after tx is
504
504
  * sum(input_coins) - actual_gas_cost. 4. all other input coins other than the first are deleted.
505
505
  */
506
- export interface UnsafePayAllSuiParams {
506
+ export interface UnsafePayAllHaneulParams {
507
507
  /** the transaction signer's Haneul address */
508
508
  signer: string;
509
509
  /** the Haneul coins to be used in this transaction, including the coin for gas payment. */
@@ -523,7 +523,7 @@ export interface UnsafePayAllSuiParams {
523
523
  * coin after tx is sum(input_coins) - sum(amounts) - actual_gas_cost 4. all other input coints other
524
524
  * than the first one are deleted.
525
525
  */
526
- export interface UnsafePaySuiParams {
526
+ export interface UnsafePayHaneulParams {
527
527
  /** the transaction signer's Haneul address */
528
528
  signer: string;
529
529
  /** the Haneul coins to be used in this transaction, including the coin for gas payment. */
@@ -576,8 +576,8 @@ export interface UnsafeRequestAddStakeParams {
576
576
  export interface UnsafeRequestWithdrawStakeParams {
577
577
  /** the transaction signer's Haneul address */
578
578
  signer: string;
579
- /** StakedSui object ID */
580
- stakedSui: string;
579
+ /** StakedHaneul object ID */
580
+ stakedHaneul: string;
581
581
  /**
582
582
  * gas object to be used in this transaction, node will pick one from the signer's possession if not
583
583
  * provided
@@ -645,7 +645,7 @@ export interface UnsafeTransferObjectParams {
645
645
  * Create an unsigned transaction to send HANEUL coin object to a Haneul address. The HANEUL object is also used
646
646
  * as the gas object.
647
647
  */
648
- export interface UnsafeTransferSuiParams {
648
+ export interface UnsafeTransferHaneulParams {
649
649
  /** the transaction signer's Haneul address */
650
650
  signer: string;
651
651
  /** the Haneul coin object to be used in this transaction */
@@ -187,7 +187,7 @@ export class MultiSigPublicKey extends PublicKey {
187
187
  /**
188
188
  * Return the Haneul address associated with this MultiSig public key
189
189
  */
190
- override toSuiAddress(): string {
190
+ override toHaneulAddress(): string {
191
191
  // max length = 1 flag byte + (max pk size + max weight size (u8)) * max signer size + 2 threshold bytes (u16)
192
192
  const maxLength = 1 + (64 + 1) * MAX_SIGNER_IN_MULTISIG + 2;
193
193
  const tmp = new Uint8Array(maxLength);
@@ -20,11 +20,11 @@ export class MultiSigSigner extends Signer {
20
20
 
21
21
  const weights = pubkey.getPublicKeys().map(({ weight, publicKey }) => ({
22
22
  weight,
23
- address: publicKey.toSuiAddress(),
23
+ address: publicKey.toHaneulAddress(),
24
24
  }));
25
25
 
26
26
  for (const signer of signers) {
27
- const address = signer.toSuiAddress();
27
+ const address = signer.toHaneulAddress();
28
28
  if (uniqueKeys.has(address)) {
29
29
  throw new Error(`Can't create MultiSigSigner with duplicate signers`);
30
30
  }
@@ -5,7 +5,7 @@ import { toBase64 } from '@haneullabs/bcs';
5
5
  import type { InferInput } from 'valibot';
6
6
  import { parse } from 'valibot';
7
7
 
8
- import { normalizeSuiObjectId } from '../utils/haneul-types.js';
8
+ import { normalizeHaneulObjectId } from '../utils/haneul-types.js';
9
9
  import type { Argument, CallArg, Command } from './data/internal.js';
10
10
  import { ArgumentSchema } from './data/internal.js';
11
11
  import type { AsyncTransactionThunk, Transaction } from './Transaction.js';
@@ -111,7 +111,7 @@ export const TransactionCommands = {
111
111
  modules: modules.map((module) =>
112
112
  typeof module === 'string' ? module : toBase64(new Uint8Array(module)),
113
113
  ),
114
- dependencies: dependencies.map((dep) => normalizeSuiObjectId(dep)),
114
+ dependencies: dependencies.map((dep) => normalizeHaneulObjectId(dep)),
115
115
  },
116
116
  };
117
117
  },
@@ -132,7 +132,7 @@ export const TransactionCommands = {
132
132
  modules: modules.map((module) =>
133
133
  typeof module === 'string' ? module : toBase64(new Uint8Array(module)),
134
134
  ),
135
- dependencies: dependencies.map((dep) => normalizeSuiObjectId(dep)),
135
+ dependencies: dependencies.map((dep) => normalizeHaneulObjectId(dep)),
136
136
  package: packageId,
137
137
  ticket: parse(ArgumentSchema, ticket),
138
138
  },
@@ -95,7 +95,7 @@ export class CachingTransactionExecutor {
95
95
  signer: Signer;
96
96
  include?: Include;
97
97
  }): Promise<HaneulClientTypes.TransactionResult<Include & { effects: true }>> {
98
- transaction.setSenderIfNotSet(signer.toSuiAddress());
98
+ transaction.setSenderIfNotSet(signer.toHaneulAddress());
99
99
  const bytes = await this.buildTransaction({ transaction });
100
100
  const { signature } = await signer.signTransaction(bytes);
101
101
  return this.executeTransaction({
@@ -206,7 +206,7 @@ export class ParallelTransactionExecutor {
206
206
  ): Promise<HaneulClientTypes.TransactionResult<Include & { effects: true }>> {
207
207
  let gasCoin: CoinWithBalance | null = null;
208
208
  try {
209
- transaction.setSenderIfNotSet(this.#signer.toSuiAddress());
209
+ transaction.setSenderIfNotSet(this.#signer.toHaneulAddress());
210
210
 
211
211
  await this.#buildQueue.runTask(async () => {
212
212
  const data = transaction.getData();
@@ -259,7 +259,7 @@ export class ParallelTransactionExecutor {
259
259
  const coin = gasCoin as CoinWithBalance;
260
260
  const gasOwner = gasObject.outputOwner?.AddressOwner ?? gasObject.outputOwner?.ObjectOwner;
261
261
 
262
- if (gasOwner === this.#signer.toSuiAddress()) {
262
+ if (gasOwner === this.#signer.toHaneulAddress()) {
263
263
  const totalUsed =
264
264
  BigInt(gasUsed.computationCost) +
265
265
  BigInt(gasUsed.storageCost) +
@@ -431,7 +431,7 @@ export class ParallelTransactionExecutor {
431
431
  }
432
432
 
433
433
  const txb = new Transaction();
434
- const address = this.#signer.toSuiAddress();
434
+ const address = this.#signer.toHaneulAddress();
435
435
  txb.setSender(address);
436
436
 
437
437
  if (this.#sourceCoins) {
@@ -102,7 +102,7 @@ export class SerialTransactionExecutor {
102
102
  }
103
103
 
104
104
  copy.setGasBudgetIfNotSet(this.#defaultGasBudget);
105
- copy.setSenderIfNotSet(this.#signer.toSuiAddress());
105
+ copy.setSenderIfNotSet(this.#signer.toHaneulAddress());
106
106
 
107
107
  return this.#cache.buildTransaction({ transaction: copy });
108
108
  };
@@ -163,7 +163,7 @@ export function normalizeHaneulAddress(value: string, forceAdd0x: boolean = fals
163
163
  return `0x${address.padStart(HANEUL_ADDRESS_LENGTH * 2, '0')}`;
164
164
  }
165
165
 
166
- export function normalizeSuiObjectId(value: string, forceAdd0x: boolean = false): string {
166
+ export function normalizeHaneulObjectId(value: string, forceAdd0x: boolean = false): string {
167
167
  return normalizeHaneulAddress(value, forceAdd0x);
168
168
  }
169
169
 
@@ -9,7 +9,7 @@ export {
9
9
  isValidTransactionDigest,
10
10
  normalizeStructTag,
11
11
  normalizeHaneulAddress,
12
- normalizeSuiObjectId,
12
+ normalizeHaneulObjectId,
13
13
  parseStructTag,
14
14
  HANEUL_ADDRESS_LENGTH,
15
15
  } from './haneul-types.js';
@@ -129,7 +129,7 @@ export function publicKeyFromRawBytes(
129
129
  throw new Error(`Unsupported signature scheme ${signatureScheme}`);
130
130
  }
131
131
 
132
- if (options.address && publicKey.toSuiAddress() !== options.address) {
132
+ if (options.address && publicKey.toHaneulAddress() !== options.address) {
133
133
  throw new Error(`Public key bytes do not match the provided address`);
134
134
  }
135
135
 
@@ -69,7 +69,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
69
69
  client,
70
70
  });
71
71
 
72
- if (publicKey.toSuiAddress() !== address) {
72
+ if (publicKey.toHaneulAddress() !== address) {
73
73
  publicKey = new ZkLoginPublicIdentifier(normalizeZkLoginPublicKeyBytes(bytes, true), {
74
74
  client,
75
75
  });
@@ -80,7 +80,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
80
80
  });
81
81
  }
82
82
 
83
- if (address && publicKey.toSuiAddress() !== address) {
83
+ if (address && publicKey.toHaneulAddress() !== address) {
84
84
  throw new Error('Public key bytes do not match the provided address');
85
85
  }
86
86
 
@@ -95,7 +95,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
95
95
  legacyAddress: true,
96
96
  });
97
97
 
98
- if (legacyPublicKey.toSuiAddress() === address) {
98
+ if (legacyPublicKey.toHaneulAddress() === address) {
99
99
  return legacyPublicKey;
100
100
  }
101
101
 
@@ -103,7 +103,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
103
103
  legacyAddress: false,
104
104
  });
105
105
 
106
- if (publicKey.toSuiAddress() !== address) {
106
+ if (publicKey.toHaneulAddress() !== address) {
107
107
  throw new Error('Proof does not match address');
108
108
  }
109
109
 
@@ -117,12 +117,12 @@ export class ZkLoginPublicIdentifier extends PublicKey {
117
117
  return super.equals(publicKey);
118
118
  }
119
119
 
120
- override toSuiAddress(): string {
120
+ override toHaneulAddress(): string {
121
121
  if (this.#legacyAddress) {
122
122
  return this.#toLegacyAddress();
123
123
  }
124
124
 
125
- return super.toSuiAddress();
125
+ return super.toHaneulAddress();
126
126
  }
127
127
 
128
128
  #toLegacyAddress() {
@@ -161,7 +161,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
161
161
  */
162
162
  verifyPersonalMessage(message: Uint8Array, signature: Uint8Array | string): Promise<boolean> {
163
163
  const parsedSignature = parseSerializedZkLoginSignature(signature);
164
- const address = new ZkLoginPublicIdentifier(parsedSignature.publicKey).toSuiAddress();
164
+ const address = new ZkLoginPublicIdentifier(parsedSignature.publicKey).toHaneulAddress();
165
165
 
166
166
  return graphqlVerifyZkLoginSignature({
167
167
  address: address,
@@ -177,7 +177,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
177
177
  */
178
178
  verifyTransaction(transaction: Uint8Array, signature: Uint8Array | string): Promise<boolean> {
179
179
  const parsedSignature = parseSerializedZkLoginSignature(signature);
180
- const address = new ZkLoginPublicIdentifier(parsedSignature.publicKey).toSuiAddress();
180
+ const address = new ZkLoginPublicIdentifier(parsedSignature.publicKey).toHaneulAddress();
181
181
  return graphqlVerifyZkLoginSignature({
182
182
  address: address,
183
183
  bytes: toBase64(transaction),
@@ -191,7 +191,7 @@ export class ZkLoginPublicIdentifier extends PublicKey {
191
191
  * Verifies that the public key is associated with the provided address
192
192
  */
193
193
  override verifyAddress(address: string): boolean {
194
- return address === super.toSuiAddress() || address === this.#toLegacyAddress();
194
+ return address === super.toHaneulAddress() || address === this.#toLegacyAddress();
195
195
  }
196
196
  }
197
197