-
Notifications
You must be signed in to change notification settings - Fork 2
new functions proposal #1
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
Open
1ksn1ks
wants to merge
24
commits into
hashgraph-online:main
Choose a base branch
from
1ksn1ks:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ba2d737
proposal for new functions
1ksn1ks f9fa2b2
Update hashinal-wc.es.js
1ksn1ks 423d605
Update hashinal-wc.es.js
1ksn1ks 687e6ad
Update index.d.ts
1ksn1ks 06b8fbc
Update types.d.ts
1ksn1ks 9660fc9
import of new functions
1ksn1ks 0e5021d
Update index.ts
1ksn1ks 59ceaac
update
1ksn1ks 69f13ca
Update index.ts
1ksn1ks 00bee55
Update index.ts
1ksn1ks 794a2c6
Update hashinal-wc.es.js
1ksn1ks cc88a2d
fixed
1ksn1ks 4109155
Update index.ts
1ksn1ks f550b44
Update index.ts
1ksn1ks 4073600
Update index.ts
1ksn1ks a44f76e
Update index.ts
1ksn1ks 4f0d35b
Update index.ts
1ksn1ks 2aed309
memo works
1ksn1ks 6663273
umd updated
1ksn1ks 9570e61
Update current-version.txt
1ksn1ks af34f86
getTopicInfo
1ksn1ks 74047c0
Update current-version.txt
1ksn1ks ce2a2a0
update memo
1ksn1ks 4876cd1
Update current-version.txt
1ksn1ks 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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 |
---|---|---|
|
@@ -25,6 +25,8 @@ import { | |
AccountUpdateTransaction, | ||
AccountAllowanceApproveTransaction, | ||
TokenId, | ||
client, | ||
TopicUpdateTransaction | ||
} from '@hashgraph/sdk'; | ||
import * as HashgraphSDK from '@hashgraph/sdk'; | ||
import { | ||
|
@@ -420,19 +422,48 @@ class HashinalsWalletConnectSDK { | |
}; | ||
} | ||
|
||
|
||
public async generatePrivateAndPublicKey(): Promise<{ | ||
privateKey: string; | ||
publicKey: string; | ||
}> { | ||
this.ensureInitialized(); | ||
const privateKey = await PrivateKey.generateED25519Async(); | ||
const publicKey = privateKey.publicKey; | ||
return { | ||
privateKey: privateKey.toString(), | ||
publicKey: publicKey.toString() | ||
}; | ||
} | ||
|
||
public async updateTopic(topicId: string, memo: string, adminKey: string): Promise<string> { | ||
this.ensureInitialized(); | ||
let transaction = new TopicUpdateTransaction() | ||
.setTopicId(TopicId.fromString(topicId)) | ||
.setTopicMemo(memo || "") | ||
.freezeWith(client); | ||
|
||
// Convert the adminKey string back to a PrivateKey object | ||
const privateKey = PrivateKey.fromString(adminKey); | ||
const signedTx = await transaction.sign(privateKey); | ||
|
||
const receipt = await this.executeTransaction(signedTx); | ||
return receipt.topicId!.toString(); | ||
} | ||
|
||
public async createTopic( | ||
memo?: string, | ||
adminKey?: string, | ||
submitKey?: string | ||
): Promise<string> { | ||
this.ensureInitialized(); | ||
|
||
let transaction = new TopicCreateTransaction().setTopicMemo(memo || ''); | ||
let transaction = new TopicCreateTransaction().setTopicMemo(memo || ""); | ||
|
||
if (adminKey) { | ||
const adminWithPrivateKey = PrivateKey.fromString(adminKey); | ||
transaction.setAdminKey(adminWithPrivateKey.publicKey); | ||
transaction = await transaction.sign(adminWithPrivateKey); | ||
transaction.freezeWith(client); // Freeze after setting the admin key | ||
transaction = await transaction.sign(adminWithPrivateKey); // Then sign | ||
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. It looks like you're not disabling the signing in |
||
} | ||
|
||
if (submitKey) { | ||
|
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
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.
Since you're already signing the transaction, the signer should be disabled in
executeTransaction