-
Notifications
You must be signed in to change notification settings - Fork 294
feat(sdk-coin-icp): integrate ic0 library for account balance retrieval #6118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
3904437
to
482a65d
Compare
9bc1c79
to
b2a5acf
Compare
modules/sdk-coin-icp/src/icp.ts
Outdated
@@ -268,8 +234,7 @@ export class Icp extends BaseCoin { | |||
const decodedResponse = utils.cborDecode(response.data) as PublicNodeSubmitResponse; | |||
|
|||
if (decodedResponse.status === 'replied') { | |||
const txnId = this.extractTransactionId(decodedResponse); | |||
return { txId: txnId }; | |||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why returning empty object here? We should know what recovery txn hash we generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
broadcastTransaction()
returns BaseBroadcastTransactionResult
which have the txId
but we dont have a way to get the txId
from the response and we cant change the signature of broadcastTransaction()
as its a inherited function
so I have returned a {}
response and set the txId
in the recover()
as we have the builder object in the recover()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, we need to just handle it properly from the caller then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a comment to explain/why status == 'replied' is treated as a success response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
modules/sdk-coin-icp/src/icp.ts
Outdated
const agent = this.createAgent(); | ||
const ic = replica(agent, { local: true }); | ||
|
||
const ledger = ic(Principal.fromUint8Array(LEDGER_CANISTER_ID).toText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these steps will be common for any rpc call that we directly make to public fullnode for this canister. For eg v3/submit api and balance fetch api. If yes, then please make a generic function and pass params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v3/submit and balance fetch has different process to make the request therefore they have different methods
maybe other methods like feeEstimates or derive might have same process as the balance fetch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed over call, please add the todo ticket to move the ic-agent calls to a separate file as a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -185,6 +185,14 @@ export interface RecoveryOptions { | |||
memo?: number | BigInt; | |||
} | |||
|
|||
export interface RecoveryTransaction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a standard that other coins also follow for recovery ? As far as I remember they only return txId.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i checked XRP, TRX and TON coins, they are having similar return fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the need here is only for id and tx. As discussed offline, pls make the necessary change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is only id and tx
dec516d
to
c4cfed7
Compare
9370a10
to
9d8607b
Compare
TIcket: WIN-5479