@initia/initia.js 0.2.18 → 0.2.20

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 (44) hide show
  1. package/README.md +13 -13
  2. package/dist/client/LocalInitia.d.ts +3 -3
  3. package/dist/client/index.d.ts +4 -4
  4. package/dist/client/{lcd/LCDClient.d.ts → rest/RESTClient.d.ts} +6 -4
  5. package/dist/client/{lcd → rest}/Wallet.d.ts +4 -4
  6. package/dist/client/{lcd → rest}/api/TxAPI.d.ts +3 -3
  7. package/dist/core/tx/Tx.d.ts +1 -1
  8. package/dist/index.cjs.js +2 -2
  9. package/dist/index.es.js +593 -588
  10. package/dist/key/MnemonicKey.d.ts +1 -0
  11. package/dist/key/RawKey.d.ts +2 -1
  12. package/package.json +3 -7
  13. /package/dist/client/{lcd → rest}/APIRequester.d.ts +0 -0
  14. /package/dist/client/{lcd → rest}/api/AuctionAPI.d.ts +0 -0
  15. /package/dist/client/{lcd → rest}/api/AuthAPI.d.ts +0 -0
  16. /package/dist/client/{lcd → rest}/api/AuthzAPI.d.ts +0 -0
  17. /package/dist/client/{lcd → rest}/api/BankAPI.d.ts +0 -0
  18. /package/dist/client/{lcd → rest}/api/BaseAPI.d.ts +0 -0
  19. /package/dist/client/{lcd → rest}/api/DistributionAPI.d.ts +0 -0
  20. /package/dist/client/{lcd → rest}/api/EvidenceAPI.d.ts +0 -0
  21. /package/dist/client/{lcd → rest}/api/EvmAPI.d.ts +0 -0
  22. /package/dist/client/{lcd → rest}/api/FeeGrantAPI.d.ts +0 -0
  23. /package/dist/client/{lcd → rest}/api/ForwardingAPI.d.ts +0 -0
  24. /package/dist/client/{lcd → rest}/api/GovAPI.d.ts +0 -0
  25. /package/dist/client/{lcd → rest}/api/GroupAPI.d.ts +0 -0
  26. /package/dist/client/{lcd → rest}/api/IbcAPI.d.ts +0 -0
  27. /package/dist/client/{lcd → rest}/api/IbcHooksAPI.d.ts +0 -0
  28. /package/dist/client/{lcd → rest}/api/IbcNftAPI.d.ts +0 -0
  29. /package/dist/client/{lcd → rest}/api/IbcPermAPI.d.ts +0 -0
  30. /package/dist/client/{lcd → rest}/api/IbcTransferAPI.d.ts +0 -0
  31. /package/dist/client/{lcd → rest}/api/InterTxAPI.d.ts +0 -0
  32. /package/dist/client/{lcd → rest}/api/MarketmapAPI.d.ts +0 -0
  33. /package/dist/client/{lcd → rest}/api/MoveAPI.d.ts +0 -0
  34. /package/dist/client/{lcd → rest}/api/MstakingAPI.d.ts +0 -0
  35. /package/dist/client/{lcd → rest}/api/OpchildAPI.d.ts +0 -0
  36. /package/dist/client/{lcd → rest}/api/OphostAPI.d.ts +0 -0
  37. /package/dist/client/{lcd → rest}/api/OracleAPI.d.ts +0 -0
  38. /package/dist/client/{lcd → rest}/api/RewardAPI.d.ts +0 -0
  39. /package/dist/client/{lcd → rest}/api/SlashingAPI.d.ts +0 -0
  40. /package/dist/client/{lcd → rest}/api/TendermintAPI.d.ts +0 -0
  41. /package/dist/client/{lcd → rest}/api/TokenfactoryAPI.d.ts +0 -0
  42. /package/dist/client/{lcd → rest}/api/UpgradeAPI.d.ts +0 -0
  43. /package/dist/client/{lcd → rest}/api/WasmAPI.d.ts +0 -0
  44. /package/dist/client/{lcd → rest}/api/index.d.ts +0 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ Initia.js is a TypeScript-written JavaScript SDK tailored for the Initia blockch
4
4
  ## Main Features
5
5
  - **Improved TypeScript Definitions**: Offers comprehensive integration with Initia core data structures for an enhanced developer experience.
6
6
  - **Core Layer**: Includes key management, BCS serialization, and support for initia.proto.
