-
Notifications
You must be signed in to change notification settings - Fork 143
Various fixes, part 3 #961
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
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
00b4cfc
util/continued_fraction updated
quietbits 552f6eb
muxed_account updated
quietbits ad22db8
Added operation test
quietbits 06d451d
Add immutable tx flag
quietbits 6904d28
auth updated
quietbits eb6ce90
scval updated
quietbits 4df96f1
Added source acc test for getClaimableBalanceId()
quietbits 0d3750e
Copilot feedback
quietbits b2fca1d
Always return immutable tx, remove opt-in immutableTx flag
quietbits dab2285
Breaking: Change authorizeInvocation() from positional args to a para…
quietbits 64e014e
Updated changelog
quietbits 555c112
Resolved merge conflicts
quietbits c4e1bf4
Clean up changelog
quietbits 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import xdr from "./xdr.js"; | |
|
|
||
| import { Keypair } from "./keypair.js"; | ||
| import { StrKey } from "./strkey.js"; | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| import { Networks } from "./network.js"; | ||
| import { hash } from "./hashing.js"; | ||
|
|
||
|
|
@@ -123,7 +124,7 @@ export async function authorizeEntry( | |
| entry: xdr.SorobanAuthorizationEntry, | ||
| signer: Keypair | SigningCallback, | ||
| validUntilLedgerSeq: number, | ||
| networkPassphrase: string = Networks.TESTNET, | ||
| networkPassphrase: string, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a breaking change, but I think we should make it. This is the only place where we silently set the network passphrase to testnet. Everywhere else it is required.
quietbits marked this conversation as resolved.
|
||
| ): Promise<xdr.SorobanAuthorizationEntry> { | ||
| // no-op if it's source account auth | ||
| if ( | ||
|
|
@@ -208,32 +209,43 @@ export async function authorizeEntry( | |
| * | ||
| * This is in contrast to {@link authorizeEntry}, which signs an existing entry. | ||
| * | ||
| * @param signer - either a {@link Keypair} instance (or anything with a | ||
| * @param params - the parameters for building and signing the authorization | ||
| * @param params.signer - either a {@link Keypair} instance (or anything with a | ||
| * `.sign(buf): Buffer-like` method) or a function which takes a payload (a | ||
| * {@link xdr.HashIdPreimageSorobanAuthorization} instance) input and returns | ||
| * the signature of the hash of the raw payload bytes (where the signing key | ||
| * should correspond to the address in the `entry`) | ||
| * @param validUntilLedgerSeq - the (exclusive) future ledger sequence number | ||
| * until which this authorization entry should be valid (if | ||
| * @param params.validUntilLedgerSeq - the (exclusive) future ledger sequence | ||
| * number until which this authorization entry should be valid (if | ||
| * `currentLedgerSeq==validUntilLedgerSeq`, this is expired) | ||
| * @param invocation - the invocation tree that we're authorizing (likely, this | ||
| * comes from transaction simulation) | ||
| * @param publicKey - the public identity of the signer (when providing a | ||
| * @param params.invocation - the invocation tree that we're authorizing | ||
| * (likely, this comes from transaction simulation) | ||
| * @param params.networkPassphrase - the network passphrase is incorporated into | ||
| * the signature (see {@link Networks} for options) | ||
| * @param params.publicKey - the public identity of the signer (when providing a | ||
| * {@link Keypair} to `signer`, this can be omitted, as it just uses | ||
| * {@link Keypair.publicKey}) | ||
| * @param networkPassphrase - the network passphrase is incorporated into the | ||
| * signature (see {@link Networks} for options, default: | ||
| * {@link Networks.TESTNET}) | ||
| * | ||
| * @see authorizeEntry | ||
| */ | ||
| export interface AuthorizeInvocationParams { | ||
| signer: Keypair | SigningCallback; | ||
| validUntilLedgerSeq: number; | ||
| invocation: xdr.SorobanAuthorizedInvocation; | ||
| networkPassphrase: string; | ||
| publicKey?: string; | ||
| } | ||
|
|
||
| export function authorizeInvocation( | ||
| signer: Keypair | SigningCallback, | ||
| validUntilLedgerSeq: number, | ||
| invocation: xdr.SorobanAuthorizedInvocation, | ||
| publicKey: string = "", | ||
| networkPassphrase: string = Networks.TESTNET, | ||
| params: AuthorizeInvocationParams, | ||
| ): Promise<xdr.SorobanAuthorizationEntry> { | ||
| const { | ||
| signer, | ||
| validUntilLedgerSeq, | ||
| invocation, | ||
| networkPassphrase, | ||
| publicKey = "", | ||
| } = params; | ||
| // We use keypairs as a source of randomness for the nonce to avoid mucking | ||
| // with any crypto dependencies. Note that this just has to be random and | ||
| // unique, not cryptographically secure, so it's fine. | ||
|
|
||
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 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 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.