Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianIOB committed Dec 1, 2023
1 parent 9ef3eec commit 2014d0d
Show file tree
Hide file tree
Showing 28 changed files with 640 additions and 120 deletions.
1 change: 1 addition & 0 deletions FACTORY_VERSION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
|Version | Contract name | Address | Network |
|--------|----------------|--------------|------------|
| 1.11.0 | FactoryAddress | 0.0.1137631 | Testnet |
| 1.10.0 | FactoryAddress | 0.0.1137631 | Testnet |
| 1.9.1 | FactoryAddress | 0.0.1137631 | Testnet |
| 1.9.0 | FactoryAddress | 0.0.1137631 | Testnet |
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/stablecoin-npm-cli",
"version": "1.10.0",
"version": "1.11.0",
"description": "CLI for Hedera Stablecoin",
"main": "./build/src/index.js",
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/stablecoin-npm-contracts",
"version": "1.10.0",
"version": "1.11.0",
"description": "",
"main": "./build/typechain-types/index.js",
"module": "./build/typechain-types/index.js",
Expand Down Expand Up @@ -122,7 +122,7 @@
"@chainlink/contracts": "^0.5.1",
"@openzeppelin/contracts": "^4.8.2",
"@openzeppelin/contracts-upgradeable": "^4.8.2",
"@hashgraph/smart-contracts": "github:hashgraph/hedera-smart-contracts#v0.4.0",
"@hashgraph/smart-contracts": "github:hashgraph/hedera-smart-contracts#v0.6.0",
"chai-as-promised": "^7.1.1",
"dotenv": "^16.0.3",
"ethers": "5.7.2",
Expand Down
9 changes: 3 additions & 6 deletions contracts/test/rescuable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ describe('Rescue Tests', function () {
)
})