7
- - **Client Layer**: Facilitates API request generation and LCD provider interaction.
7
+ - **Client Layer**: Facilitates API request generation and REST provider interaction.
8
8
 
9
9
 
10
10
  ## Installation
@@ -19,15 +19,15 @@ npm install @initia/initia.js
19
19
 
20
20
  The usage section of this document provides detailed explanations and code examples of the most commonly used classes of the Initia.js library, which can be utilized both in a Node.js environment and within a browser.
21
21
 
22
- ### LCD client 
22
+ ### REST client 
23
23
 
24
- **LCD**(Light Client Daemon) class facilitates interaction with the Initia blockchain.
24
+ **REST**(previously LCD) class facilitates interaction with the Initia blockchain.
25
25
 
26
26
  ```typescript
27
- import { LCDClient } from '@initia/initia.js';
27
+ import { RESTClient } from '@initia/initia.js';
28
28
 
29
- const lcd = new LCDClient('https://lcd.mahalo-1.initia.xyz', {
30
- chainId: 'mahalo-1',
29
+ const rest = new RESTClient('https://rest.testnet.initia.xyz', {
30
+ chainId: 'initiation-2',
31
31
  gasPrices: '0.15uinit', // default gas prices
32
32
  gasAdjustment: '1.75', // default gas adjustment for fee estimation
33
33
  });
@@ -159,20 +159,20 @@ const msg = new MsgExecute(
159
159
  Create a wallet and sign transaction.  
160
160
 
161
161
  ```typescript
162
- import { Wallet, LCDClient, MnemonicKey } from '@initia/initia.js';
162
+ import { Wallet, RESTClient, MnemonicKey } from '@initia/initia.js';
163
163
 
164
164
  const key = new MnemonicKey({
165
165
  mnemonic:
166
166
  'moral wise tape glance grit gentle movie doll omit you pet soon enter year funny gauge digital supply cereal city ring egg repair coyote',
167
167
  });
168
168
 
