diff --git a/server/package-lock.json b/server/package-lock.json index 6b1f6e1..ca76eeb 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0-alpha.1", "license": "ISC", "dependencies": { - "@hyperledger/firefly-sdk": "^0.1.0-alpha.5", + "@hyperledger/firefly-sdk": "^0.1.0-alpha.8", "body-parser": "^1.20.0", "class-transformer": "^0.3.1", "class-validator": "^0.12.2", @@ -855,9 +855,9 @@ "dev": true }, "node_modules/@hyperledger/firefly-sdk": { - "version": "0.1.0-alpha.5", - "resolved": "https://registry.npmjs.org/@hyperledger/firefly-sdk/-/firefly-sdk-0.1.0-alpha.5.tgz", - "integrity": "sha512-MK2jhY76Fi0vp5uT4DA8bihar7eEPLJZ4BuSH2+RDONLJIHIwiawNWqxCyMtQOXgTYTc5zsNSvE+TWWI4Zgsvg==", + "version": "0.1.0-alpha.8", + "resolved": "https://registry.npmjs.org/@hyperledger/firefly-sdk/-/firefly-sdk-0.1.0-alpha.8.tgz", + "integrity": "sha512-AxQ18A00g6XsQ+Xz09bJWHCWlMmJgZ67kTYzPpdSlr3T+tYTbIIp1Iu7+TWIcUR/TGnL3Q+izKyHIYKVkuS5hg==", "dependencies": { "axios": "^0.26.1", "form-data": "^4.0.0", @@ -11355,9 +11355,9 @@ "dev": true }, "@hyperledger/firefly-sdk": { - "version": "0.1.0-alpha.5", - "resolved": "https://registry.npmjs.org/@hyperledger/firefly-sdk/-/firefly-sdk-0.1.0-alpha.5.tgz", - "integrity": "sha512-MK2jhY76Fi0vp5uT4DA8bihar7eEPLJZ4BuSH2+RDONLJIHIwiawNWqxCyMtQOXgTYTc5zsNSvE+TWWI4Zgsvg==", + "version": "0.1.0-alpha.8", + "resolved": "https://registry.npmjs.org/@hyperledger/firefly-sdk/-/firefly-sdk-0.1.0-alpha.8.tgz", + "integrity": "sha512-AxQ18A00g6XsQ+Xz09bJWHCWlMmJgZ67kTYzPpdSlr3T+tYTbIIp1Iu7+TWIcUR/TGnL3Q+izKyHIYKVkuS5hg==", "requires": { "axios": "^0.26.1", "form-data": "^4.0.0", diff --git a/server/package.json b/server/package.json index 5fc3d59..a66b230 100644 --- a/server/package.json +++ b/server/package.json @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/hyperledger/firefly-sandbox#readme", "dependencies": { - "@hyperledger/firefly-sdk": "^0.1.0-alpha.5", + "@hyperledger/firefly-sdk": "^0.1.0-alpha.8", "body-parser": "^1.20.0", "class-transformer": "^0.3.1", "class-validator": "^0.12.2", diff --git a/server/src/controllers/contracts.ts b/server/src/controllers/contracts.ts index f920bf2..68cfed9 100644 --- a/server/src/controllers/contracts.ts +++ b/server/src/controllers/contracts.ts @@ -43,7 +43,7 @@ export class ContractsController { ? await firefly.generateContractInterface({ name: body.name, version: body.version, - input: { abi: body.schema } as any, + input: { abi: body.schema }, }) : body.schema; const result = await firefly.createContractInterface(ffi); @@ -64,7 +64,7 @@ export class ContractsController { }, location: { address: body.address, - } as any, + }, }); return { type: 'message', id: api.message }; } @@ -84,7 +84,7 @@ export class ContractsController { const apis = await firefly.getContractAPIs(); return apis.map((api) => ({ name: api.name, - address: (api.location as any)?.address, + address: api.location?.address, urls: api.urls, })); } @@ -100,7 +100,7 @@ export class ContractsController { const ffi = await firefly.getContractInterface(api.interface.id, true); return { name: api.name, - address: (api.location as any)?.address, + address: api.location?.address, urls: api.urls, events: ffi.events?.map((e) => ({ pathname: e.pathname })), }; @@ -119,7 +119,7 @@ export class ContractsController { id: l.id, name: l.name, topic: l.topic, - address: (l.location as any)?.address, + address: l.location?.address, eventName: l.event.name, })); } diff --git a/server/src/interfaces.ts b/server/src/interfaces.ts index b9afcbf..f5d0bf5 100644 --- a/server/src/interfaces.ts +++ b/server/src/interfaces.ts @@ -123,7 +123,7 @@ export class TokenMint { @IsString() pool: string; - @IsString() + @IsNumberString() amount: string; } diff --git a/server/test/contracts.test.ts b/server/test/contracts.test.ts index 765a284..5a3212e 100644 --- a/server/test/contracts.test.ts +++ b/server/test/contracts.test.ts @@ -171,7 +171,7 @@ describe('Smart Contracts', () => { const listener = { id: 'listener1', topic: 'my-app', - location: { address: '0x123' } as any, + location: { address: '0x123' }, event: { name: 'event1' }, } as FireFlyContractListenerResponse; diff --git a/ui/src/components/Forms/BurnForm.tsx b/ui/src/components/Forms/BurnForm.tsx index 8d23505..5352db4 100644 --- a/ui/src/components/Forms/BurnForm.tsx +++ b/ui/src/components/Forms/BurnForm.tsx @@ -27,10 +27,10 @@ export const BurnForm: React.FC = () => { const [tokenPools, setTokenPools] = useState([]); const [pool, setPool] = useState(); - const [amount, setAmount] = useState(0); + const [amount, setAmount] = useState('0'); const [tokenIndex, setTokenIndex] = useState(''); const [refresh, setRefresh] = useState(0); - const [tokenBalance, setTokenBalance] = useState(0); + const [tokenBalance, setTokenBalance] = useState('0'); useEffect(() => { if (activeForm !== TUTORIALS.BURN) return; @@ -80,7 +80,7 @@ export const BurnForm: React.FC = () => { useEffect(() => { if (!isFungible()) { - setAmount(1); + setAmount('1'); } }, [pool, amount]); @@ -96,9 +96,7 @@ export const BurnForm: React.FC = () => { }; const handleAmountChange = (event: React.ChangeEvent) => { - if (parseInt(event.target.value)) { - setAmount(parseInt(event.target.value)); - } + setAmount(event.target.value); }; return ( diff --git a/ui/src/components/Forms/MintForm.tsx b/ui/src/components/Forms/MintForm.tsx index ee93bbd..8d7b49f 100644 --- a/ui/src/components/Forms/MintForm.tsx +++ b/ui/src/components/Forms/MintForm.tsx @@ -27,19 +27,19 @@ export const MintForm: React.FC = () => { const { t } = useTranslation(); const [tokenPools, setTokenPools] = useState([]); - const [tokenBalance, setTokenBalance] = useState(0); + const [tokenBalance, setTokenBalance] = useState('0'); const [message] = useState( DEFAULT_MESSAGE_STRING ); const [pool, setPool] = useState(); - const [amount, setAmount] = useState(1); + const [amount, setAmount] = useState('1'); const [refresh, setRefresh] = useState(0); useEffect(() => { if (activeForm !== TUTORIALS.MINT) { - setAmount(1); + setAmount('1'); return; } setPayloadMissingFields(!amount || !pool); @@ -101,9 +101,7 @@ export const MintForm: React.FC = () => { }, [pool, refresh]); const handleAmountChange = (event: React.ChangeEvent) => { - if (parseInt(event.target.value)) { - setAmount(parseInt(event.target.value)); - } + setAmount(event.target.value); }; return ( diff --git a/ui/src/components/Forms/TransferForm.tsx b/ui/src/components/Forms/TransferForm.tsx index a683670..b562bd2 100644 --- a/ui/src/components/Forms/TransferForm.tsx +++ b/ui/src/components/Forms/TransferForm.tsx @@ -28,16 +28,16 @@ export const TransferForm: React.FC = () => { const [tokenPools, setTokenPools] = useState([]); const [pool, setPool] = useState(); - const [amount, setAmount] = useState(1); + const [amount, setAmount] = useState('1'); const [tokenVerifiers, setTokenVerifiers] = useState([]); const [recipient, setRecipient] = useState(''); const [tokenIndex, setTokenIndex] = useState(''); - const [tokenBalance, setTokenBalance] = useState(0); - const [refresh, setRefresh] = useState(0); + const [tokenBalance, setTokenBalance] = useState('0'); + const [refresh, setRefresh] = useState('0'); useEffect(() => { if (activeForm !== TUTORIALS.TRANSFER) { - setAmount(1); + setAmount('1'); return; } setPayloadMissingFields( @@ -80,7 +80,7 @@ export const TransferForm: React.FC = () => { useEffect(() => { if (!isFungible()) { - setAmount(1); + setAmount('1'); } }, [pool, amount]); @@ -112,9 +112,7 @@ export const TransferForm: React.FC = () => { }; const handleAmountChange = (event: React.ChangeEvent) => { - if (parseInt(event.target.value)) { - setAmount(parseInt(event.target.value)); - } + setAmount(event.target.value); }; const handleTokenIndexChange = (