@dripfi/drip-sdk 1.4.26-slot-machine-2 → 1.4.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/PerqApi.d.ts CHANGED
@@ -25,7 +25,6 @@ export default class PerqApi {
25
25
  fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
26
26
  fetchAllSpecialEditionLoyaltyCards(): Promise<SpecialEditionLoyaltyCard[]>;
27
27
  fetchOwnedLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
28
- fetchNextLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
29
28
  fetchOwnedSpecialEditionLoyaltyCards(walletAddress: string): Promise<SpecialEditionLoyaltyCard[]>;
30
29
  fetchBeansBalance(walletAddress: string): Promise<BeansBalance>;
31
30
  upgradeLoyaltyCard(signedPayload: NonceEnrichedSignedPayload<UpgradeLoyaltyCardPayload>): Promise<LoyaltyCard>;
package/dist/PerqApi.js CHANGED
@@ -175,8 +175,6 @@ class PerqApi {
175
175
  level: card.level,
176
176
  cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), PERQ_TOKEN_DECIMALS)),
177
177
  boost: card.boost,
178
- chanceToUpgrade: card.chanceToUpgrade,
179
- minBurnPerSpin: card.minBurnPerSpin,
180
178
  }));
181
179
  }
182
180
  else {
@@ -206,29 +204,6 @@ class PerqApi {
206
204
  level: data.level,
207
205
  cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
208
206
  boost: data.boost,
209
- chanceToUpgrade: data.chanceToUpgrade,
210
- minBurnPerSpin: data.minBurnPerSpin,
211
- };
212
- }
213
- else {
214
- throw Error(`${await res.text()}`);
215
- }
216
- }
217
- async fetchNextLoyaltyCard(walletAddress) {
218
- const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/loyaltyCards/next`);
219
- if (res.status === 204) {
220
- return {};
221
- }
222
- if (res.ok) {
223
- const data = await res.json();
224
- return {
225
- id: data.id,
226
- tier: data.tier,
227
- level: data.level,
228
- cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
229
- boost: data.boost,
230
- chanceToUpgrade: data.chanceToUpgrade,
231
- minBurnPerSpin: data.minBurnPerSpin,
232
207
  };
233
208
  }
234
209
  else {
@@ -276,8 +251,6 @@ class PerqApi {
276
251
  level: data.level,
277
252
  cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
278
253
  boost: data.boost,
279
- chanceToUpgrade: data.chanceToUpgrade,
280
- minBurnPerSpin: data.minBurnPerSpin,
281
254
  };
282
255
  }
283
256
  else {
package/dist/PerqSdk.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Signer, ethers } from 'ethers';
2
2
  import { PerqConfig } from './types';
3
3
  import PerqApi from './PerqApi';
4
- import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract, SlotBurnTokenContract } from './contracts';
4
+ import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract } from './contracts';
5
5
  import VestingPackage from './subpackages/VestingPackage';
6
6
  import LitePackage from './subpackages/LitePackage';
7
7
  import RecyclerPackage from './subpackages/RecyclerPackage';
@@ -28,7 +28,6 @@ export default class PerqSdk {
28
28
  perqVestingContract: PerqVestingContract;
29
29
  perqTokenRecyclerContract: PerqTokenRecyclerContract;
30
30
  perqSwapAndRecyclerContract: PerqSwapAndRecyclerContract;
31
- slotBurnTokenContract: SlotBurnTokenContract;
32
31
  constructor(perqConfig: PerqConfig, chainId: PerqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
33
32
  updateSigner(newSigner: Signer, chainId: PerqSupportedChainId): Promise<void>;
34
33
  }
package/dist/PerqSdk.js CHANGED
@@ -30,7 +30,6 @@ class PerqSdk {
30
30
  perqVestingContract;
31
31
  perqTokenRecyclerContract;
32
32
  perqSwapAndRecyclerContract;
33
- slotBurnTokenContract;
34
33
  constructor(perqConfig, chainId, provider) {
35
34
  this.perqConfig = perqConfig;
36
35
  const newSigner = provider?.getSigner();
@@ -50,7 +49,6 @@ class PerqSdk {
50
49
  this.perqVestingContract = new contracts_1.PerqVestingContract(this);
51
50
  this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
52
51
  this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
53
- this.slotBurnTokenContract = new contracts_1.SlotBurnTokenContract(this);
54
52
  }
55
53
  async updateSigner(newSigner, chainId) {
56
54
  this.signer = newSigner;
@@ -58,7 +56,6 @@ class PerqSdk {
58
56
  this.perqVestingContract = new contracts_1.PerqVestingContract(this);
59
57
  this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
60
58
  this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
61
- this.slotBurnTokenContract = new contracts_1.SlotBurnTokenContract(this);
62
59
  }
63
60
  }
64
61
  exports.default = PerqSdk;
@@ -71,62 +71,5 @@ declare const _default: {
71
71
  stateMutability: string;
72
72
  type: string;
73
73
  }[];
74
- readonly SLOT_BURN_TOKEN_ABI: ({
75
- inputs: {
76
- internalType: string;
77
- name: string;
78
- type: string;
79
- }[];
80
- stateMutability: string;
81
- type: string;
82
- name?: undefined;
83
- anonymous?: undefined;
84
- outputs?: undefined;
85
- } | {
86
- inputs: {
87
- internalType: string;
88
- name: string;
89
- type: string;
90
- }[];
91
- name: string;
92
- type: string;
93
- stateMutability?: undefined;
94
- anonymous?: undefined;
95
- outputs?: undefined;
96
- } | {
97
- anonymous: boolean;
98
- inputs: {
99
- indexed: boolean;
100
- internalType: string;
101
- name: string;
102
- type: string;
103
- }[];
104
- name: string;
105
- type: string;
106
- stateMutability?: undefined;
107
- outputs?: undefined;
108
- } | {
109
- inputs: never[];
110
- name: string;
111
- outputs: {
112
- internalType: string;
113
- name: string;
114
- type: string;
115
- }[];
116
- stateMutability: string;
117
- type: string;
118
- anonymous?: undefined;
119
- } | {
120
- inputs: {
121
- internalType: string;
122
- name: string;
123
- type: string;
124
- }[];
125
- name: string;
126
- outputs: never[];
127
- stateMutability: string;
128
- type: string;
129
- anonymous?: undefined;
130
- })[];
131
74
  };
132
75
  export default _default;
package/dist/abi/index.js CHANGED
@@ -8,12 +8,10 @@ const WethTokenAbi_json_1 = __importDefault(require("./WethTokenAbi.json"));
8
8
  const PerqTokenAbi_json_1 = __importDefault(require("./PerqTokenAbi.json"));
9
9
  const TokenRecyclerAbi_json_1 = __importDefault(require("./TokenRecyclerAbi.json"));
10
10
  const PerqVestingAbi_json_1 = __importDefault(require("./PerqVestingAbi.json"));
11
- const SlotBurnTokenAbi_json_1 = __importDefault(require("./SlotBurnTokenAbi.json"));
12
11
  exports.default = {
13
12
  PERQ_SWAP_AND_RECYCLER_ABI: PerqSwapAndRecyclerAbi_json_1.default,
14
13
  WETH_TOKEN_ABI: WethTokenAbi_json_1.default,
15
14
  PERQ_TOKEN_ABI: PerqTokenAbi_json_1.default,
16
15
  TOKEN_RECYCLER_ABI: TokenRecyclerAbi_json_1.default,
17
16
  PERQ_VESTING_ABI: PerqVestingAbi_json_1.default,
18
- SLOT_BURN_TOKEN_ABI: SlotBurnTokenAbi_json_1.default,
19
17
  };
@@ -3,5 +3,4 @@ import PerqSwapAndRecyclerContract from './PerqSwapAndRecyclerContract';
3
3
  import PerqTokenRecyclerContract from './PerqTokenRecyclerContract';
4
4
  import PerqTokenContract from './PerqTokenContract';
5
5
  import PerqVestingContract from './PerqVestingContract';
6
- import SlotBurnTokenContract from './SlotBurnTokenContract';
7
- export { BasePerqContract, PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqTokenContract, PerqVestingContract, SlotBurnTokenContract, };
6
+ export { BasePerqContract, PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqTokenContract, PerqVestingContract, };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SlotBurnTokenContract = exports.PerqVestingContract = exports.PerqTokenContract = exports.PerqTokenRecyclerContract = exports.PerqSwapAndRecyclerContract = exports.BasePerqContract = void 0;
6
+ exports.PerqVestingContract = exports.PerqTokenContract = exports.PerqTokenRecyclerContract = exports.PerqSwapAndRecyclerContract = exports.BasePerqContract = void 0;
7
7
  const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
8
8
  exports.BasePerqContract = BasePerqContract_1.default;
9
9
  const PerqSwapAndRecyclerContract_1 = __importDefault(require("./PerqSwapAndRecyclerContract"));
@@ -14,5 +14,3 @@ const PerqTokenContract_1 = __importDefault(require("./PerqTokenContract"));
14
14
  exports.PerqTokenContract = PerqTokenContract_1.default;
15
15
  const PerqVestingContract_1 = __importDefault(require("./PerqVestingContract"));
16
16
  exports.PerqVestingContract = PerqVestingContract_1.default;
17
- const SlotBurnTokenContract_1 = __importDefault(require("./SlotBurnTokenContract"));
18
- exports.SlotBurnTokenContract = SlotBurnTokenContract_1.default;
@@ -8,12 +8,8 @@ export default class LoyaltyPackage {
8
8
  getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
9
9
  upgradeLoyaltyCard(index: number): Promise<LoyaltyCard>;
10
10
  getOwnedLoyaltyCard(): Promise<LoyaltyCard>;
11
- getNextLoyaltyCard(): Promise<LoyaltyCard>;
12
11
  getAllLoyaltyCards(): Promise<LoyaltyCard[]>;
13
12
  claimSpecialEditionCard(cardId: string): Promise<SpecialEditionLoyaltyCard>;
14
13
  getOwnedSpecialEditionCards(): Promise<SpecialEditionLoyaltyCard[]>;
15
14
  getAllSpecialEditionCards(): Promise<SpecialEditionLoyaltyCard[]>;
16
- approveForSlotSpin(tokenAddress: string, amount: string): Promise<string>;
17
- runSlotSpin(isDepositNative: boolean): Promise<LoyaltyCard | null>;
18
- private seededRandom;
19
15
  }
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const ethers_1 = require("ethers");
7
- const ERC20TokenContract_1 = __importDefault(require("../contracts/ERC20TokenContract"));
8
3
  class LoyaltyPackage {
9
4
  perqSdk;
10
5
  constructor(perqSdk) {
@@ -32,10 +27,6 @@ class LoyaltyPackage {
32
27
  const signerAddress = await this.perqSdk.signer.getAddress();
33
28
  return this.perqSdk.perqApi.fetchOwnedLoyaltyCard(signerAddress);
34
29
  }
35
- async getNextLoyaltyCard() {
36
- const signerAddress = await this.perqSdk.signer.getAddress();
37
- return this.perqSdk.perqApi.fetchNextLoyaltyCard(signerAddress);
38
- }
39
30
  async getAllLoyaltyCards() {
40
31
  return this.perqSdk.perqApi.fetchAllLoyaltyCards();
41
32
  }
@@ -53,42 +44,5 @@ class LoyaltyPackage {
53
44
  async getAllSpecialEditionCards() {
54
45
  return this.perqSdk.perqApi.fetchAllSpecialEditionLoyaltyCards();
55
46
  }
56
- async approveForSlotSpin(tokenAddress, amount) {
57
- if (!this.perqSdk.signer) {
58
- throw Error('No signer provided');
59
- }
60
- const tokenContract = new ERC20TokenContract_1.default(tokenAddress, this.perqSdk.signer);
61
- const decimals = await tokenContract.getPrecission();
62
- const parsedAmountToApprove = ethers_1.ethers.utils.parseUnits(amount, decimals);
63
- const slotBurnTokenContractAddress = this.perqSdk.slotBurnTokenContract.getContractAddress();
64
- return await tokenContract.approveToken(slotBurnTokenContractAddress, parsedAmountToApprove.toBigInt());
65
- }
66
- async runSlotSpin(isDepositNative) {
67
- const signerAddress = await this.perqSdk.signer.getAddress();
68
- const nextLoyaltyCard = await this.perqSdk.perqApi.fetchNextLoyaltyCard(signerAddress);
69
- const amountForSpin = nextLoyaltyCard.minBurnPerSpin;
70
- const loyaltyCardOwnedChancesToWin = nextLoyaltyCard.chanceToUpgrade;
71
- const formattedAmountForSpin = ethers_1.ethers.utils.parseUnits(amountForSpin.toString(), 18);
72
- const depositResult = isDepositNative
73
- ? await this.perqSdk.slotBurnTokenContract.depositNative(formattedAmountForSpin.toString())
74
- : await this.perqSdk.slotBurnTokenContract.deposit(formattedAmountForSpin.toString());
75
- const txHash = depositResult.hash;
76
- const randomValue = this.seededRandom(txHash);
77
- const upgradeWon = randomValue * 100 <= loyaltyCardOwnedChancesToWin && loyaltyCardOwnedChancesToWin !== 0;
78
- return upgradeWon ? nextLoyaltyCard : null;
79
- }
80
- seededRandom(input) {
81
- // Convert input string to bytes
82
- const inputBytes = ethers_1.ethers.utils.toUtf8Bytes(input);
83
- // Hash using keccak256
84
- const hash = ethers_1.ethers.utils.keccak256(inputBytes);
85
- // Convert to a Buffer from hex string (strip 0x)
86
- const hashBuffer = new Uint8Array(ethers_1.ethers.utils.arrayify(hash));
87
- const dataView = new DataView(hashBuffer.buffer);
88
- // Read first 8 bytes as BigUInt64
89
- const num = dataView.getBigUint64(0);
90
- // Normalize to [0, 1)
91
- return Number(num % BigInt(1e12)) / 1e12;
92
- }
93
47
  }
94
48
  exports.default = LoyaltyPackage;
@@ -5,7 +5,5 @@ type LoyaltyCard = {
5
5
  level: number;
6
6
  cost: number;
7
7
  boost: number;
8
- chanceToUpgrade: number;
9
- minBurnPerSpin: number;
10
8
  };
11
9
  export default LoyaltyCard;
@@ -6,6 +6,8 @@ type MyPerqBalance = {
6
6
  earnedRewardsUsd: number;
7
7
  rewardsPerHour: number;
8
8
  rewardsPerHourUsd: number;
9
+ rewardsPerDay: number;
10
+ rewardsPerDayUsd: number;
9
11
  };
10
12
  type MyPerqData = VaultData & MyPerqBalance & {
11
13
  ethPrice: number;
@@ -5,7 +5,6 @@ type PerqConfig = {
5
5
  perqTokenAddress: string;
6
6
  perqTokenRecyclerAddress: string;
7
7
  perqSwapAndRecyclerAddress: string;
8
- slotBurnTokenAddress: string;
9
8
  perqVestingAddress: string;
10
9
  swapAndDepositContractAddress: string;
11
10
  ethereumSwapperAddress: string;
@@ -12,7 +12,6 @@ exports.PRODUCTION = {
12
12
  swapAndDepositContractAddress: '0xd8534197bd587f8226d12e0c864ef2cae6f82f5c',
13
13
  ethereumSwapperAddress: '0x33e52c206d584550193e642c8982f2fff6339994',
14
14
  smartVaultManagerContractAddress: '0x23daf34e2b9af02a74dc19cb52af727b19403874',
15
- slotBurnTokenAddress: '0xf9baae6b27093099f9821bdc7f4e29c770e8abe7',
16
15
  };
17
16
  exports.DEVELOPMENT = {
18
17
  route: 'https://dev.perq.finance',
@@ -23,5 +22,4 @@ exports.DEVELOPMENT = {
23
22
  swapAndDepositContractAddress: '0x5fb08e00de169f041711206a0995410884080177',
24
23
  ethereumSwapperAddress: '0xe411921ee9eedfefd7b9ae15bf232bd36949fcbbc',
25
24
  smartVaultManagerContractAddress: '0x2638d6c0b4ef6dee04050fa0b07ca62500435747',
26
- slotBurnTokenAddress: '0xf9baae6b27093099f9821bdc7f4e29c770e8abe7',
27
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.4.26-slot-machine-2",
3
+ "version": "1.4.27",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,86 +0,0 @@
1
- [
2
- {
3
- "inputs": [{ "internalType": "address", "name": "admin", "type": "address" }],
4
- "stateMutability": "nonpayable",
5
- "type": "constructor"
6
- },
7
- {
8
- "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
9
- "name": "OwnableInvalidOwner",
10
- "type": "error"
11
- },
12
- {
13
- "inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
14
- "name": "OwnableUnauthorizedAccount",
15
- "type": "error"
16
- },
17
- {
18
- "inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
19
- "name": "SafeERC20FailedOperation",
20
- "type": "error"
21
- },
22
- {
23
- "anonymous": false,
24
- "inputs": [
25
- { "indexed": true, "internalType": "address", "name": "depositor", "type": "address" },
26
- { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
27
- ],
28
- "name": "Deposit",
29
- "type": "event"
30
- },
31
- {
32
- "anonymous": false,
33
- "inputs": [
34
- { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
35
- { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
36
- ],
37
- "name": "OwnershipTransferred",
38
- "type": "event"
39
- },
40
- {
41
- "anonymous": false,
42
- "inputs": [
43
- { "indexed": true, "internalType": "address", "name": "to", "type": "address" },
44
- { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
45
- ],
46
- "name": "Withdraw",
47
- "type": "event"
48
- },
49
- {
50
- "inputs": [],
51
- "name": "WRAPPED_SONIC",
52
- "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
53
- "stateMutability": "view",
54
- "type": "function"
55
- },
56
- {
57
- "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
58
- "name": "deposit",
59
- "outputs": [],
60
- "stateMutability": "nonpayable",
61
- "type": "function"
62
- },
63
- { "inputs": [], "name": "depositNative", "outputs": [], "stateMutability": "payable", "type": "function" },
64
- {
65
- "inputs": [],
66
- "name": "owner",
67
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
68
- "stateMutability": "view",
69
- "type": "function"
70
- },
71
- { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
72
- {
73
- "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
74
- "name": "transferOwnership",
75
- "outputs": [],
76
- "stateMutability": "nonpayable",
77
- "type": "function"
78
- },
79
- {
80
- "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
81
- "name": "withdraw",
82
- "outputs": [],
83
- "stateMutability": "nonpayable",
84
- "type": "function"
85
- }
86
- ]
@@ -1,8 +0,0 @@
1
- import { ContractTransaction } from 'ethers';
2
- import BasePerqContract from './BasePerqContract';
3
- import PerqSdk from '../PerqSdk';
4
- export default class SlotBurnTokenContract extends BasePerqContract {
5
- constructor(perqSdk: PerqSdk);
6
- deposit(amount: string): Promise<ContractTransaction>;
7
- depositNative(amount: string): Promise<ContractTransaction>;
8
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ethers_1 = require("ethers");
7
- const SlotBurnTokenAbi_json_1 = __importDefault(require("../abi/SlotBurnTokenAbi.json"));
8
- const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
9
- class SlotBurnTokenContract extends BasePerqContract_1.default {
10
- constructor(perqSdk) {
11
- super(perqSdk.perqConfig.slotBurnTokenAddress, new ethers_1.ethers.utils.Interface(SlotBurnTokenAbi_json_1.default), perqSdk.signer);
12
- }
13
- async deposit(amount) {
14
- if (!this.contract.signer) {
15
- throw Error('No signer provided');
16
- }
17
- return await this.contract.deposit(amount.toString());
18
- }
19
- async depositNative(amount) {
20
- if (!this.contract.signer) {
21
- throw Error('No signer provided');
22
- }
23
- return await this.contract.depositNative({ value: amount.toString() });
24
- }
25
- }
26
- exports.default = SlotBurnTokenContract;