@rosen-chains/cardano
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -59,4 +59,10 @@ import { CardanoUtxo, CardanoBoxCandidate, CardanoAsset } from './types'; | ||
static createTransactionOutput: (assets: AssetBalance, address: string) => CardanoWasm.TransactionOutput; | ||
/** | ||
* verifies that txId doesn't start with zero | ||
* @param txId | ||
* @returns | ||
*/ | ||
static isTxIdValid: (txId: string) => boolean; | ||
} | ||
export default CardanoUtils; | ||
//# sourceMappingURL=CardanoUtils.d.ts.map |
@@ -116,4 +116,10 @@ import { ChainUtils, } from '@rosen-chains/abstract-chain'; | ||
}; | ||
/** | ||
* verifies that txId doesn't start with zero | ||
* @param txId | ||
* @returns | ||
*/ | ||
static isTxIdValid = (txId) => txId[0] !== '0'; | ||
} | ||
export default CardanoUtils; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FyZGFub1V0aWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL0NhcmRhbm9VdGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBRUwsVUFBVSxHQUVYLE1BQU0sOEJBQThCLENBQUM7QUFDdEMsT0FBTyxLQUFLLFdBQVcsTUFBTSwwQ0FBMEMsQ0FBQztBQUd4RSxNQUFNLFlBQVk7SUFDaEI7Ozs7T0FJRztJQUNILE1BQU0sQ0FBQyxlQUFlLEdBQUcsQ0FBQyxRQUFnQixFQUFFLFNBQWlCLEVBQUUsRUFBRSxDQUMvRCxHQUFHLFFBQVEsSUFBSSxTQUFTLEVBQUUsQ0FBQztJQUU3Qjs7OztPQUlHO0lBQ0gsTUFBTSxDQUFDLFVBQVUsR0FBRyxDQUFDLEtBQW1CLEVBQUUsRUFBRSxDQUMxQyxJQUFJLENBQUMsZUFBZSxDQUFDLEtBQUssQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLFVBQVUsQ0FBQyxDQUFD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bnN0IGJveEFzc2V0cyA9IGJveFZhbHVlLm11bHRpYXNzZXQoKTtcbiAgICBpZiAoYm94QXNzZXRzKSB7XG4gICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJveEFzc2V0cy5rZXlzKCkubGVuKCk7IGkrKykge1xuICAgICAgICBjb25zdCBzY3JpcHRIYXNoID0gYm94QXNzZXRzLmtleXMoKS5nZXQoaSk7XG4gICAgICAgIGNvbnN0IGFzc2V0ID0gYm94QXNzZXRzLmdldChzY3JpcHRIYXNoKSE7XG4gICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgYXNzZXQua2V5cygpLmxlbigpOyBqKyspIHtcbiAgICAgICAgICBjb25zdCBhc3NldE5hbWUgPSBhc3NldC5rZXlzKCkuZ2V0KGopO1xuICAgICAgICAgIGNvbnN0IGFzc2V0QW1vdW50ID0gYXNzZXQuZ2V0KGFzc2V0TmFtZSkhO1xuICAgICAgICAgIHRva2Vucy5wdXNoKHtcbiAgICAgICAgICAgIGlkOiB0aGlzLmdlbmVyYXRlQXNzZXRJZChcbiAgICAgICAgICAgICAgc2NyaXB0SGFzaC50b19oZXgoKSxcbiAgICAgICAgICAgICAgdGhpcy5hc3NldE5hbWVUb0hleChhc3NldE5hbWUpXG4gICAgICAgICAgICApLFxuICAgICAgICAgICAgdmFsdWU6IEJpZ0ludChhc3NldEFtb3VudC50b19zdHIoKSksXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHtcbiAgICAgIG5hdGl2ZVRva2VuOiBCaWdJbnQoYm94VmFsdWUuY29pbigpLnRvX3N0cigpKSxcbiAgICAgIHRva2VuczogdG9rZW5zLFxuICAgIH07XG4gIH07XG5cbiAgLyoqXG4gICAqIGNvbnZlcnRzIGJpZ2ludCB0byBCaWdOdW1cbiAgICogQHBhcmFtIHZhbHVlIGJpZ2ludCB2YWx1ZVxuICAgKi9cbiAgc3RhdGljIGJpZ0ludFRvQmlnTnVtID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WQuc3BsaXQoJy4nKTtcbiAgICAgIGNvbnN0IHBvbGljeUlkOiBDYXJkYW5vV2FzbS5TY3JpcHRIYXNoID0gQ2FyZGFub1dhc20uU2NyaXB0SGFzaC5mcm9tX2hleChcbiAgICAgICAgYXNzZXRJbmZvWzBdXG4gICAgICApO1xuICAgICAgY29uc3QgYXNzZXROYW1lOiBDYXJkYW5vV2FzbS5Bc3NldE5hbWUgPSBDYXJkYW5vV2FzbS5Bc3NldE5hbWUubmV3KFxuICAgICAgICBCdWZmZXIuZnJvbShhc3NldEluZm9bMV0sICdoZXgnKVxuICAgICAgKTtcbiAgICAgIGNoYW5nZUJveE11bHRpQXNzZXQuc2V0X2Fzc2V0KFxuICAgICAgICBwb2xpY3lJZCxcbiAgICAgICAgYXNzZXROYW1lLFxuICAgICAgICBDYXJkYW5vVXRpbHMuYmlnSW50VG9CaWdOdW0oYXNzZXQudmFsdWUpXG4gICAgICApO1xuICAgIH0pO1xuXG4gICAgY29uc3QgY2hhbmdlQW1vdW50OiBDYXJkYW5vV2FzbS5WYWx1ZSA9IENhcmRhbm9XYXNtLlZhbHVlLm5ldyhcbiAgICAgIENhcmRhbm9XYXNtLkJpZ051bS5mcm9tX3N0cihhc3NldHMubmF0aXZlVG9rZW4udG9TdHJpbmcoKSlcbiAgICApO1xuICAgIGNoYW5nZUFtb3VudC5zZXRfbXVsdGlhc3NldChjaGFuZ2VCb3hNdWx0aUFzc2V0KTtcbiAgICByZXR1cm4gQ2FyZGFub1dhc20uVHJhbnNhY3Rpb25PdXRwdXQubmV3KFxuICAgICAgQ2FyZGFub1dhc20uQWRkcmVzcy5mcm9tX2JlY2gzMihhZGRyZXNzKSxcbiAgICAgIGNoYW5nZUFtb3VudFxuICAgICk7XG4gIH07XG59XG5cbmV4cG9ydCBkZWZhdWx0IENhcmRhbm9VdGlscztcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FyZGFub1V0aWxzLm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c2V0X2Fzc2V0KFxuICAgICAgICBwb2xpY3lJZCxcbiAgICAgICAgYXNzZXROYW1lLFxuICAgICAgICBDYXJkYW5vVXRpbHMuYmlnSW50VG9CaWdOdW0oYXNzZXQudmFsdWUpXG4gICAgICApO1xuICAgIH0pO1xuXG4gICAgY29uc3QgY2hhbmdlQW1vdW50OiBDYXJkYW5vV2FzbS5WYWx1ZSA9IENhcmRhbm9XYXNtLlZhbHVlLm5ldyhcbiAgICAgIENhcmRhbm9XYXNtLkJpZ051bS5mcm9tX3N0cihhc3NldHMubmF0aXZlVG9rZW4udG9TdHJpbmcoKSlcbiAgICApO1xuICAgIGNoYW5nZUFtb3VudC5zZXRfbXVsdGlhc3NldChjaGFuZ2VCb3hNdWx0aUFzc2V0KTtcbiAgICByZXR1cm4gQ2FyZGFub1dhc20uVHJhbnNhY3Rpb25PdXRwdXQubmV3KFxuICAgICAgQ2FyZGFub1dhc20uQWRkcmVzcy5mcm9tX2JlY2gzMihhZGRyZXNzKSxcbiAgICAgIGNoYW5nZUFtb3VudFxuICAgICk7XG4gIH07XG5cbiAgLyoqXG4gICAqIHZlcmlmaWVzIHRoYXQgdHhJZCBkb2Vzbid0IHN0YXJ0IHdpdGggemVyb1xuICAgKiBAcGFyYW0gdHhJZFxuICAgKiBAcmV0dXJuc1xuICAgKi9cbiAgc3RhdGljIGlzVHhJZFZhbGlkID0gKHR4SWQ6IHN0cmluZyk6IGJvb2xlYW4gPT4gdHhJZFswXSAhPT0gJzAnO1xufVxuXG5leHBvcnQgZGVmYXVsdCBDYXJkYW5vVXRpbHM7XG4iXX0= |
@@ -250,2 +250,3 @@ import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs'; | ||
).toString('hex'); | ||
if (!CardanoUtils.isTxIdValid(txId)) throw Error(`Invalid txId: [${txId}]`); | ||
@@ -354,4 +355,5 @@ const cardanoTx = new CardanoTransaction( | ||
// extract input box assets | ||
for (let i = 0; i < cardanoTx.inputUtxos.length; i++) { | ||
const input = JSONBigInt.parse(cardanoTx.inputUtxos[i]) as CardanoUtxo; | ||
const inputUtxos = Array.from(new Set(cardanoTx.inputUtxos)); | ||
for (let i = 0; i < inputUtxos.length; i++) { | ||
const input = JSONBigInt.parse(inputUtxos[i]) as CardanoUtxo; | ||
const boxAssets = this.getBoxInfo(input).assets; | ||
@@ -454,2 +456,5 @@ inputAssets = ChainUtils.sumAssetBalance(inputAssets, boxAssets); | ||
): Promise<boolean> => { | ||
// check if txId is valid | ||
if (!CardanoUtils.isTxIdValid(transaction.txId)) return false; | ||
const tx = Serializer.deserialize(transaction.txBytes); | ||
@@ -472,3 +477,9 @@ const txBody = tx.body(); | ||
} | ||
return true; | ||
// check if input and output assets match | ||
const txAssets = await this.getTransactionAssets(transaction); | ||
return ChainUtils.isEqualAssetBalance( | ||
txAssets.inputAssets, | ||
txAssets.outputAssets | ||
); | ||
}; | ||
@@ -475,0 +486,0 @@ |
@@ -164,4 +164,11 @@ import { CardanoUtxo, CardanoBoxCandidate, CardanoAsset } from './types'; | ||
}; | ||
/** | ||
* verifies that txId doesn't start with zero | ||
* @param txId | ||
* @returns | ||
*/ | ||
static isTxIdValid = (txId: string): boolean => txId[0] !== '0'; | ||
} | ||
export default CardanoUtils; |
{ | ||
"name": "@rosen-chains/cardano", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "this project contains cardano chain for Rosen-bridge", | ||
@@ -27,3 +27,3 @@ "main": "dist/lib/index.js", | ||
"@rosen-bridge/json-bigint": "^0.1.0", | ||
"@rosen-chains/abstract-chain": "^3.2.1", | ||
"@rosen-chains/abstract-chain": "^3.2.2", | ||
"bech32": "^2.0.0", | ||
@@ -30,0 +30,0 @@ "blake2b": "^2.1.3" |
@@ -448,2 +448,26 @@ import { RosenTokens, TokenMap } from '@rosen-bridge/tokens'; | ||
}); | ||
/** | ||
* @target CardanoChain.getTransactionAssets should skip duplicate inputs | ||
* @dependencies | ||
* @scenario | ||
* - mock PaymentTransaction | ||
* - call the function | ||
* - check returned value | ||
* @expected | ||
* - it should return mocked transaction assets (both input and output assets) | ||
*/ | ||
it('should skip duplicate inputs', async () => { | ||
// mock PaymentTransaction | ||
const paymentTx = CardanoTransaction.fromJson( | ||
TestData.transaction6PaymentTransaction | ||
); | ||
// call the function | ||
const cardanoChain = generateChainObject(network); | ||
// check returned value | ||
const result = await cardanoChain.getTransactionAssets(paymentTx); | ||
expect(result.inputAssets).toEqual(TestData.transaction6InputAssets); | ||
}); | ||
}); | ||
@@ -784,3 +808,3 @@ | ||
const payment1 = CardanoTransaction.fromJson( | ||
TestData.transaction1PaymentTransaction | ||
TestData.transaction5PaymentTransaction | ||
); | ||
@@ -879,2 +903,68 @@ | ||
}); | ||
/** | ||
* @target CardanoChain.isTxValid should return false when | ||
* input and output assets do not match | ||
* @dependencies | ||
* @scenario | ||
* - mock PaymentTransaction | ||
* - mock a network object to return as valid for all inputs of a mocked | ||
* transaction | ||
* - mock currentSlot of cardano network | ||
* - call the function | ||
* - check returned value | ||
* @expected | ||
* - it should return false | ||
*/ | ||
it('should return false when input and output assets do not match', async () => { | ||
// mock PaymentTransaction | ||
const payment1 = CardanoTransaction.fromJson( | ||
TestData.transaction6PaymentTransaction | ||
); | ||
// mock a network object to return as valid for all inputs of a mocked transaction | ||
const isBoxUnspentAndValidSpy = spyOn(network, 'isBoxUnspentAndValid'); | ||
const txInputs = Transaction.from_bytes(payment1.txBytes).body().inputs(); | ||
for (let i = 0; i < txInputs.len(); i++) { | ||
when(isBoxUnspentAndValidSpy) | ||
.calledWith(CardanoUtils.getBoxId(txInputs.get(i))) | ||
.mockResolvedValueOnce(true); | ||
} | ||
// mock get current slot of cardano network | ||
const currentSlotSpy = spyOn(network, 'currentSlot'); | ||
currentSlotSpy.mockResolvedValue(100); | ||
// call the function | ||
const cardanoChain = generateChainObject(network); | ||
const result = await cardanoChain.isTxValid(payment1); | ||
// check returned value | ||
expect(result).toEqual(false); | ||
}); | ||
/** | ||
* @target CardanoChain.isTxValid should return false when | ||
* txId is invalid | ||
* @dependencies | ||
* @scenario | ||
* - mock PaymentTransaction | ||
* - call the function | ||
* - check returned value | ||
* @expected | ||
* - it should return false | ||
*/ | ||
it('should return false when txId is invalid', async () => { | ||
// mock PaymentTransaction | ||
const payment1 = CardanoTransaction.fromJson( | ||
TestData.transaction7PaymentTransaction | ||
); | ||
// call the function | ||
const cardanoChain = generateChainObject(network); | ||
const result = await cardanoChain.isTxValid(payment1); | ||
// check returned value | ||
expect(result).toEqual(false); | ||
}); | ||
}); | ||
@@ -881,0 +971,0 @@ |
@@ -245,6 +245,6 @@ import { | ||
"inputUtxos": [ | ||
"{\\"txId\\":\\"2d10e4c431dc9d6f35319720ba6fa9d1973fa4e4d9802fd1cae01540d1b1b9e3\\",\\"index\\":0,\\"value\\":10000,\\"assets\\":[{\\"policy_id\\":\\"ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286\\",\\"asset_name\\":\\"5273744552477654657374\\",\\"quantity\\":1000}]}", | ||
"{\\"txId\\":\\"f5bbdeba6cc2ef8eac2fb24879d3a11df3b067a4fc5d1559ccf2ae21f0129631\\",\\"index\\":2,\\"value\\":10000,\\"assets\\":[{\\"policy_id\\":\\"ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286\\",\\"asset_name\\":\\"5273744552477654657374\\",\\"quantity\\":1000}]}", | ||
"{\\"txId\\":\\"92d99216cefcf40ff63f223061cf111950bed5c21da459ab540f439a92b8e942\\",\\"index\\":0,\\"value\\":10000,\\"assets\\":[{\\"policy_id\\":\\"ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286\\",\\"asset_name\\":\\"5273744552477654657374\\",\\"quantity\\":1000}]}", | ||
"{\\"txId\\":\\"ecb1361fba075163d41bd38bb532ffd0a6e0c1971d15c28c3f002c9282a420e4\\",\\"index\\":0,\\"value\\":10000,\\"assets\\":[{\\"policy_id\\":\\"ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286\\",\\"asset_name\\":\\"5273744552477654657374\\",\\"quantity\\":1000}]}" | ||
"{\\"txId\\":\\"2d10e4c431dc9d6f35319720ba6fa9d1973fa4e4d9802fd1cae01540d1b1b9e3\\",\\"index\\":0,\\"value\\":110002500,\\"assets\\":[{\\"policy_id\\":\\"ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286\\",\\"asset_name\\":\\"5273744552477654657374\\",\\"quantity\\":1000}]}", | ||
"{\\"txId\\":\\"f5bbdeba6cc2ef8eac2fb24879d3a11df3b067a4fc5d1559ccf2ae21f0129631\\",\\"index\\":2,\\"value\\":10002500,\\"assets\\":[{\\"policy_id\\":\\"48d4a14b8407af8407702df3afda4cc8a945ce55235e9808c62c5f9b\\",\\"asset_name\\":\\"5273744572676f546f6b656e7654657374\\",\\"quantity\\":5000}]}", | ||
"{\\"txId\\":\\"92d99216cefcf40ff63f223061cf111950bed5c21da459ab540f439a92b8e942\\",\\"index\\":0,\\"value\\":10002500,\\"assets\\":[]}", | ||
"{\\"txId\\":\\"ecb1361fba075163d41bd38bb532ffd0a6e0c1971d15c28c3f002c9282a420e4\\",\\"index\\":0,\\"value\\":10002500,\\"assets\\":[{\\"policy_id\\":\\"cfd784ccfe5fe8ce7d09f4ddb65624378cc8022bf3ec240cf41ea6be\\",\\"asset_name\\":\\"43617264616e6f546f6b656e7654657374\\",\\"quantity\\":100}]}" | ||
] | ||
@@ -276,8 +276,16 @@ } | ||
export const transaction1InputAssets: AssetBalance = { | ||
nativeToken: 40000n, | ||
nativeToken: 140010000n, | ||
tokens: [ | ||
{ | ||
id: 'ef6aa6200e21634e58ce6796b4b61d1d7d059d2ebe93c2996eeaf286.5273744552477654657374', | ||
value: 4000n, | ||
value: 1000n, | ||
}, | ||
{ | ||
id: '48d4a14b8407af8407702df3afda4cc8a945ce55235e9808c62c5f9b.5273744572676f546f6b656e7654657374', | ||
value: 5000n, | ||
}, | ||
{ | ||
id: 'cfd784ccfe5fe8ce7d09f4ddb65624378cc8022bf3ec240cf41ea6be.43617264616e6f546f6b656e7654657374', | ||
value: 100n, | ||
}, | ||
], | ||
@@ -477,1 +485,40 @@ }; | ||
`; | ||
export const transaction6PaymentTransaction = ` | ||
{ | ||
"network": "cardano", | ||
"eventId": "ececb5bf27e372aee4b6c65432935e2eb0285312507cb772cc41351c53785f0a", | ||
"txBytes": "84a40081825820b56b1dea42bc97a1186cf84f9311730a87d99355a54234679e40acec00111c3c0101828258390188acfdee735ac7f2ef2f887eb55ac5d1e9fb6550ca32d1c8c3fa9d0175f1d4c7297a02b4aab7505c3f16020e65952e4ef517c95da2e60be2821a002dc6c0a1581c04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14a145727352534e1a0096ad7182581d61ec0b8a9fb34c0d9c0bb4ebf434a9a9caf63e5aeb5924eed4b17bbe57821b00000001e8f50f7ea1581c04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14a24572734552471b000002444f78871045727352534e1a00020b63021a00061a80031a06b8cbada100818258205565c1c7a962d88e5e37754ae015fb96db11cca92719f6086fa7d8e514a9e65e5840fa9af840860e619eddfe80709d61e88c0289f9c5456047321264a146b6acfcbc12a013b4b88f2e175aa73ab1c53c38da3f43e67d7242ed07c17f6515e7bde608f5f6", | ||
"txId": "d6c74b0d597e68a4264dfc2e2c4e2429354c0fba2ca7d075ef9f8b53c01fad8a", | ||
"txType": "payment", | ||
"inputUtxos": [ | ||
"{\\"txId\\":\\"b56b1dea42bc97a1186cf84f9311730a87d99355a54234679e40acec00111c3c\\",\\"index\\":1,\\"value\\":4103370847,\\"assets\\":[{\\"policy_id\\":\\"04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14\\",\\"asset_name\\":\\"7273455247\\",\\"quantity\\":1246207165320},{\\"policy_id\\":\\"04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14\\",\\"asset_name\\":\\"727352534e\\",\\"quantity\\":5004394}]}", | ||
"{\\"txId\\":\\"b56b1dea42bc97a1186cf84f9311730a87d99355a54234679e40acec00111c3c\\",\\"index\\":1,\\"value\\":4103370847,\\"assets\\":[{\\"policy_id\\":\\"04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14\\",\\"asset_name\\":\\"7273455247\\",\\"quantity\\":1246207165320},{\\"policy_id\\":\\"04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14\\",\\"asset_name\\":\\"727352534e\\",\\"quantity\\":5004394}]}" | ||
] | ||
} | ||
`; | ||
export const transaction6InputAssets: AssetBalance = { | ||
nativeToken: 4103370847n, | ||
tokens: [ | ||
{ | ||
id: '04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14.7273455247', | ||
value: 1246207165320n, | ||
}, | ||
{ | ||
id: '04b95368393c821f180deee8229fbd941baaf9bd748ebcdbf7adbb14.727352534e', | ||
value: 5004394n, | ||
}, | ||
], | ||
}; | ||
export const transaction7PaymentTransaction = ` | ||
{ | ||
"network": "cardano", | ||
"eventId": "", | ||
"txBytes": "", | ||
"txId": "06c74b0d597e68a4264dfc2e2c4e2429354c0fba2ca7d075ef9f8b53c01fad8a", | ||
"txType": "payment", | ||
"inputUtxos": [] | ||
} | ||
`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340784
4409