Skip to content

Commit

Permalink
fix: update SDK method names in useMoonAccounts hook and increment pa…
Browse files Browse the repository at this point in the history
…ckage versions
  • Loading branch information
ewhal committed Dec 14, 2024
1 parent 4d4000d commit 181f1c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
11 changes: 3 additions & 8 deletions packages/moon-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonup/moon-react",
"version": "2.0.6",
"version": "2.0.7",
"license": "MIT",
"author": "0xEwhal <[email protected]>",
"type": "module",
Expand All @@ -14,10 +14,7 @@
"types": "./dist/index.d.ts"
}
},
"files": [
"dist",
"src"
],
"files": ["dist", "src"],
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
Expand Down Expand Up @@ -160,8 +157,6 @@
"vite": "^5.4.8"
},
"eslintConfig": {
"extends": [
"plugin:storybook/recommended"
]
"extends": ["plugin:storybook/recommended"]
}
}
36 changes: 23 additions & 13 deletions packages/moon-react/src/hooks/old/useMoonAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const useMoonAccounts = () => {
return handleTransaction("transferEth", async () => {
const accountsSDK = getAccountsSDK();
console.log("transferEth", payload.accountName, payload.transaction);
const response = await accountsSDK.transferEth(
const response = await accountsSDK.accountsTransferEth(
payload.accountName,
payload.transaction,
);
Expand All @@ -47,7 +47,10 @@ export const useMoonAccounts = () => {
}): Promise<{ balance: string }> => {
return handleTransaction("getBalance", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.getBalance(payload);
const response = await accountsSDK.accountsEthereumGetNativeBalance({
accountName: payload.accountName,
chainId: payload.chainId,
});
if (!response.success) {
throw new Error(response.message);
}
Expand All @@ -60,15 +63,15 @@ export const useMoonAccounts = () => {
const listAccounts = useCallback(async (): Promise<AccountResponse> => {
return handleTransaction("listAccounts", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.listAccounts();
const response = await accountsSDK.accountsListEthereumAccounts();
return response.data;
});
}, [moon, addTransactionResult]);

const createAccount = useCallback(async (): Promise<AccountResponse> => {
return handleTransaction("createAccount", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.createAccount({});
const response = await accountsSDK.accountsCreateEthereumAccount({});
return response.data;
});
}, [moon, addTransactionResult]);
Expand All @@ -77,7 +80,9 @@ export const useMoonAccounts = () => {
async (payload: { id: string }): Promise<AccountResponse> => {
return handleTransaction("getAccount", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.getAccount(payload.id);
const response = await accountsSDK.accountsGetEthreumAccount(
payload.id,
);
return response.data;
});
},
Expand All @@ -88,7 +93,9 @@ export const useMoonAccounts = () => {
async (payload: { id: string }): Promise<AccountResponse> => {
return handleTransaction("deleteAccount", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.deleteAccount(payload.id);
const response = await accountsSDK.accountsDeleteEthereumAccount(
payload.id,
);
return response.data;
});
},
Expand All @@ -102,7 +109,7 @@ export const useMoonAccounts = () => {
}): Promise<Transaction> => {
return handleTransaction("signTransaction", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.signTransaction(
const response = await accountsSDK.accountsSignEthereumTransaction(
payload.accountName,
payload.transaction,
);
Expand All @@ -119,7 +126,7 @@ export const useMoonAccounts = () => {
}): Promise<TransactionData> => {
return handleTransaction("signMessage", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.signMessage(
const response = await accountsSDK.accountsSignEthreumMessage(
payload.id,
payload.message,
);
Expand All @@ -136,7 +143,7 @@ export const useMoonAccounts = () => {
}): Promise<TransactionData> => {
return handleTransaction("signTypedData", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.signTypedData(
const response = await accountsSDK.accountsSignEthereumTypedData(
payload.id,
payload.typedData,
);
Expand All @@ -154,10 +161,13 @@ export const useMoonAccounts = () => {
}): Promise<BroadCastRawTransactionResponse> => {
return handleTransaction("broadcastTx", async () => {
const accountsSDK = getAccountsSDK();
const response = await accountsSDK.broadcastTx(payload.id, {
rawTransaction: payload.transaction,
chainId: payload.chain_id,
});
const response = await accountsSDK.accountsBroadcastEthreeumTransaction(
payload.id,
{
rawTransaction: payload.transaction,
chainId: payload.chain_id,
},
);
return response.data;
});
},
Expand Down
2 changes: 1 addition & 1 deletion packages/moon-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonup/moon-sdk",
"version": "2.0.3",
"version": "2.0.4",
"author": "0xEwhal <[email protected]>",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down

0 comments on commit 181f1c0

Please sign in to comment.