-
Notifications
You must be signed in to change notification settings - Fork 128
Refactored fcl-core wallet-utils folder files to TypeScript #2478
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
Merged
mfbz
merged 18 commits into
feature/typescript-fcl-core
from
mfbz/refactor-fcl-core-wallet-utils
Jun 17, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3a6fcf5
Refactored wallet-utils folder
mfbz 1c0e12f
Made account proof data optional
mfbz 3d1d0a0
Merge branch 'feature/typescript-fcl-core' into mfbz/refactor-fcl-cor…
mfbz 028adb5
Update packages/fcl-core/src/wallet-utils/encode-account-proof.ts
mfbz 5a3407a
Update packages/fcl-core/src/wallet-utils/encode-account-proof.ts
mfbz 923ee29
Update packages/fcl-core/src/wallet-utils/encode-account-proof.ts
mfbz 31831f7
Improved sendMsgToFCL msg param
mfbz 4e716db
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz f89b10d
Update packages/fcl-core/src/wallet-utils/CompositeSignature.ts
mfbz 147b83e
Update packages/fcl-core/src/wallet-utils/on-message-from-fcl.ts
mfbz c98d8d6
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz 464dd57
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz dffc739
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz 95817c7
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz 70b5533
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz 53d48f4
Update packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts
mfbz b66361a
Merge branch 'feature/typescript-fcl-core' into mfbz/refactor-fcl-cor…
mfbz b0cdbd5
Removed useless casts
mfbz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {withPrefix} from "@onflow/util-address" | ||
import {COMPOSITE_SIGNATURE_PRAGMA} from "../normalizers/service/__vsn" | ||
|
||
/** | ||
* @description Constructs a new CompositeSignature instance. | ||
* | ||
* @param addr Flow Address | ||
* @param keyId Key ID | ||
* @param signature Signature as a hex string | ||
*/ | ||
export class CompositeSignature { | ||
f_type: string | ||
f_vsn: string | ||
addr: string | ||
keyId: number | ||
signature: string | ||
|
||
constructor(addr: string, keyId: number | string, signature: string) { | ||
this.f_type = COMPOSITE_SIGNATURE_PRAGMA.f_type | ||
this.f_vsn = COMPOSITE_SIGNATURE_PRAGMA.f_vsn | ||
this.addr = withPrefix(addr) | ||
this.keyId = Number(keyId) | ||
this.signature = signature | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...wallet-utils/encode-account-proof.test.js → ...wallet-utils/encode-account-proof.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export { | ||
sendMsgToFCL, | ||
ready, | ||
close, | ||
approve, | ||
decline, | ||
redirect, | ||
} from "./send-msg-to-fcl" | ||
export {onMessageFromFCL} from "./on-message-from-fcl" | ||
export {encodeMessageFromSignable} from "@onflow/sdk" | ||
export {CompositeSignature} from "./CompositeSignature" | ||
export {encodeAccountProof} from "./encode-account-proof" | ||
export {injectExtService} from "./inject-ext-service" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type {Service} from "@onflow/typedefs" | ||
|
||
export function injectExtService(service: Service): void { | ||
if (service.type === "authn" && service.endpoint != null) { | ||
if (!Array.isArray((window as any).fcl_extensions)) { | ||
;(window as any).fcl_extensions = [] | ||
} | ||
;(window as any).fcl_extensions.push(service) | ||
} else { | ||
console.warn("Authn service is required") | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like
msg
is unused here. IMO we should maybe just take this opportunity to drop it. The risk is that users could get type errors for this if they were passing an (unused) msg arg here, but functionally this should not break anything so I think it's worth it for the long term.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.
Yes to me it makes completely sense because it's useless. If we want to maintain backward compatibility we could still leave it but make it optional like it is done in the sendMsgToFCL method. What do you think?