it('Should rescue 10 HBAR', async function () {
it('Should rescue 1 HBAR', async function () {
// Get the initial balance of the token owner and client
const AmountToRescue = BigNumber.from(10).mul(HBARFactor)
const AmountToRescue = BigNumber.from(1).mul(HBARFactor)
const initialTokenOwnerBalance = await getHBARBalanceOf(
proxyAddress.toString(),
operatorClient,
Expand All @@ -335,7 +335,6 @@ describe('Rescue Tests', function () {
true,
false
)

// rescue some tokens
await rescueHBAR(proxyAddress, AmountToRescue, operatorClient)
await delay(3000)
Expand All @@ -356,12 +355,10 @@ describe('Rescue Tests', function () {

const expectedTokenOwnerBalance =
initialTokenOwnerBalance.sub(AmountToRescue)
const diffClientBalance = finalClientBalance.sub(initialClientBalance)

expect(finalTokenOwnerBalance.toString()).to.equals(
expectedTokenOwnerBalance.toString()
)
expect(diffClientBalance.gt(BigNumber.from(0))).to.be.true
expect(finalClientBalance.gt(initialClientBalance)).to.be.true
})

it('we cannot rescue more HBAR than the owner balance', async function () {
Expand Down
2 changes: 1 addition & 1 deletion defenders/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accelerator-service",
"version": "1.10.0",
"version": "1.11.0",
"description": "Accelerator integration with OZ Defenders",
"license": "MIT",
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion hashconnect/lib/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ coverage
*.log
.gitlab-ci.yml

package-lock.json
/*.tgz
/tmp*
/mnt/
Expand Down
4 changes: 2 additions & 2 deletions hashconnect/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/hashconnect",
"version": "1.10.0",
"version": "1.11.0",
"description": "hashconnect interoperability library",
"author": "Tyler Coté <[email protected]>, Nick Hanna <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -87,7 +87,7 @@
"yarn": "^1.22.17"
},
"dependencies": {
"@hashgraph/sdk": "^2.23.0",
"@hashgraph/sdk": "2.38.0",
"@hashgraph/cryptography": "1.4.3",
"buffer": "^6.0.3",
"crypto-es": "^1.2.7",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hedera-stable-coin",
"version": "1.10.0",
"version": "1.11.0",
"description": "stablecoin studio",
"scripts": {
"install": "node install.js && npm run build:cli:full && npm run prepare",
Expand Down
1 change: 1 addition & 0 deletions sdk/__tests__/port/in/Proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
*/

/* eslint-disable jest/no-disabled-tests */
import Injectable from '../../../src/core/Injectable.js';
import {
Account,
Expand Down
4 changes: 2 additions & 2 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/stablecoin-npm-sdk",
"version": "1.10.0",
"version": "1.11.0",
"description": "stablecoin studio SDK",
"main": "./build/cjs/src/index.js",
"module": "./build/esm/src/index.js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@hashgraph/cryptography": "1.4.3",
"@hashgraph/hashconnect": "file:./../hashconnect/lib",
"@hashgraph/hethers": "^1.2.5",
"@hashgraph/sdk": "^2.23.0",
"@hashgraph/sdk": "2.38.0",
"@hashgraph/stablecoin-npm-contracts": "file:./../contracts",
"@metamask/detect-provider": "^2.0.0",
"@metamask/providers": "^10.2.1",
Expand Down
82 changes: 29 additions & 53 deletions sdk/src/port/out/hs/blade/BladeTransactionAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,33 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {

async init(network?: string): Promise<string> {
const currentNetwork = network ?? this.networkService.environment;
this.bc = await BladeConnector.init(
ConnectorStrategy.EXTENSION, // preferred strategy is optional
{
// dApp metadata options are optional, but are highly recommended to use
name: 'Stablecoin Studio',
description:
'Stablecoin Studio is an open-source SDK that makes it easy for web3 stablecoin platforms, institutional issuers, enterprises, and payment providers to build stablecoin applications on the Hedera network.',
url: 'https://hedera.com/stablecoin-studio',
icons: [],
},
);
try {
this.bc = await BladeConnector.init(
ConnectorStrategy.EXTENSION, // preferred strategy is optional
{
// dApp metadata options are optional, but are highly recommended to use
name: 'Stablecoin Studio',
description:
'Stablecoin Studio is an open-source SDK that makes it easy for web3 stablecoin platforms, institutional issuers, enterprises, and payment providers to build stablecoin applications on the Hedera network.',
url: 'https://hedera.com/stablecoin-studio',
icons: [],
},
);
this.signer = this.bc.getSigner();
} catch (error: any) {
LogService.logTrace('Error initializing Blade', error);
return currentNetwork;
}
LogService.logTrace('Client Initialized');
this.eventService.emit(WalletEvents.walletFound, {
wallet: SupportedWallets.BLADE,
name: SupportedWallets.BLADE,
});

return Promise.resolve(currentNetwork);
}

async register(): Promise<InitializationData> {
LogService.logTrace('Checking for previously saved pairings: ');
const params = {
network: HederaNetwork.Testnet,
Expand All @@ -117,18 +133,13 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
}
}

this.setSigner(currentNetwork);
this.eventService.emit(WalletEvents.walletFound, {
wallet: SupportedWallets.BLADE,
name: SupportedWallets.BLADE,
});
const iniData: InitializationData = {
account: this.account,
};
this.eventService.emit(WalletEvents.walletPaired, {
data: iniData,
network: {
name: currentNetwork,
name: this.networkService.environment,
recognized: true,
factoryId: this.networkService.configuration
? this.networkService.configuration.factoryAddress
Expand All @@ -138,14 +149,6 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
});
LogService.logTrace('Previous paring found: ', this.account);

return currentNetwork;
}

private async setSigner(network: string): Promise<void> {
this.signer = this.bc.getSigner();
}

async register(): Promise<InitializationData> {
Injectable.registerTransactionHandler(this);
LogService.logTrace('Blade Registered as handler');
this.init();
Expand All @@ -159,9 +162,6 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
if (this.bc) await this.bc.killSession();

LogService.logTrace('Blade stopped');
/*this.eventService.emit(WalletEvents.walletDisconnect, {
wallet: SupportedWallets.BLADE,
});*/
return Promise.resolve(true);
}

Expand All @@ -184,15 +184,6 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
signedT = await t.freezeWithSigner(this.signer);
}
const trx = await this.signer.signTransaction(signedT);
const hashPackTrx = {
//topic: this.initData.topic,
byteArray: trx.toBytes(),
metadata: {
accountToSign: this.account.id.toString(),
returnTransaction: false,
getRecord: true,
},
};
let hashPackTransactionResponse;
if (
t instanceof TokenCreateTransaction ||
Expand All @@ -213,22 +204,8 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
hashPackTransactionResponse = await t.executeWithSigner(
this.signer,
);
/*this.logTransaction(
JSON.parse(
JSON.stringify(hashPackTransactionResponse),
).response.transactionId.toString(),
this.networkService.environment,
);*/
} else {
hashPackTransactionResponse = await this.signer.call(trx);
/*this.logTransaction(
hashPackTransactionResponse
? (hashPackTransactionResponse as any).transactionId ??
''
: (hashPackTransactionResponse as any).transactionId ??
'',
this.networkService.environment,
);*/
}
return HashpackTransactionResponseAdapter.manageResponse(
this.networkService.environment,
Expand All @@ -243,9 +220,8 @@ export class BladeTransactionAdapter extends HederaTransactionAdapter {
throw new SigningError(error);
}
}
public async restart(network: string): Promise<void> {
public async restart(): Promise<void> {
await this.stop();
//await this.init(network);
}

getAccount(): Account {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/port/out/rpc/RPCTransactionAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ export default class RPCTransactionAdapter extends TransactionAdapter {
name: SupportedWallets.METAMASK,
});
if (ethProvider.isMetaMask) {
if (!ethereum.isConnected())
if (pair && !ethereum.isConnected())
throw new WalletConnectError(
'Metamask is not connected!',
);
Expand Down
16 changes: 8 additions & 8 deletions web/package-lock.json

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

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/stablecoin-dapp",
"version": "1.10.0",
"version": "1.11.0",
"files": [
"build/"
],
Expand Down
1 change: 1 addition & 0 deletions web/src/Router/NamedRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export enum NamedRoutes {
ProofOfReserve = 'proofOfReserve',
FeesManagement = 'feesManagement',
Settings = 'settings',
AppSettings = 'appSettings',
StableCoinSettings = 'stableCoinSettings',
FactorySettings = 'factorySettings',
}
3 changes: 3 additions & 0 deletions web/src/Router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Settings from '../views/Settings';
import StableCoinSettings from '../views/Settings/StableCoin';
import FactorySettings from '../views/Settings/Factory';
import ModalWalletConnect from '../components/ModalWalletConnect';
import AppSettings from '../views/AppSettings';

const LoginOverlayRoute = ({ show, loadingSC }: { show: boolean; loadingSC: boolean }) => {
return (
Expand Down Expand Up @@ -189,13 +190,15 @@ const Router = () => {
</>
)}
<Route path={RoutesMappingUrl.settings} element={<Settings />} />

<Route path={RoutesMappingUrl.factorySettings} element={<FactorySettings />} />
<Route path={RoutesMappingUrl.stableCoinCreation} element={<StableCoinCreation />} />
<Route path={RoutesMappingUrl.importedToken} element={<ImportedTokenCreation />} />
<Route
path={RoutesMappingUrl.stableCoinNotSelected}
element={<StableCoinNotSelected />}
/>
<Route path={RoutesMappingUrl.appSettings} element={<AppSettings />} />
<Route path='*' element={<Navigate to={RoutesMappingUrl.stableCoinNotSelected} />} />
</Route>
</Routes>
Expand Down
1 change: 1 addition & 0 deletions web/src/Router/RoutesMappingUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const RoutesMappingUrl: Record<NamedRoutes, string> = {
[NamedRoutes.CheckKyc]: '/operations/check-kyc',
[NamedRoutes.FeesManagement]: '/feesManagement',
[NamedRoutes.Settings]: '/settings',
[NamedRoutes.AppSettings]: '/appSettings',
[NamedRoutes.StableCoinSettings]: '/settings/stableCoin',
[NamedRoutes.FactorySettings]: '/settings/factory',
};
Loading

0 comments on commit 2014d0d

Please sign in to comment.