@ton-wallet/create 14.0.1
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/LICENSE +9 -0
- package/README.md +78 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-2023 Whales Corp.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# TON JS Client
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ton)
|
|
4
|
+
|
|
5
|
+
Cross-platform client for TON blockchain.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🚀 Create new wallets
|
|
10
|
+
- 🍰 Get balance
|
|
11
|
+
- ✈️ Transfers
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @ton/ton @ton/crypto @ton/core buffer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Browser polyfill
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// Add before using library
|
|
23
|
+
require("buffer");
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To use this library you need HTTP API endpoint, you can use one of the public endpoints:
|
|
29
|
+
|
|
30
|
+
- Mainnet: https://toncenter.com/api/v2/jsonRPC
|
|
31
|
+
- Testnet: https://testnet.toncenter.com/api/v2/jsonRPC
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { TonClient, WalletContractV4, internal } from "@ton/ton";
|
|
35
|
+
import { mnemonicNew, mnemonicToPrivateKey } from "@ton/crypto";
|
|
36
|
+
|
|
37
|
+
// Create Client
|
|
38
|
+
const client = new TonClient({
|
|
39
|
+
endpoint: 'https://toncenter.com/api/v2/jsonRPC',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Generate new key
|
|
43
|
+
let mnemonics = await mnemonicNew();
|
|
44
|
+
let keyPair = await mnemonicToPrivateKey(mnemonics);
|
|
45
|
+
|
|
46
|
+
// Create wallet contract
|
|
47
|
+
let workchain = 0; // Usually you need a workchain 0
|
|
48
|
+
let wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey });
|
|
49
|
+
let contract = client.open(wallet);
|
|
50
|
+
|
|
51
|
+
// Get balance
|
|
52
|
+
let balance: bigint = await contract.getBalance();
|
|
53
|
+
|
|
54
|
+
// Create a transfer
|
|
55
|
+
let seqno: number = await contract.getSeqno();
|
|
56
|
+
let transfer = await contract.createTransfer({
|
|
57
|
+
seqno,
|
|
58
|
+
secretKey: keyPair.secretKey,
|
|
59
|
+
messages: [internal({
|
|
60
|
+
value: '1.5',
|
|
61
|
+
to: 'EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N',
|
|
62
|
+
body: 'Hello world',
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Docs
|
|
69
|
+
|
|
70
|
+
[Documentation](https://ton-community.github.io/ton/)
|
|
71
|
+
|
|
72
|
+
## Acknowledgements
|
|
73
|
+
|
|
74
|
+
This library is developed by the [Whales Corp.](https://tonwhales.com/) and maintained by [Dan Volkov](https://github.com/dvlkv).
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ton-wallet/create",
|
|
3
|
+
"version": "14.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/ton-org/ton.git"
|
|
7
|
+
},
|
|
8
|
+
"author": "Whales Corp. <developers@whalescorp.com>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"docs": "rm -fr docs && typedoc src/index.ts",
|
|
16
|
+
"build": "rm -fr dist && tsc --declaration",
|
|
17
|
+
"test": "jest --verbose --runInBand",
|
|
18
|
+
"release": "yarn build && yarn release-it --npm.yarn1"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@release-it/keep-a-changelog": "^5.0.0",
|
|
22
|
+
"@ton/core": "^0.56.0",
|
|
23
|
+
"@ton/crypto": "3.2.0",
|
|
24
|
+
"@ton/emulator": "^2.1.1",
|
|
25
|
+
"@types/jest": "^27.0.1",
|
|
26
|
+
"@types/node": "^16.7.10",
|
|
27
|
+
"buffer": "^6.0.3",
|
|
28
|
+
"expect": "^27.1.0",
|
|
29
|
+
"jest": "^27.1.0",
|
|
30
|
+
"jest-mock": "^27.1.0",
|
|
31
|
+
"karma": "^6.3.4",
|
|
32
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
33
|
+
"karma-jasmine": "^4.0.1",
|
|
34
|
+
"karma-typescript": "^5.5.2",
|
|
35
|
+
"karma-webpack": "^5.0.0",
|
|
36
|
+
"prando": "^6.0.1",
|
|
37
|
+
"release-it": "^17.1.1",
|
|
38
|
+
"ts-jest": "^27.0.5",
|
|
39
|
+
"ts-loader": "^9.2.5",
|
|
40
|
+
"ts-node": "^10.7.0",
|
|
41
|
+
"node-telegram-bot-api": "^0.66.0",
|
|
42
|
+
"typedoc": "^0.23.24",
|
|
43
|
+
"typescript": "^4.4.2",
|
|
44
|
+
"webpack": "^5.51.2"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"axios": "^1.6.7",
|
|
48
|
+
"dataloader": "^2.0.0",
|
|
49
|
+
"symbol.inspect": "1.0.1",
|
|
50
|
+
"teslabot": "^1.3.0",
|
|
51
|
+
"zod": "^3.21.4"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@ton/core": ">=0.56.0",
|
|
55
|
+
"@ton/crypto": ">=3.2.0"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"release-it": {
|
|
62
|
+
"github": {
|
|
63
|
+
"release": true
|
|
64
|
+
},
|
|
65
|
+
"plugins": {
|
|
66
|
+
"@release-it/keep-a-changelog": {
|
|
67
|
+
"filename": "CHANGELOG.md"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"packageManager": "yarn@3.4.1",
|
|
72
|
+
"description": "This is an entry point script for the Blueprint development tool npm create ton",
|
|
73
|
+
"keywords": [
|
|
74
|
+
"@ton/create"
|
|
75
|
+
],
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/ton-org/ton/issues"
|
|
78
|
+
},
|
|
79
|
+
"homepage": "https://github.com/ton-org/ton#readme"
|
|
80
|
+
}
|