New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hemergy/core-sdk

Package Overview
Dependencies
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hemergy/core-sdk - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

6

lib/index.d.ts

@@ -14,2 +14,3 @@ import { AxiosInstance } from 'axios';

getMeta(): Promise<Meta>;
private signAndBroadcast;
getContracts(): Promise<{

@@ -20,5 +21,10 @@ accountsFactoryContract: ethers.Contract;

getSignerAddress(): Promise<string>;
approveAccountAmount(accountAddress: string, projectAddress: string, tokenAddress: string, amount: number): Promise<void>;
createAccount(): Promise<string>;
createProject(accountAddress: string, beneficiaries?: string[]): Promise<string>;
addProjectBeneficiaries(projectAddress: string, beneficiaryAddress: string): Promise<void>;
investInProject(projectAddress: string, investorAccountAddress: string, amount: number): Promise<void>;
divestInProject(projectAddress: string, investorAccountAddress: string, amount: number): Promise<void>;
mint(address: string): Promise<number>;
isKYCed(accountAddress: string): Promise<boolean>;
}

66

lib/index.js

@@ -32,2 +32,10 @@ "use strict";

}
signAndBroadcast(url, payload) {
return __awaiter(this, void 0, void 0, function* () {
const { data: { request, domain, ForwardRequest }, } = yield this.axiosClient.post(url, payload);
const signature = yield this.signer._signTypedData(domain, { ForwardRequest }, request);
const { data } = yield this.axiosClient.post('/relayer', { signature, request });
return data;
});
}
getContracts() {

@@ -50,2 +58,14 @@ return __awaiter(this, void 0, void 0, function* () {

}
approveAccountAmount(accountAddress, projectAddress, tokenAddress, amount) {
return __awaiter(this, void 0, void 0, function* () {
const signerAddress = yield this.getSignerAddress();
yield this.signAndBroadcast(`/accounts/${accountAddress}/approve`, {
endUserAddress: signerAddress,
accountAddress,
tokenAddress,
projectAddress,
amount,
});
});
}
createAccount() {

@@ -57,5 +77,3 @@ return __awaiter(this, void 0, void 0, function* () {

]);
const { data: { request, domain, ForwardRequest }, } = yield this.axiosClient.post('/accounts', { endUserAddress: signerAddress });
const signature = yield this.signer._signTypedData(domain, { ForwardRequest }, request);
const { data: { logs }, } = yield this.axiosClient.post('/relayer', { signature, request });
const { logs } = yield this.signAndBroadcast('/accounts', { endUserAddress: signerAddress });
const accountEvent = accountsFactoryContract.interface.parseLog(logs[0]);

@@ -72,3 +90,3 @@ const accountAddress = accountEvent.args.account;

]);
const { data: { request, domain, ForwardRequest }, } = yield this.axiosClient.post('/projects', {
const { logs } = yield this.signAndBroadcast('/projects', {
endUserAddress: signerAddress,

@@ -78,4 +96,2 @@ projectHolder: accountAddress,

});
const signature = yield this.signer._signTypedData(domain, { ForwardRequest }, request);
const { data: { logs }, } = yield this.axiosClient.post('/relayer', { signature, request });
const projectEvent = projectsFactoryContract.interface.parseLog(logs[0]);

@@ -86,2 +102,40 @@ const projectAddress = projectEvent.args.project;

}
addProjectBeneficiaries(projectAddress, beneficiaryAddress) {
return __awaiter(this, void 0, void 0, function* () {
const signerAddress = yield this.getContracts();
yield this.signAndBroadcast(`/projects/${projectAddress}/beneficiaries`, {
endUserAddress: signerAddress,
projectAddress,
beneficiaryAddress,
});
});
}
investInProject(projectAddress, investorAccountAddress, amount) {
return __awaiter(this, void 0, void 0, function* () {
const signerAddress = yield this.getContracts();
yield this.signAndBroadcast(`/projects/${projectAddress}/invest`, {
endUserAddress: signerAddress,
projectAddress,
investorAccountAddress,
amount,
});
});
}
divestInProject(projectAddress, investorAccountAddress, amount) {
return __awaiter(this, void 0, void 0, function* () {
const signerAddress = yield this.getContracts();
yield this.signAndBroadcast(`/projects/${projectAddress}/divest`, {
endUserAddress: signerAddress,
projectAddress,
investorAccountAddress,
amount,
});
});
}
mint(address) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.axiosClient.post('bank/mint', { address });
return data;
});
}
isKYCed(accountAddress) {

@@ -88,0 +142,0 @@ return __awaiter(this, void 0, void 0, function* () {

2

package.json
{
"name": "@hemergy/core-sdk",
"version": "0.0.2",
"version": "0.0.3",
"description": "TypeScript NPM Module for Hemergy Core",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc