diff --git a/examples/nextjs/CHANGELOG.md b/examples/nextjs/CHANGELOG.md index 522fa09b..02ad804d 100644 --- a/examples/nextjs/CHANGELOG.md +++ b/examples/nextjs/CHANGELOG.md @@ -1,5 +1,50 @@ # @demo/wallet +## 0.0.8 + +### Patch Changes + +- Updated dependencies + [[`57082ea`](https://github.com/bnb-chain/greenfield-js-sdk/commit/57082eace1beff17c2ab9b21d099ba6563fe94bf), + [`9f7feb5`](https://github.com/bnb-chain/greenfield-js-sdk/commit/9f7feb58a264b303a40a93cfb471e61df4170e6b), + [`76a18f1`](https://github.com/bnb-chain/greenfield-js-sdk/commit/76a18f1ea3dc44ea56c964003de4d9e323532405), + [`c981fff`](https://github.com/bnb-chain/greenfield-js-sdk/commit/c981fff3943fb5f351df7986a498021cf7cbff9d)]: + - @bnb-chain/greenfiled-file-handle@1.0.0 + - @bnb-chain/greenfield-js-sdk@1.0.0 + +## 0.0.8-alpha.3 + +### Patch Changes + +- Updated dependencies + [[`57082ea`](https://github.com/bnb-chain/greenfield-js-sdk/commit/57082eace1beff17c2ab9b21d099ba6563fe94bf)]: + - @bnb-chain/greenfiled-file-handle@1.0.0-alpha.0 + - @bnb-chain/greenfield-js-sdk@1.0.0-alpha.3 + +## 0.0.8-alpha.2 + +### Patch Changes + +- Updated dependencies + [[`9f7feb5`](https://github.com/bnb-chain/greenfield-js-sdk/commit/9f7feb58a264b303a40a93cfb471e61df4170e6b)]: + - @bnb-chain/greenfield-js-sdk@0.2.7-alpha.2 + +## 0.0.8-alpha.1 + +### Patch Changes + +- Updated dependencies + [[`c981fff`](https://github.com/bnb-chain/greenfield-js-sdk/commit/c981fff3943fb5f351df7986a498021cf7cbff9d)]: + - @bnb-chain/greenfield-js-sdk@0.2.7-alpha.1 + +## 0.0.8-alpha.0 + +### Patch Changes + +- Updated dependencies + [[`76a18f1`](https://github.com/bnb-chain/greenfield-js-sdk/commit/76a18f1ea3dc44ea56c964003de4d9e323532405)]: + - @bnb-chain/greenfield-js-sdk@0.2.7-alpha.0 + ## 0.0.7 ### Patch Changes diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index 52195e38..f3fa7289 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "@demo/wallet", - "version": "0.0.7", + "version": "0.0.8", "private": true, "scripts": { "dev": "cross-env NODE_ENV=development next dev", @@ -11,11 +11,13 @@ "lint": "next lint" }, "dependencies": { + "@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.23", "@bnb-chain/greenfield-js-sdk": "workspace:*", "@bnb-chain/greenfiled-file-handle": "workspace:*", "@cosmjs/encoding": "^0.29.5", "@cosmjs/proto-signing": "^0.29.5", "@cosmjs/stargate": "^0.29.5", + "@ethersproject/bytes": "5.7.0", "@ethersproject/signing-key": "^5.7.0", "@ethersproject/wallet": "^5.7.0", "@metamask/eth-sig-util": "^5.0.2", @@ -29,6 +31,7 @@ "eslint": "^8.21.0", "eslint-config-next": "13.1.6", "evmosjs": "^0.2.17", + "lodash": "^4.17.21", "long": "^5.2.1", "next": "13.1.6", "react": "18.2.0", @@ -38,7 +41,8 @@ "wagmi": "^1.2.0" }, "devDependencies": { + "@types/lodash": "^4.14.199", "cross-env": "^7.0.3", "dotenv": "^16.0.3" } -} \ No newline at end of file +} diff --git a/examples/nextjs/src/components/customtx/index.tsx b/examples/nextjs/src/components/customtx/index.tsx index 3eef067a..4008d283 100644 --- a/examples/nextjs/src/components/customtx/index.tsx +++ b/examples/nextjs/src/components/customtx/index.tsx @@ -83,6 +83,189 @@ export const CustomTx = () => { > broadcast with simulate + +
+ + ); }; diff --git a/examples/nextjs/src/components/feegrant/delObj.tsx b/examples/nextjs/src/components/feegrant/delObj.tsx index fdb22d36..ca274b6c 100644 --- a/examples/nextjs/src/components/feegrant/delObj.tsx +++ b/examples/nextjs/src/components/feegrant/delObj.tsx @@ -5,6 +5,7 @@ import { newObjectGRN, PermissionTypes, toTimestamp, + fromJsonTimestamp, } from '@bnb-chain/greenfield-js-sdk'; import { Wallet } from '@ethersproject/wallet'; import { useState } from 'react'; @@ -49,16 +50,21 @@ export const DelObj = () => { console.log('wallet', wallet.address, wallet.privateKey); setWallet(wallet); + const tempAddr = wallet.address; + // 2. allow temporary account to submit specified tx and amount const date = new Date(); date.setDate(date.getDate() + 1); const grantAllowanceTx = await client.feegrant.grantAllowance({ granter: address, - grantee: wallet.address, + grantee: tempAddr, allowedMessages: [MsgDeleteObjectTypeUrl], amount: parseEther('0.09').toString(), denom: 'BNB', expirationTime: toTimestamp(date), + // expirationTime: fromJsonTimestamp({ + // seconds: 1796428611, + // }), }); // 3. Put bucket policy so that the temporary account can create objects within this bucket @@ -72,7 +78,7 @@ export const DelObj = () => { statements: [statement], principal: { type: PermissionTypes.PrincipalType.PRINCIPAL_TYPE_GNFD_ACCOUNT, - value: wallet.address, + value: tempAddr, }, }); diff --git a/examples/nextjs/src/components/validator/index.tsx b/examples/nextjs/src/components/validator/index.tsx index 2528adf2..dbc9c4c6 100644 --- a/examples/nextjs/src/components/validator/index.tsx +++ b/examples/nextjs/src/components/validator/index.tsx @@ -2,46 +2,98 @@ import { client } from '@/client'; import { VALIDATOR_PRIVATEKEY } from '@/config/env'; import { Long } from '@bnb-chain/greenfield-js-sdk'; import { useAccount } from 'wagmi'; - +import { MsgSubmitProposal, MsgVote } from '@bnb-chain/greenfield-cosmos-types/cosmos/gov/v1/tx'; +import { + MsgCreateValidator, + MsgEditValidator, +} from '@bnb-chain/greenfield-cosmos-types/cosmos/staking/v1beta1/tx'; +import { Any } from '@bnb-chain/greenfield-cosmos-types/google/protobuf/any'; +import { PubKey } from '@bnb-chain/greenfield-cosmos-types/cosmos/crypto/ed25519/keys'; + +/** + * decrpred + */ export const Validator = () => { const { address, connector } = useAccount(); return ( <> - {/*

create validator

+

create validator

*/} + create validator + + +