phantasma-sdk-ts 0.1.71 → 0.1.72
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 -16
- package/core/ledger/Mnemonic.js +1 -1
- package/html/phantasma.js +1 -1
- package/package.json +1 -1
- package/src/core/ledger/Mnemonic.ts +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# phantasma-ts
|
|
1
|
+
# phantasma-sdk-ts
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK for the Phantasma blockchain.
|
|
4
4
|
|
|
@@ -7,19 +7,19 @@ A TypeScript SDK for the Phantasma blockchain.
|
|
|
7
7
|
Use the package manager [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install phatasma-ts.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install phantasma-ts
|
|
10
|
+
npm install phantasma-sdk-ts
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Importing
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
const { PhantasmaTS } = require("phantasma-ts");
|
|
16
|
+
const { PhantasmaTS } = require("phantasma-sdk-ts");
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Standalone HTML Import
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
|
-
<script src="https://cdn.jsdelivr.net/
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/phantasma-sdk-ts@latest/html/phantasma.js"></script>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
```javascript
|
|
@@ -101,7 +101,7 @@ These functions, `.CallContract` and `.CallInterop`, are your bread and butter f
|
|
|
101
101
|
|
|
102
102
|
- You can find out all the diffrent `.CallInterop` functions below.
|
|
103
103
|
|
|
104
|
-
- For `.CallContract`, you will have to look through the ABI's of all the diffrent smart contracts currently deployed on the Phantasma 'mainnet': [Link Here](https://explorer.phantasma.
|
|
104
|
+
- For `.CallContract`, you will have to look through the ABI's of all the diffrent smart contracts currently deployed on the Phantasma 'mainnet': [Link Here](https://explorer.phantasma.info/chain/main#tab_contracts)
|
|
105
105
|
|
|
106
106
|
#### Example:
|
|
107
107
|
|
|
@@ -136,10 +136,10 @@ let targetNet = 'main';
|
|
|
136
136
|
// NOTE - we assume RPC was instantiated previously already, check other samples to see how
|
|
137
137
|
let response = await RPC.invokeRawScript(targetNet, script);
|
|
138
138
|
|
|
139
|
-
const decoder = new PhantasmaTS.Decoder(response.result);
|
|
139
|
+
const decoder = new PhantasmaTS.Decoder(response.result);
|
|
140
140
|
const value = decoder.readVmObject();
|
|
141
141
|
console.log(value); // print the decoded value to the console
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
#### Interop Functions:
|
|
@@ -181,14 +181,14 @@ To build a transaction you will first need to build a script.
|
|
|
181
181
|
Note, building a Transaction is for transactional scripts only. Non transactional scripts should use the RPC function `RPC.invokeRawScript(chainInput: string, scriptData: string)`
|
|
182
182
|
|
|
183
183
|
```javascript
|
|
184
|
-
const { PhantasmaTS } = require("phantasma-ts");
|
|
184
|
+
const { PhantasmaTS } = require("phantasma-sdk-ts");
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
async function sendTransaction() {
|
|
188
188
|
|
|
189
|
-
let WIF = "WIF"; //In WIF Format
|
|
190
|
-
let fromAddress = "yourPublicWalletAddress";
|
|
191
|
-
let toAddress = "addressYoureSendingTo";
|
|
189
|
+
let WIF = "WIF"; //In WIF Format
|
|
190
|
+
let fromAddress = "yourPublicWalletAddress";
|
|
191
|
+
let toAddress = "addressYoureSendingTo";
|
|
192
192
|
|
|
193
193
|
//Creating RPC Connection **(Needs To Be Updated)
|
|
194
194
|
let RPC = new PhantasmaTS.PhantasmaAPI(
|
|
@@ -334,9 +334,9 @@ async function deployContract() {
|
|
|
334
334
|
let sb = new PhantasmaTS.ScriptBuilder();
|
|
335
335
|
|
|
336
336
|
//New RPC and Peers Needed
|
|
337
|
-
//Creating RPC Connection, use ('http://testnet.phantasma.
|
|
337
|
+
//Creating RPC Connection, use ('http://testnet.phantasma.info/rpc', null, 'testnet') for testing
|
|
338
338
|
let RPC = new PhantasmaTS.PhantasmaAPI(
|
|
339
|
-
"http://localhost:
|
|
339
|
+
"http://localhost:5172/rpc",
|
|
340
340
|
null,
|
|
341
341
|
"simnet"
|
|
342
342
|
);
|
|
@@ -389,10 +389,10 @@ async function deployContract() {
|
|
|
389
389
|
### Scanning the blockchain for incoming transactions
|
|
390
390
|
|
|
391
391
|
```javascript
|
|
392
|
-
const { PhantasmaTS } = require("phantasma-ts");
|
|
392
|
+
const { PhantasmaTS } = require("phantasma-sdk-ts");
|
|
393
393
|
|
|
394
394
|
let RPC = new PhantasmaTS.PhantasmaAPI(
|
|
395
|
-
"
|
|
395
|
+
"https://pharpc1.phantasma.info/rpc",
|
|
396
396
|
null,
|
|
397
397
|
"mainnet"
|
|
398
398
|
);
|
|
@@ -444,7 +444,7 @@ checkForNewBlocks();
|
|
|
444
444
|
|
|
445
445
|
```javascript
|
|
446
446
|
let RPC = new PhantasmaTS.PhantasmaAPI(
|
|
447
|
-
"
|
|
447
|
+
"https://pharpc1.phantasma.info/rpc",
|
|
448
448
|
null,
|
|
449
449
|
"mainnet"
|
|
450
450
|
);
|
package/core/ledger/Mnemonic.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.GetBip44Path = exports.GetPoltergeistMnemonic = exports.GetPrivateKeyFromSeed = exports.GetPrivateKeyFromMnemonic = exports.SOUL_COIN = void 0;
|
|
5
5
|
var utils_1 = require("../utils");
|
|
6
|
-
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.
|
|
6
|
+
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.info/)
|
|
7
7
|
exports.SOUL_COIN = 60;
|
|
8
8
|
/**
|
|
9
9
|
* converts a mnemonic into a private key, using the phantasma coin's bip44 path.
|
package/html/phantasma.js
CHANGED
|
@@ -1374,7 +1374,7 @@ exports.SignLedger = SignLedger;
|
|
|
1374
1374
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1375
1375
|
exports.GetBip44Path = exports.GetPoltergeistMnemonic = exports.GetPrivateKeyFromSeed = exports.GetPrivateKeyFromMnemonic = exports.SOUL_COIN = void 0;
|
|
1376
1376
|
var utils_1 = require("../utils");
|
|
1377
|
-
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.
|
|
1377
|
+
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.info/)
|
|
1378
1378
|
exports.SOUL_COIN = 60;
|
|
1379
1379
|
/**
|
|
1380
1380
|
* converts a mnemonic into a private key, using the phantasma coin's bip44 path.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { bufferToHex, hexToBuffer } from '../utils';
|
|
4
4
|
import { LedgerConfig } from './interfaces/LedgerConfig';
|
|
5
5
|
|
|
6
|
-
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.
|
|
6
|
+
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.info/)
|
|
7
7
|
export const SOUL_COIN: number = 60;
|
|
8
8
|
|
|
9
9
|
/**
|