@nevermined-io/core-kit 0.0.2-rc25 → 0.0.4-rc0
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/artifacts/generated.d.ts +18 -18
- package/dist/artifacts/generated.js +9 -9
- package/dist/contracts/AssetRegistry.d.ts +4 -0
- package/dist/contracts/AssetRegistry.d.ts.map +1 -1
- package/dist/contracts/AssetRegistry.js +11 -0
- package/dist/contracts/ContractBase.js +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/nevermined/api/PaymentsApi.d.ts +6 -0
- package/dist/nevermined/api/PaymentsApi.d.ts.map +1 -1
- package/dist/nevermined/api/PaymentsApi.js +37 -1
- package/dist/nevermined/utils/JwtUtils.d.ts.map +1 -1
- package/dist/nevermined/utils/JwtUtils.js +7 -3
- package/package.json +1 -1
|
@@ -4942,9 +4942,9 @@ export declare const assetsRegistryAbi: readonly [{
|
|
|
4942
4942
|
}];
|
|
4943
4943
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
4944
4944
|
}];
|
|
4945
|
-
export declare const assetsRegistryAddress: "
|
|
4945
|
+
export declare const assetsRegistryAddress: "0x9BEd07B0c6a9D69D04e8a3083340f935B7FAccD2";
|
|
4946
4946
|
export declare const assetsRegistryConfig: {
|
|
4947
|
-
readonly address: "
|
|
4947
|
+
readonly address: "0x9BEd07B0c6a9D69D04e8a3083340f935B7FAccD2";
|
|
4948
4948
|
readonly abi: readonly [{
|
|
4949
4949
|
readonly type: "function";
|
|
4950
4950
|
readonly inputs: readonly [];
|
|
@@ -11271,9 +11271,9 @@ export declare const distributePaymentsConditionAbi: readonly [{
|
|
|
11271
11271
|
}];
|
|
11272
11272
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
11273
11273
|
}];
|
|
11274
|
-
export declare const distributePaymentsConditionAddress: "
|
|
11274
|
+
export declare const distributePaymentsConditionAddress: "0x3e3dd1F8BE6D8fC49Da69279e4720649327577EB";
|
|
11275
11275
|
export declare const distributePaymentsConditionConfig: {
|
|
11276
|
-
readonly address: "
|
|
11276
|
+
readonly address: "0x3e3dd1F8BE6D8fC49Da69279e4720649327577EB";
|
|
11277
11277
|
readonly abi: readonly [{
|
|
11278
11278
|
readonly type: "function";
|
|
11279
11279
|
readonly inputs: readonly [];
|
|
@@ -12744,9 +12744,9 @@ export declare const fiatPaymentTemplateAbi: readonly [{
|
|
|
12744
12744
|
}];
|
|
12745
12745
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
12746
12746
|
}];
|
|
12747
|
-
export declare const fiatPaymentTemplateAddress: "
|
|
12747
|
+
export declare const fiatPaymentTemplateAddress: "0xe369ACB861B2880E60dc4407a5219092C55e6aD7";
|
|
12748
12748
|
export declare const fiatPaymentTemplateConfig: {
|
|
12749
|
-
readonly address: "
|
|
12749
|
+
readonly address: "0xe369ACB861B2880E60dc4407a5219092C55e6aD7";
|
|
12750
12750
|
readonly abi: readonly [{
|
|
12751
12751
|
readonly type: "function";
|
|
12752
12752
|
readonly inputs: readonly [];
|
|
@@ -13350,9 +13350,9 @@ export declare const fiatSettlementConditionAbi: readonly [{
|
|
|
13350
13350
|
}];
|
|
13351
13351
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
13352
13352
|
}];
|
|
13353
|
-
export declare const fiatSettlementConditionAddress: "
|
|
13353
|
+
export declare const fiatSettlementConditionAddress: "0xC969a62722eF13BC54c1990EA8312B221E007A82";
|
|
13354
13354
|
export declare const fiatSettlementConditionConfig: {
|
|
13355
|
-
readonly address: "
|
|
13355
|
+
readonly address: "0xC969a62722eF13BC54c1990EA8312B221E007A82";
|
|
13356
13356
|
readonly abi: readonly [{
|
|
13357
13357
|
readonly type: "function";
|
|
13358
13358
|
readonly inputs: readonly [];
|
|
@@ -13956,9 +13956,9 @@ export declare const fixedPaymentTemplateAbi: readonly [{
|
|
|
13956
13956
|
}];
|
|
13957
13957
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
13958
13958
|
}];
|
|
13959
|
-
export declare const fixedPaymentTemplateAddress: "
|
|
13959
|
+
export declare const fixedPaymentTemplateAddress: "0x37FA8A2Dd7d4Bb08b47204467Fe931d1D4B513BE";
|
|
13960
13960
|
export declare const fixedPaymentTemplateConfig: {
|
|
13961
|
-
readonly address: "
|
|
13961
|
+
readonly address: "0x37FA8A2Dd7d4Bb08b47204467Fe931d1D4B513BE";
|
|
13962
13962
|
readonly abi: readonly [{
|
|
13963
13963
|
readonly type: "function";
|
|
13964
13964
|
readonly inputs: readonly [];
|
|
@@ -18755,9 +18755,9 @@ export declare const lockPaymentConditionAbi: readonly [{
|
|
|
18755
18755
|
}];
|
|
18756
18756
|
readonly name: "UnsupportedPriceTypeOption";
|
|
18757
18757
|
}];
|
|
18758
|
-
export declare const lockPaymentConditionAddress: "
|
|
18758
|
+
export declare const lockPaymentConditionAddress: "0x2f19D5b98C15afAaC8593af23951E715A268A824";
|
|
18759
18759
|
export declare const lockPaymentConditionConfig: {
|
|
18760
|
-
readonly address: "
|
|
18760
|
+
readonly address: "0x2f19D5b98C15afAaC8593af23951E715A268A824";
|
|
18761
18761
|
readonly abi: readonly [{
|
|
18762
18762
|
readonly type: "function";
|
|
18763
18763
|
readonly inputs: readonly [];
|
|
@@ -20816,9 +20816,9 @@ export declare const nft1155CreditsAbi: readonly [{
|
|
|
20816
20816
|
}];
|
|
20817
20817
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
20818
20818
|
}];
|
|
20819
|
-
export declare const nft1155CreditsAddress: "
|
|
20819
|
+
export declare const nft1155CreditsAddress: "0x65CFA51E881dAFCcEa43F46930531629B9571DB7";
|
|
20820
20820
|
export declare const nft1155CreditsConfig: {
|
|
20821
|
-
readonly address: "
|
|
20821
|
+
readonly address: "0x65CFA51E881dAFCcEa43F46930531629B9571DB7";
|
|
20822
20822
|
readonly abi: readonly [{
|
|
20823
20823
|
readonly type: "function";
|
|
20824
20824
|
readonly inputs: readonly [];
|
|
@@ -23342,9 +23342,9 @@ export declare const nft1155ExpirableCreditsAbi: readonly [{
|
|
|
23342
23342
|
}];
|
|
23343
23343
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
23344
23344
|
}];
|
|
23345
|
-
export declare const nft1155ExpirableCreditsAddress: "
|
|
23345
|
+
export declare const nft1155ExpirableCreditsAddress: "0x5775c5144ED3c946B3d49b0F466d69385730afa5";
|
|
23346
23346
|
export declare const nft1155ExpirableCreditsConfig: {
|
|
23347
|
-
readonly address: "
|
|
23347
|
+
readonly address: "0x5775c5144ED3c946B3d49b0F466d69385730afa5";
|
|
23348
23348
|
readonly abi: readonly [{
|
|
23349
23349
|
readonly type: "function";
|
|
23350
23350
|
readonly inputs: readonly [];
|
|
@@ -29516,9 +29516,9 @@ export declare const transferCreditsConditionAbi: readonly [{
|
|
|
29516
29516
|
}];
|
|
29517
29517
|
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
29518
29518
|
}];
|
|
29519
|
-
export declare const transferCreditsConditionAddress: "
|
|
29519
|
+
export declare const transferCreditsConditionAddress: "0x35a943AB3103B12b44B31E7Dc0f9DCDd7785D6dE";
|
|
29520
29520
|
export declare const transferCreditsConditionConfig: {
|
|
29521
|
-
readonly address: "
|
|
29521
|
+
readonly address: "0x35a943AB3103B12b44B31E7Dc0f9DCDd7785D6dE";
|
|
29522
29522
|
readonly abi: readonly [{
|
|
29523
29523
|
readonly type: "function";
|
|
29524
29524
|
readonly inputs: readonly [];
|
|
@@ -2694,7 +2694,7 @@ export const assetsRegistryAbi = [
|
|
|
2694
2694
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
2695
2695
|
},
|
|
2696
2696
|
];
|
|
2697
|
-
export const assetsRegistryAddress = '
|
|
2697
|
+
export const assetsRegistryAddress = '0x9BEd07B0c6a9D69D04e8a3083340f935B7FAccD2';
|
|
2698
2698
|
export const assetsRegistryConfig = {
|
|
2699
2699
|
address: assetsRegistryAddress,
|
|
2700
2700
|
abi: assetsRegistryAbi,
|
|
@@ -6709,7 +6709,7 @@ export const distributePaymentsConditionAbi = [
|
|
|
6709
6709
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
6710
6710
|
},
|
|
6711
6711
|
];
|
|
6712
|
-
export const distributePaymentsConditionAddress = '
|
|
6712
|
+
export const distributePaymentsConditionAddress = '0x3e3dd1F8BE6D8fC49Da69279e4720649327577EB';
|
|
6713
6713
|
export const distributePaymentsConditionConfig = {
|
|
6714
6714
|
address: distributePaymentsConditionAddress,
|
|
6715
6715
|
abi: distributePaymentsConditionAbi,
|
|
@@ -7547,7 +7547,7 @@ export const fiatPaymentTemplateAbi = [
|
|
|
7547
7547
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
7548
7548
|
},
|
|
7549
7549
|
];
|
|
7550
|
-
export const fiatPaymentTemplateAddress = '
|
|
7550
|
+
export const fiatPaymentTemplateAddress = '0xe369ACB861B2880E60dc4407a5219092C55e6aD7';
|
|
7551
7551
|
export const fiatPaymentTemplateConfig = {
|
|
7552
7552
|
address: fiatPaymentTemplateAddress,
|
|
7553
7553
|
abi: fiatPaymentTemplateAbi,
|
|
@@ -7794,7 +7794,7 @@ export const fiatSettlementConditionAbi = [
|
|
|
7794
7794
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
7795
7795
|
},
|
|
7796
7796
|
];
|
|
7797
|
-
export const fiatSettlementConditionAddress = '
|
|
7797
|
+
export const fiatSettlementConditionAddress = '0xC969a62722eF13BC54c1990EA8312B221E007A82';
|
|
7798
7798
|
export const fiatSettlementConditionConfig = {
|
|
7799
7799
|
address: fiatSettlementConditionAddress,
|
|
7800
7800
|
abi: fiatSettlementConditionAbi,
|
|
@@ -8040,7 +8040,7 @@ export const fixedPaymentTemplateAbi = [
|
|
|
8040
8040
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
8041
8041
|
},
|
|
8042
8042
|
];
|
|
8043
|
-
export const fixedPaymentTemplateAddress = '
|
|
8043
|
+
export const fixedPaymentTemplateAddress = '0x37FA8A2Dd7d4Bb08b47204467Fe931d1D4B513BE';
|
|
8044
8044
|
export const fixedPaymentTemplateConfig = {
|
|
8045
8045
|
address: fixedPaymentTemplateAddress,
|
|
8046
8046
|
abi: fixedPaymentTemplateAbi,
|
|
@@ -11363,7 +11363,7 @@ export const lockPaymentConditionAbi = [
|
|
|
11363
11363
|
name: 'UnsupportedPriceTypeOption',
|
|
11364
11364
|
},
|
|
11365
11365
|
];
|
|
11366
|
-
export const lockPaymentConditionAddress = '
|
|
11366
|
+
export const lockPaymentConditionAddress = '0x2f19D5b98C15afAaC8593af23951E715A268A824';
|
|
11367
11367
|
export const lockPaymentConditionConfig = {
|
|
11368
11368
|
address: lockPaymentConditionAddress,
|
|
11369
11369
|
abi: lockPaymentConditionAbi,
|
|
@@ -12574,7 +12574,7 @@ export const nft1155CreditsAbi = [
|
|
|
12574
12574
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
12575
12575
|
},
|
|
12576
12576
|
];
|
|
12577
|
-
export const nft1155CreditsAddress = '
|
|
12577
|
+
export const nft1155CreditsAddress = '0x65CFA51E881dAFCcEa43F46930531629B9571DB7';
|
|
12578
12578
|
export const nft1155CreditsConfig = {
|
|
12579
12579
|
address: nft1155CreditsAddress,
|
|
12580
12580
|
abi: nft1155CreditsAbi,
|
|
@@ -13719,7 +13719,7 @@ export const nft1155ExpirableCreditsAbi = [
|
|
|
13719
13719
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
13720
13720
|
},
|
|
13721
13721
|
];
|
|
13722
|
-
export const nft1155ExpirableCreditsAddress = '
|
|
13722
|
+
export const nft1155ExpirableCreditsAddress = '0x5775c5144ED3c946B3d49b0F466d69385730afa5';
|
|
13723
13723
|
export const nft1155ExpirableCreditsConfig = {
|
|
13724
13724
|
address: nft1155ExpirableCreditsAddress,
|
|
13725
13725
|
abi: nft1155ExpirableCreditsAbi,
|
|
@@ -16713,7 +16713,7 @@ export const transferCreditsConditionAbi = [
|
|
|
16713
16713
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
16714
16714
|
},
|
|
16715
16715
|
];
|
|
16716
|
-
export const transferCreditsConditionAddress = '
|
|
16716
|
+
export const transferCreditsConditionAddress = '0x35a943AB3103B12b44B31E7Dc0f9DCDd7785D6dE';
|
|
16717
16717
|
export const transferCreditsConditionConfig = {
|
|
16718
16718
|
address: transferCreditsConditionAddress,
|
|
16719
16719
|
abi: transferCreditsConditionAbi,
|
|
@@ -35,6 +35,10 @@ export declare class AssetRegistry extends ContractBase {
|
|
|
35
35
|
txParams?: TxParameters;
|
|
36
36
|
}): Promise<TransactionReceipt | UserOperationReceipt>;
|
|
37
37
|
getPlan(planId: bigint): Promise<Plan>;
|
|
38
|
+
getPlanTotalPrice({ planId, plan, }: {
|
|
39
|
+
planId?: bigint;
|
|
40
|
+
plan?: Plan;
|
|
41
|
+
}): Promise<bigint>;
|
|
38
42
|
planExists(id: bigint): Promise<boolean>;
|
|
39
43
|
addPlanToAsset(planId: bigint, did: string, owner: Account | SmartAccount, txParams?: TxParameters): Promise<TransactionReceipt | UserOperationReceipt>;
|
|
40
44
|
removePlanFromAsset(planId: bigint, did: string, owner: Account | SmartAccount, txParams?: TxParameters): Promise<TransactionReceipt | UserOperationReceipt>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetRegistry.d.ts","sourceRoot":"","sources":["../../src/contracts/AssetRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAa,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAS7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EA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MAAM,EACX,KAAK,EAAE,OAAO,GAAG,YAAY,EAC7B,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,kBAAkB,GAAG,oBAAoB,CAAC;IAIxC,mBAAmB,CAC9B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,OAAO,UAAO;;;;;;;;;;;;;;;;;;;;IAwBH,UAAU,CACrB,YAAY,EAAE,WAAW,EACzB,cAAc,EAAE,aAAa,EAC7B,KAAK,EAAE,OAAO,EACd,OAAO,UAAO,EACd,KAAK,SAAK,GACT,OAAO,CAAC,MAAM,CAAC;IAcL,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAOrE,6BAA6B,CACxC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;CAOjC"}
|
|
@@ -47,6 +47,17 @@ export class AssetRegistry extends ContractBase {
|
|
|
47
47
|
else
|
|
48
48
|
throw new PlanNotFound('Plan not registered');
|
|
49
49
|
}
|
|
50
|
+
async getPlanTotalPrice({ planId, plan, }) {
|
|
51
|
+
if (!plan && !planId) {
|
|
52
|
+
throw new PlanNotFound('Plan not registered');
|
|
53
|
+
}
|
|
54
|
+
if (!plan) {
|
|
55
|
+
plan = await this.getPlan(planId);
|
|
56
|
+
}
|
|
57
|
+
if (plan.lastUpdated === 0n)
|
|
58
|
+
throw new PlanNotFound('Plan not registered');
|
|
59
|
+
return plan.price.amounts.reduce((a, b) => a + b, 0n);
|
|
60
|
+
}
|
|
50
61
|
async planExists(id) {
|
|
51
62
|
return this.contract.read.planExists([id]);
|
|
52
63
|
}
|
|
@@ -271,10 +271,10 @@ export class ContractBase extends Instantiable {
|
|
|
271
271
|
// Uncomment to debug contract calls
|
|
272
272
|
// if (name === 'createAgreement') {
|
|
273
273
|
// const functionSignature = getSignatureOfFunction(this.contract.abi, name, args)
|
|
274
|
-
// this.logger.
|
|
275
|
-
// this.logger.
|
|
276
|
-
// this.logger.
|
|
277
|
-
// this.logger.
|
|
274
|
+
// this.logger.info(`Making contract call ....: ${name} - ${from}`)
|
|
275
|
+
// this.logger.info(`With args: `, JSON.stringify(args, jsonReplacer))
|
|
276
|
+
// this.logger.info(`And signature: ${JSON.stringify(functionSignature, jsonReplacer)}`)
|
|
277
|
+
// this.logger.info('And amount: ', txparams.value)
|
|
278
278
|
// }
|
|
279
279
|
// abi.filter(({name, inputs}) => name === 'closeSignals' && inputs.length === 1)
|
|
280
280
|
// const abiFilter = this.contract.abi.filter((abi) => abi.name === name && abi.inputs.length === args.length)
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AAEjC,cAAc,4BAA4B,CAAA;AAG1C,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// export type { Account, Address } from 'viem'
|
|
2
|
-
// export { zeroAddress, isAddress } from 'viem'
|
|
3
|
-
// export type { SmartAccount } from 'viem/account-abstraction'
|
|
4
1
|
export * from './contracts/index.js';
|
|
5
2
|
export * from './models/index.js';
|
|
6
3
|
export * from './nevermined/index.js';
|
|
@@ -10,6 +10,12 @@ export declare class PaymentsApi extends Instantiable {
|
|
|
10
10
|
*/
|
|
11
11
|
constructor(config: InstantiableConfig);
|
|
12
12
|
getERC20Balance(userAddress: Address, tokenAddress: Address): Promise<bigint>;
|
|
13
|
+
getPlanFees(planId: bigint): Promise<{
|
|
14
|
+
cryptoFeeRate: bigint;
|
|
15
|
+
fiatFeeRate: bigint;
|
|
16
|
+
feeDenominator: bigint;
|
|
17
|
+
totalAmount: bigint;
|
|
18
|
+
}>;
|
|
13
19
|
orderFiatPayment(planId: bigint, planReceiver: Address, from: Account | SmartAccount): Promise<OrderResult>;
|
|
14
20
|
orderCryptoPayment(planId: bigint, plan: Plan, from: Account | SmartAccount): Promise<OrderResult>;
|
|
15
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentsApi.d.ts","sourceRoot":"","sources":["../../../src/nevermined/api/PaymentsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"PaymentsApi.d.ts","sourceRoot":"","sources":["../../../src/nevermined/api/PaymentsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAoC,MAAM,MAAM,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,IAAI,EAA8B,MAAM,uBAAuB,CAAA;AAQrF,qBAAa,WAAY,SAAQ,YAAY;IAC3C;;;;OAIG;gBACS,MAAM,EAAE,kBAAkB;IAKzB,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB7E,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAChD,aAAa,EAAE,MAAM,CAAA;QACrB,WAAW,EAAE,MAAM,CAAA;QACnB,cAAc,EAAE,MAAM,CAAA;QACtB,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC;IAkCW,gBAAgB,CAC3B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,GAAG,YAAY,GAC3B,OAAO,CAAC,WAAW,CAAC;IA0BV,kBAAkB,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,OAAO,GAAG,YAAY,GAC3B,OAAO,CAAC,WAAW,CAAC;CAmFxB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { parseAbi, zeroAddress } from 'viem';
|
|
1
|
+
import { isAddress, parseAbi, zeroAddress } from 'viem';
|
|
2
2
|
import { Instantiable } from '../../Instantiable.abstract.js';
|
|
3
3
|
import { PlanTransactionPaymentType } from '@nvm-monorepo/commons';
|
|
4
4
|
import { NotEnoughBalance } from '../../errors/NeverminedErrors.js';
|
|
5
5
|
const TOKEN_BALANCE_ABI = parseAbi(['function balanceOf(address) view returns (uint256)']);
|
|
6
|
+
const GET_FEE_RATES_ABI = parseAbi([
|
|
7
|
+
'function getFeeRates() view returns (uint256, uint256, uint256)',
|
|
8
|
+
]);
|
|
6
9
|
export class PaymentsApi extends Instantiable {
|
|
7
10
|
/**
|
|
8
11
|
* Creates a new PaymentsApi
|
|
@@ -27,9 +30,42 @@ export class PaymentsApi extends Instantiable {
|
|
|
27
30
|
}
|
|
28
31
|
return 0n;
|
|
29
32
|
}
|
|
33
|
+
async getPlanFees(planId) {
|
|
34
|
+
try {
|
|
35
|
+
const plan = await this.nevermined.contracts.assetRegistry.getPlan(planId);
|
|
36
|
+
let feeControllerAddress;
|
|
37
|
+
if (plan.price.feeController &&
|
|
38
|
+
isAddress(plan.price.feeController) &&
|
|
39
|
+
plan.price.feeController !== zeroAddress) {
|
|
40
|
+
feeControllerAddress = plan.price.feeController;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
feeControllerAddress = await this.nevermined.contracts.nvmConfig.getDefaultFeeController();
|
|
44
|
+
}
|
|
45
|
+
const result = await this.client.public.readContract({
|
|
46
|
+
address: feeControllerAddress,
|
|
47
|
+
abi: GET_FEE_RATES_ABI,
|
|
48
|
+
functionName: 'getFeeRates',
|
|
49
|
+
args: [],
|
|
50
|
+
});
|
|
51
|
+
const totalAmount = plan.price.amounts.reduce((a, b) => a + b, 0n);
|
|
52
|
+
return {
|
|
53
|
+
cryptoFeeRate: result[0],
|
|
54
|
+
fiatFeeRate: result[1],
|
|
55
|
+
feeDenominator: result[2],
|
|
56
|
+
totalAmount,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
this.logger.error(`Error fetching plan fee for planId ${planId}:`, error);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
30
64
|
async orderFiatPayment(planId, planReceiver, from) {
|
|
31
65
|
const plan = await this.nevermined.contracts.assetRegistry.getPlan(planId);
|
|
32
66
|
const totalAmount = plan.price.amounts.reduce((a, b) => a + b, 0n);
|
|
67
|
+
// console.log(`Ordering fiat payment for planId ${planId} to ${planReceiver} from account ${from.address} `)
|
|
68
|
+
this.logger.info(`Ordering fiat payment for planId ${planId} to ${planReceiver} from account ${from.address} `);
|
|
33
69
|
const txHash = await this.nevermined.contracts.fiatPaymentTemplate.createAgreement(planId, planReceiver, from);
|
|
34
70
|
const txReceipt = await this.nevermined.contracts.assetRegistry.getTransactionReceipt(txHash);
|
|
35
71
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JwtUtils.d.ts","sourceRoot":"","sources":["../../../src/nevermined/utils/JwtUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,KAAK,mBAAmB,EAAE,OAAO,EAAwB,MAAM,MAAM,CAAA;AAC9E,OAAO,EAAE,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"JwtUtils.d.ts","sourceRoot":"","sources":["../../../src/nevermined/utils/JwtUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,KAAK,mBAAm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CAAC,aAAa,EAAE,MAAM;CAK3C"}
|
|
@@ -5,7 +5,6 @@ import { Instantiable } from '../../Instantiable.abstract.js';
|
|
|
5
5
|
import { urlSafeBase64Decode, urlSafeBase64Encode } from '../../utils/helpers.js';
|
|
6
6
|
import { getChecksumAddress } from './BlockchainViemUtils.js';
|
|
7
7
|
import { SignatureUtils } from './SignatureUtils.js';
|
|
8
|
-
import { NVM_INFRA_ADMIN_ROLE } from '../../contracts/Roles.js';
|
|
9
8
|
export class EthSignJWT extends SignJWT {
|
|
10
9
|
protectedHeader;
|
|
11
10
|
setProtectedHeader(protectedHeader) {
|
|
@@ -123,10 +122,15 @@ export class JwtUtils extends Instantiable {
|
|
|
123
122
|
};
|
|
124
123
|
}
|
|
125
124
|
const address = getChecksumAddress(account.address);
|
|
126
|
-
|
|
125
|
+
// Not need it, but stay commented. If we need to bring back roles to update endpoints based on wallet with roles.
|
|
126
|
+
// const isAdmin = await this.nevermined.contracts.accessManager.hasRole(
|
|
127
|
+
// NVM_INFRA_ADMIN_ROLE,
|
|
128
|
+
// address as Address,
|
|
129
|
+
// )
|
|
127
130
|
return new EthSignJWT({
|
|
128
131
|
iss: address,
|
|
129
|
-
roles: isAdmin[0] ? ['admin'] : [],
|
|
132
|
+
// roles: isAdmin[0] ? ['admin'] : [],
|
|
133
|
+
roles: [],
|
|
130
134
|
})
|
|
131
135
|
.setProtectedHeader({ alg: 'ES256K' })
|
|
132
136
|
.setIssuedAt()
|