near-api-ts 0.2.0 → 0.2.2
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.
- package/README.md +16 -4
- package/dist/index.cjs +56 -1428
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -145
- package/dist/index.d.ts +145 -145
- package/dist/index.js +52 -1417
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
## NEAR API TS
|
|
2
2
|
Typescript library for interactions with Near Protocol in the browser or Node.js
|
|
3
3
|
|
|
4
|
+
[GitHub Repository](https://github.com/eclipseeer/near-api-ts/tree/main)
|
|
5
|
+
|
|
4
6
|
**Installation**
|
|
5
7
|
```text
|
|
6
|
-
pnpm add
|
|
8
|
+
pnpm add near-api-ts
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
**Node.js (esm) / Browser**
|
|
11
|
+
**Node.js (esm, 22+) / Browser**
|
|
10
12
|
|
|
11
13
|
```ts
|
|
12
14
|
import {
|
|
@@ -15,10 +17,19 @@ import {
|
|
|
15
17
|
createMemorySigner,
|
|
16
18
|
testnet,
|
|
17
19
|
transfer,
|
|
18
|
-
} from '
|
|
20
|
+
} from 'near-api-ts';
|
|
19
21
|
|
|
22
|
+
// Create a near client
|
|
20
23
|
const client = createClient({ network: testnet });
|
|
21
24
|
|
|
25
|
+
|
|
26
|
+
// Read some data from the chain
|
|
27
|
+
await client.getAccountState({
|
|
28
|
+
accountId: 'testnet',
|
|
29
|
+
atMomentOf: 'LatestFinalBlock',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Send some transaction
|
|
22
33
|
const keyService = await createMemoryKeyService({
|
|
23
34
|
keySource: { privateKey: 'ed25519:your-private-key' } ,
|
|
24
35
|
});
|
|
@@ -35,4 +46,5 @@ await signer.executeTransaction({
|
|
|
35
46
|
});
|
|
36
47
|
```
|
|
37
48
|
|
|
38
|
-
You may found more examples in the
|
|
49
|
+
You may found more examples in the [examples/nodejs/ts-esm](https://github.com/eclipseeer/near-api-ts/tree/main/examples/nodejs/ts-esm)
|
|
50
|
+
folder
|