Skip to content
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

fix: replace signWithChainWeaver function due to deprecation #6

Open
wants to merge 1 commit into
base: 01-getting-started
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions snippets/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ const network = process.env.KADENA_NETWORK || defaultNetwork;
const defaultChainId = '1';
const defaultNetworkId: string = 'fast-development';

export const getApiHost = (): string => {
return `http://localhost:8080/chainweb/0.0/${getNetworkId()}/chain/${getChainId()}/pact`;
};

export const getChainId = (): ChainId => {
switch (network) {
case 'devnet':
Expand All @@ -26,3 +22,7 @@ export const getNetworkId = (): string => {
return defaultNetworkId;
}
};

export const getApiHost = (): string => {
return `http://localhost:8080/chainweb/0.0/${getNetworkId()}/chain/${getChainId()}/pact`;
};
113 changes: 54 additions & 59 deletions snippets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@types/node": "^20.8.2",
"prettier": "^3.0.3",
"prettier-plugin-packagejson": "^2.4.5",
"ts-node": "^10.9.1"
"ts-node": "^10.9.1",
"typescript": "^5.3.3"
}
}
3 changes: 2 additions & 1 deletion snippets/principal-namespace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Pact, createClient, isSignedTransaction, signWithChainweaver } from '@kadena/client';
import { Pact, createClient, createSignWithChainweaver, isSignedTransaction } from '@kadena/client';
import { getApiHost, getChainId, getNetworkId } from './configuration';

const client = createClient(getApiHost());
Expand Down Expand Up @@ -28,6 +28,7 @@ async function main(account: string) {
.setNetworkId(getNetworkId())
.createTransaction();

const signWithChainweaver = createSignWithChainweaver();
const signedTx = await signWithChainweaver(transaction);

if (isSignedTransaction(signedTx)) {
Expand Down