169
- const lcd = new LCDClient('https://lcd.mahalo-1.initia.xyz', {
170
- chainId: 'mahalo-1',
169
+ const rest = new RESTClient('https://rest.testnet.initia.xyz', {
170
+ chainId: 'initiation-2',
171
171
  gasPrices: '0.15uinit', // default gas prices
172
172
  gasAdjustment: '1.75', // default gas adjustment for fee estimation
173
173
  });
174
174
 
175
- const wallet = new Wallet(lcd, key);
175
+ const wallet = new Wallet(rest, key);
176
176
 
177
177
  const sendMsg = new MsgSend(
178
178
  'init14l3c2vxrdvu6y0sqykppey930s4kufsvt97aeu', // sender address
@@ -193,7 +193,7 @@ When sending coins with `MsgSend`, sender address should be same with wallet add
193
193
  `broadcast()` is the action that sends your transaction to the blockchain code.
194
194
 
195
195
  ```typescript
196
- const broadcastResult = await lcd.tx.broadcast(signedTx);
196
+ const broadcastResult = await rest.tx.broadcast(signedTx);
197
197
  ```
198
198
 
199
199
  ### Queries 
@@ -203,7 +203,7 @@ const broadcastResult = await lcd.tx.broadcast(signedTx);
203
203
  Query the balance of the account.
204
204
 
205
205
  ```typescript
206
- const balances = await lcd.bank.balance('init14l3c2vxrdvu6y0sqykppey930s4kufsvt97aeu');
206
+ const balances = await rest.bank.balance('init14l3c2vxrdvu6y0sqykppey930s4kufsvt97aeu');
207
207
  ```
208
208
 
209
209
  * `viewfunction()`
@@ -211,7 +211,7 @@ const balances = await lcd.bank.balance('init14l3c2vxrdvu6y0sqykppey930s4kufsvt9
211
211
  Obtain the return values of a Move view function.
212
212
 
213
213
  ```typescript
214
- const res = await lcd.move.viewFunction(
214
+ const res = await rest.move.viewFunction(
215
215
  '0x1', // owner of the module
216
216
  'dex', // name of the module
217
217
  'get_swap_simulation', // function name
@@ -1,6 +1,6 @@
1
- import { LCDClient } from './lcd/LCDClient';
2
- import { Wallet } from './lcd/Wallet';
3
- export declare class LocalInitia extends LCDClient {
1
+ import { RESTClient } from './rest/RESTClient';
2
+ import { Wallet } from './rest/Wallet';
3
+ export declare class LocalInitia extends RESTClient {
4
4
  wallets: {
5
5
  validator: Wallet;
6
6
  test1: Wallet;
@@ -1,6 +1,6 @@
1
- export * from './lcd/APIRequester';
2
- export * from './lcd/LCDClient';
3
- export * from './lcd/Wallet';
4
- export * from './lcd/api';
1
+ export * from './rest/APIRequester';
2
+ export * from './rest/RESTClient';
3
+ export * from './rest/Wallet';
4
+ export * from './rest/api';
5
5
  export * from './LocalInitia';
6
6
  export * from './WebSocketClient';
@@ -3,14 +3,14 @@ import { AuctionAPI, AuthAPI, AuthzAPI, BankAPI, DistributionAPI, EvidenceAPI, E
3
3
  import { Wallet } from './Wallet';
4
4
  import { Coins } from '../../core';
5
5
  import { Key } from '../../key';
6
- export interface LCDClientConfig {
6
+ export interface RESTClientConfig {
7
7
  chainId?: string;
8
8
  gasPrices?: Coins.Input;
9
9
  gasAdjustment?: string;
10
10
  }
11
- export declare class LCDClient {
11
+ export declare class RESTClient {
12
12
  URL: string;
13
- config: LCDClientConfig;
13
+ config: RESTClientConfig;
14
14
  apiRequester: APIRequester;
15
15
  auction: AuctionAPI;
16
16
  auth: AuthAPI;
@@ -42,6 +42,8 @@ export declare class LCDClient {
42
42
  tx: TxAPI;
43
43
  upgrade: UpgradeAPI;
44
44
  wasm: WasmAPI;
45
- constructor(URL: string, config?: LCDClientConfig, apiRequester?: APIRequester);
45
+ constructor(URL: string, config?: RESTClientConfig, apiRequester?: APIRequester);
46
46
  wallet(key: Key): Wallet;
47
47
  }
48
+ export declare class LCDClient extends RESTClient {
49
+ }
@@ -1,13 +1,13 @@
1
- import { LCDClient } from './LCDClient';
1
+ import { RESTClient } from './RESTClient';
2
2
  import { Key } from '../../key';
3
- import { CreateTxOptions } from '../lcd/api/TxAPI';
3
+ import { CreateTxOptions } from './api/TxAPI';
4
4
  import { Tx } from '../../core';
5
5
  import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing';
6
6
  export declare class Wallet {
7
- lcd: LCDClient;
7
+ rest: RESTClient;
8
8
  key: Key;
9
9
  private accAddress;
10
- constructor(lcd: LCDClient, key: Key);
10
+ constructor(rest: RESTClient, key: Key);
11
11
  setAccountAddress(accAddress: string): void;
12
12
  accountNumberAndSequence(): Promise<{
13
13
  account_number: number;
@@ -1,6 +1,6 @@
1
1
  import { BaseAPI } from './BaseAPI';
2
2
  import { Msg, Tx, Coins, TxInfo, Fee, PublicKey, TxLog, Event } from '../../../core';
3
- import { LCDClient } from '../LCDClient';
3
+ import { RESTClient } from '../RESTClient';
4
4
  import { APIParams, Pagination, PaginationOptions } from '../APIRequester';
5
5
  interface Wait {
6
6
  height: number;
@@ -162,8 +162,8 @@ export interface TxSearchOptions extends PaginationOptions {
162
162
  query: TxSearchQuery[];
163
163
  }
164
164
  export declare class TxAPI extends BaseAPI {
165
- lcd: LCDClient;
166
- constructor(lcd: LCDClient);
165
+ rest: RESTClient;
166
+ constructor(rest: RESTClient);
167
167
  txInfo(txHash: string, params?: APIParams): Promise<TxInfo>;
168
168
  create(signers: SignerOptions[], options: CreateTxOptions): Promise<Tx>;
169
169
  txInfosByHeight(height: number | undefined): Promise<TxInfo[]>;
@@ -6,7 +6,7 @@ import { CompactBitArray } from './CompactBitArray';
6
6
  import { Msg } from '../Msg';
7
7
  import { Fee } from './Fee';
8
8
  import { SignatureV2 } from './SignatureV2';
9
- import { SignerData } from '../../client/lcd/api/TxAPI';
9
+ import { SignerData } from '../../client';
10
10
  export declare class Tx {
11
11
  body: TxBody;
12
12
  auth_info: AuthInfo;