conseiljs
Advanced tools
Comparing version 5.0.8 to 5.0.9-beta.0
@@ -17,2 +17,6 @@ import { KeyStore, Signer } from '../../../types/ExternalInterfaces'; | ||
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>; | ||
function getAccountPoolShare(server: string, address: string, account: string): Promise<{ | ||
token: number; | ||
xtz: number; | ||
}>; | ||
function getAccountAllowance(server: string, mapid: number, account: string, spender: string): Promise<any>; | ||
@@ -19,0 +23,0 @@ function addLiquidity(server: string, signer: Signer, keyStore: KeyStore, contract: string, fee: number, liquidityAmount: number, xtzAmount: number, tokenAmount: number, expiration: Date): Promise<string>; |
@@ -51,9 +51,9 @@ "use strict"; | ||
balanceMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].int', json: storageResult })[0]), | ||
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[0].args[0].string', json: storageResult })[0], | ||
token: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[0].args[1].string', json: storageResult })[0], | ||
tokenBalance: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[1].args[1].int', json: storageResult })[0]), | ||
xtzBalance: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[1].args[0].int', json: storageResult })[0]), | ||
selfIsUpdatingTokenPool: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[0].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'), | ||
freeze_baker: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[1].args[0].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'), | ||
lqt_total: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[1].args[1].int', json: storageResult })[0]) | ||
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[2].args[0].string', json: storageResult })[0], | ||
token: jsonpath_plus_1.JSONPath({ path: '$.args[2].args[1].string', json: storageResult })[0], | ||
tokenBalance: Number(jsonpath_plus_1.JSONPath({ path: '$.args[3].int', json: storageResult })[0]), | ||
xtzBalance: Number(jsonpath_plus_1.JSONPath({ path: '$.args[4].int', json: storageResult })[0]), | ||
selfIsUpdatingTokenPool: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'), | ||
freeze_baker: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'), | ||
lqt_total: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[2].int', json: storageResult })[0]) | ||
}; | ||
@@ -80,2 +80,23 @@ }); | ||
DexterPoolHelper.getAccountBalance = getAccountBalance; | ||
function getAccountPoolShare(server, address, account) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const storage = yield getSimpleStorage(server, address); | ||
const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, 'address'), 'hex')); | ||
const mapResult = yield TezosNodeReader_1.TezosNodeReader.getValueForBigMapKey(server, storage.balanceMap, packedKey); | ||
if (mapResult === undefined) { | ||
throw new Error(`Map ${storage.balanceMap} does not contain a record for ${account}`); | ||
} | ||
const poolBalance = big_integer_1.default(jsonpath_plus_1.JSONPath({ path: '$.args[0].int', json: mapResult })[0]); | ||
const poolTotal = big_integer_1.default(storage.lqt_total); | ||
const tokenBalance = big_integer_1.default(storage.tokenBalance); | ||
const xtzBalance = big_integer_1.default(storage.xtzBalance); | ||
return { token: tokenBalance.multiply(poolBalance).divide(poolTotal).toJSNumber(), xtz: xtzBalance.multiply(poolBalance).divide(poolTotal).toJSNumber() }; | ||
} | ||
catch (error) { | ||
return { token: 0, xtz: 0 }; | ||
} | ||
}); | ||
} | ||
DexterPoolHelper.getAccountPoolShare = getAccountPoolShare; | ||
function getAccountAllowance(server, mapid, account, spender) { | ||
@@ -82,0 +103,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -34,3 +34,3 @@ import { KeyStore, Signer } from '../../../types/ExternalInterfaces'; | ||
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>; | ||
function transferBalance(nodeUrl: string, signer: Signer, keystore: KeyStore, tokenContractAddress: string, fee: number, sourceAddress: string, destinationAddress: string, amount: number, gasLimit?: number, storageLimit?: number): Promise<string>; | ||
function transferBalance(nodeUrl: string, signer: Signer, keystore: KeyStore, tokenContractAddress: string, fee: number, sourceAddress: string, destinationAddress: string, amount: number | string, gasLimit?: number, storageLimit?: number): Promise<string>; | ||
function depositToOven(nodeUrl: string, signer: Signer, keystore: KeyStore, ovenAddress: string, fee: number, amountMutez: number, gasLimit?: number, storageLimit?: number): Promise<string>; | ||
@@ -37,0 +37,0 @@ function withdrawFromOven(nodeUrl: string, signer: Signer, keystore: KeyStore, ovenAddress: string, fee: number, amountMutez: number, gasLimit?: number, storageLimit?: number): Promise<string>; |
@@ -32,3 +32,3 @@ "use strict"; | ||
_: /[ \t]+/, | ||
quotedValue: /"(?:\\["\\]|[^\n"\\])*"/s | ||
quotedValue: /"(?:[^"\\]|\\.)*"/s | ||
}); | ||
@@ -45,5 +45,5 @@ const staticIntToHex = d => { | ||
text = text.substring(1, text.length - 1); | ||
text = text.replace(/\\"/g, '"'); | ||
text = text.replace(/\\"/g, '"').replace(/\\n/g, '\n').replace(/\\\\/g, '\\'); | ||
const len = encodeLength(text.length); | ||
text = text.split('').map(c => c.charCodeAt(0).toString(16)).join(''); | ||
text = text.split('').map(c => c.charCodeAt(0).toString(16).padStart(2, "0")).join(''); | ||
return prefix + len + text; | ||
@@ -50,0 +50,0 @@ }; |
@@ -56,3 +56,3 @@ "use strict"; | ||
word: /[a-zA-Z_0-9]+/, | ||
string: /"(?:\\["\\]|[^\n"\\])*"/s | ||
string: /"(?:[^"\\]|\\.)*"/s | ||
}); | ||
@@ -436,14 +436,2 @@ const checkC_R = c_r => { | ||
const dipnToJson = d => (d.length > 4) ? `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" }, [ ${d[4]} ] ] }` : `{ "prim": "${d[0]}", "args": [ ${d[2]} ] }`; | ||
const dupnToJson = d => { | ||
const n = Number(d[2]); | ||
if (n === 1) { | ||
return '{ "prim": "DUP" }'; | ||
} | ||
else if (n === 2) { | ||
return '[{ "prim": "DIP", "args": [[ {"prim": "DUP"} ]] }, { "prim": "SWAP" }]'; | ||
} | ||
else { | ||
return `[{ "prim": "DIP", "args": [ {"int": "${n - 1}"}, [{ "prim": "DUP" }] ] }, { "prim": "DIG", "args": [ {"int": "${n}"} ] }]`; | ||
} | ||
}; | ||
const dignToJson = d => `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" } ] }`; | ||
@@ -687,3 +675,3 @@ const dropnToJson = d => `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" } ] }`; | ||
{ "name": "instruction$ebnf$10", "symbols": ["instruction$ebnf$10", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }, "_", "instruction$ebnf$10"], "postprocess": dupnToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }, "_", "instruction$ebnf$10"], "postprocess": dignToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }], "postprocess": keywordToJson }, | ||
@@ -690,0 +678,0 @@ { "name": "instruction$ebnf$11$subexpression$1", "symbols": ["_", (lexer.has("annot") ? { type: "annot" } : annot)] }, |
@@ -420,3 +420,3 @@ "use strict"; | ||
storageCost += parseInt(result['paid_storage_size_diff']) || 0; | ||
if (result.kind === 'origination' || c['metadata']['operation_result']['allocated_destination_contract']) { | ||
if (internalOperation.kind === 'origination') { | ||
storageCost += TezosConstants_1.TezosConstants.EmptyAccountStorageBurn; | ||
@@ -423,0 +423,0 @@ } |
@@ -307,3 +307,5 @@ "use strict"; | ||
q = ConseilQueryBuilder_1.ConseilQueryBuilder.setLimit(q, 1000); | ||
return { entity: OPERATIONS, query: ConseilQueryBuilder_1.ConseilQueryBuilder.addPredicate(q, 'operation_group_hash', QueryTypes_1.ConseilOperator.EQ, [id], false) }; | ||
q = ConseilQueryBuilder_1.ConseilQueryBuilder.addPredicate(q, 'operation_group_hash', QueryTypes_1.ConseilOperator.EQ, [id], false); | ||
q = ConseilQueryBuilder_1.ConseilQueryBuilder.addOrdering(q, 'nonce', QueryTypes_1.ConseilSortDirection.DESC); | ||
return { entity: OPERATIONS, query: q }; | ||
} | ||
@@ -310,0 +312,0 @@ } |
{ | ||
"name": "conseiljs", | ||
"version": "5.0.8", | ||
"version": "5.0.9-beta.0", | ||
"description": "Client-side library for Tezos dApp development.", | ||
@@ -101,3 +101,3 @@ "browser": "dist/index-web.js", | ||
"tsconfig-paths-webpack-plugin": "3.3.0", | ||
"typedoc": "^0.20.32", | ||
"typedoc": "0.18.0", | ||
"typedoc-plugin-markdown": "2.4.2", | ||
@@ -104,0 +104,0 @@ "typescript": "3.8.3", |
@@ -62,3 +62,3 @@ # ConseilJS-core | ||
<script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs/dist-web/conseiljs.min.js" | ||
integrity="sha384-sEYMVfIFpMORsZMgO4YyC0/fVSRBZjbkCYnA5A6HxBpKbxhbLG475Ru1hOjWSK7f" | ||
integrity="sha384-bUmP+mbBKqeLslTLtJkngVuA+nVFgEmFy1dkKraoJEHOUGvVRK/cIfhwnFWRM2Lv" | ||
crossorigin="anonymous"></script> | ||
@@ -65,0 +65,0 @@ <script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs-softsigner/dist-web/conseiljs-softsigner.min.js" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
805034
7699
1