Ver código fonte

update xrpl to 4.0.0

master
nitowa 1 semana atrás
pai
commit
94a006496a
5 arquivos alterados com 457 adições e 288 exclusões
  1. 434
    266
      package-lock.json
  2. 2
    1
      package.json
  3. 7
    4
      src/xrpIO/xrpl-binding.ts
  4. 13
    16
      test/CONSTANTS.ts
  5. 1
    1
      test/primitives.ts

+ 434
- 266
package-lock.json
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 2
- 1
package.json Ver arquivo

@@ -33,8 +33,9 @@
33 33
   "author": "nitowa",
34 34
   "license": "MIT",
35 35
   "dependencies": {
36
+    "axios": "^1.7.7",
36 37
     "ripple-lib": "^1.10.0",
37
-    "xrpl": "^2.7.0"
38
+    "xrpl": "^4.0.0"
38 39
   },
39 40
   "devDependencies": {
40 41
     "@types/chai": "^4.2.21",

+ 7
- 4
src/xrpIO/xrpl-binding.ts Ver arquivo

@@ -116,7 +116,8 @@ export class xrpIO {
116 116
       throw new Error(`Insufficient funds to send transaction. See tx ${response.result.hash}`)
117 117
     }
118 118
     
119
-    this.dbg("Tx finalized", response.result.hash, response.result.Sequence)
119
+    
120
+    this.dbg("Tx finalized", response.result.hash, response.result.tx_json.Sequence)
120 121
     return response
121 122
 
122 123
   }
@@ -187,11 +188,13 @@ export class xrpIO {
187 188
     }
188 189
     const tx = await this.getTransaction(hash)
189 190
 
190
-    if(verifyOwner && tx.result.Account != verifyOwner){
191
-      throw new CannotVerifyOwnerError(hash, tx.result.Account, verifyOwner)
191
+    
192
+
193
+    if(verifyOwner && tx.result.tx_json.Account != verifyOwner){
194
+      throw new CannotVerifyOwnerError(hash, tx.result.tx_json.Account, verifyOwner)
192 195
     }
193 196
 
194
-    const memo = tx.result.Memos[0].Memo
197
+    const memo = tx.result.tx_json.Memos[0].Memo
195 198
     const memoParsed = {
196 199
       data: hexDecode(memo.MemoData),
197 200
       format: hexDecode(memo.MemoFormat),

+ 13
- 16
test/CONSTANTS.ts Ver arquivo

@@ -1,3 +1,4 @@
1
+import axios from 'axios';
1 2
 import { Wallet } from "../src/util/types";
2 3
 import { readFileSync } from 'fs'
3 4
 const Path = require('path')
@@ -7,22 +8,18 @@ export const TEST_CONFIG = {
7 8
 }
8 9
 export const TEST_DATA = "test123123"
9 10
 
10
-import fetch from 'node-fetch';
11
-
12
-export const makeTestnetWallet = () : Promise<Wallet> => fetch('https://faucet.altnet.rippletest.net/accounts', {
13
-    method: 'POST',
14
-    headers: {
15
-        'Accept': 'application/json',
16
-        'Content-Type': 'application/json'
17
-    },
18
-}).then((raw:any) => {
19
-    return raw.json().then(content => {
20
-        return({
21
-            secret: content.account.secret,
22
-            address: content.account.address
23
-        });
24
-    })
25
-});
11
+export const makeTestnetWallet = async () : Promise<Wallet> => {
12
+    try{
13
+        const response = await axios.post('https://faucet.altnet.rippletest.net/accounts', {})
14
+        return ({
15
+            secret: response.data.seed,
16
+            address: response.data.account.address
17
+        })
18
+    
19
+    }catch(e){
20
+        console.log(e)
21
+    }
22
+}
26 23
 
27 24
 export const htmlTxt = readFileSync(Path.resolve(__dirname, '..', '..', 'test', 'index.html')).toString('ascii')
28 25
 

+ 1
- 1
test/primitives.ts Ver arquivo

@@ -155,7 +155,7 @@ describe('XRPIO', () => {
155 155
     })
156 156
 
157 157
     it('sends even if rate limit exceeded', async function(){
158
-        this.timeout(10 * 60 * 1000) //10m
158
+        this.timeout(100 * 60 * 1000) //100m
159 159
         console.log("Testing if sending past rate limits correctly recovers and finishes. This may take a while.")
160 160
         await api.treeWrite(htmlTxt, receiveWallet.address, sendWallet.secret)
161 161
         console.log("1/7")

Carregando…
Cancelar
Salvar