Skip to content

Conversation

@ravibitgo
Copy link
Contributor

@ravibitgo ravibitgo commented Mar 12, 2025

Ticket: COIN-3290

@ravibitgo ravibitgo force-pushed the COIN-3290 branch 2 times, most recently from 5c0bc95 to 0004402 Compare March 12, 2025 16:52
Base automatically changed from COIN-3291 to master March 13, 2025 06:15
@ravibitgo ravibitgo marked this pull request as ready for review March 13, 2025 06:44
@ravibitgo ravibitgo requested a review from a team as a code owner March 13, 2025 06:44
@ravibitgo ravibitgo requested a review from gianchandania March 13, 2025 06:45
explain.outputs[0].amount.should.equal(testData.fungibleTokenTransferTx.functionArgs[2].value);
explain.outputs[0].address.should.equal(cvToString(testData.fungibleTokenTransferTx.functionArgs[1]));
explain.outputs[0].memo.should.equal('1');
explain.outputs[0].tokenName.should.equal(testData.fungibleTokenTransferTx.tokenName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be equal to tstx:sip6dp, but value of tokenName in fixtures is not correct. https://github.com/BitGo/BitGoJS/pull/5750/files#diff-d8557ee9dc151a0475176bd9443fe1384d09c7088ed40f6f256dd937da69a224R44

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm no, it is the token name that is present in the contract which is tsip6dp-token.
The tstx:sip6dp is the bitgo name.
findTokenNameByContract - we can modify this function to give either bitgo name or the contract token name, will change the code depending on this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried changing the function to return bitgo name of the token, tstx:tsip6dp - but verify transaction failed (because txHex will have the contract token name)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so ideally explainTransaction is taking the txHex and deriving the data which is having outputs array. Now this outputs array should have bitgo name of the token, so we should make all the changes required for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@ravibitgo ravibitgo force-pushed the COIN-3290 branch 2 times, most recently from ba5f746 to aebbb60 Compare March 14, 2025 07:18
contractName: string;
functionName: string;
functionArgs: ClarityValue[];
tokenName?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param {String} contractName
* @returns {String|Undefined}
*/
export function getTokenNameIfAssetMatchesContract(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method should be removed, it is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

fee: '180',
contractAddress: 'STAG18E45W613FZ3H4ZMF6QHH426EXM5QTSAVWYH',
contractName: 'tsip6dp-token',
tokenName: 'tsip6dp-token',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenName: 'tstx:tsip6dp',

address: 'SN2NN1JP9AEP5BVE19RNJ6T2MP7NDGRZYST1VDF3M',
amount: '10000',
memo: '1',
tokenName: 'tsip6dp-token',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenName: 'tstx:tsip6dp'

it('should fail to verify transaction with wrong token', async function () {
const txPrebuild = newTxPrebuild();
const txParams = newTxParams();
txParams.recipients[0].tokenName = 'tstx:tsip6dp';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

txParams.recipients[0].tokenName = 'tstx:tsip8dp'

Copy link
Contributor

@gianchandania gianchandania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ravibitgo ravibitgo merged commit 72b5279 into master Mar 16, 2025
10 checks passed
@ravibitgo ravibitgo deleted the COIN-3290 branch March 16, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants