@nevermined-io/core-kit 0.0.2-rc22 → 0.0.2-rc25
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 +166 -32
- package/dist/artifacts/generated.d.ts.map +1 -1
- package/dist/artifacts/generated.js +124 -16
- package/dist/contracts/AssetRegistry.d.ts.map +1 -1
- package/dist/contracts/AssetRegistry.js +2 -1
- package/dist/contracts/ContractBase.d.ts +9 -0
- package/dist/contracts/ContractBase.d.ts.map +1 -1
- package/dist/contracts/ContractBase.js +102 -9
- package/dist/contracts/FixedPaymentTemplate.d.ts +4 -1
- package/dist/contracts/FixedPaymentTemplate.d.ts.map +1 -1
- package/dist/contracts/FixedPaymentTemplate.js +46 -1
- package/dist/models/AgentAccessToken.d.ts +123 -0
- package/dist/models/AgentAccessToken.d.ts.map +1 -0
- package/dist/models/AgentAccessToken.js +164 -0
- package/dist/models/NeverminedOptions.d.ts +1 -14
- package/dist/models/NeverminedOptions.d.ts.map +1 -1
- package/dist/models/NeverminedOptions.js +1 -19
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +1 -0
- package/dist/nevermined/api/PaymentsApi.d.ts +0 -1
- package/dist/nevermined/api/PaymentsApi.d.ts.map +1 -1
- package/dist/nevermined/api/PaymentsApi.js +14 -32
- package/dist/nevermined/utils/AgentUtils.d.ts +8 -0
- package/dist/nevermined/utils/AgentUtils.d.ts.map +1 -0
- package/dist/nevermined/utils/AgentUtils.js +42 -0
- package/dist/nevermined/utils/JwtUtils.d.ts.map +1 -1
- package/dist/nevermined/utils/JwtUtils.js +3 -0
- package/dist/nevermined/utils/WebServiceConnector.d.ts +1 -1
- package/dist/nevermined/utils/WebServiceConnector.d.ts.map +1 -1
- package/dist/nevermined/utils/WebServiceConnector.js +4 -1
- package/dist/nevermined/utils/ZeroDevPolicies.d.ts.map +1 -1
- package/dist/nevermined/utils/ZeroDevPolicies.js +4 -1
- package/dist/nevermined/utils/index.d.ts +1 -0
- package/dist/nevermined/utils/index.d.ts.map +1 -1
- package/dist/nevermined/utils/index.js +1 -0
- package/dist/services/Api.d.ts +1 -1
- package/dist/services/Api.d.ts.map +1 -1
- package/dist/services/Api.js +3 -3
- package/package.json +1 -1
|
@@ -808,7 +808,7 @@ export const accessManagerAbi = [
|
|
|
808
808
|
name: 'SafeCastOverflowedUintDowncast',
|
|
809
809
|
},
|
|
810
810
|
];
|
|
811
|
-
export const accessManagerAddress = '
|
|
811
|
+
export const accessManagerAddress = '0x881028e31e3FC6D7c9a4Cb8b63a3cDd681bc2b61';
|
|
812
812
|
export const accessManagerConfig = {
|
|
813
813
|
address: accessManagerAddress,
|
|
814
814
|
abi: accessManagerAbi,
|
|
@@ -1192,7 +1192,7 @@ export const agreementsStoreAbi = [
|
|
|
1192
1192
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
1193
1193
|
},
|
|
1194
1194
|
];
|
|
1195
|
-
export const agreementsStoreAddress = '
|
|
1195
|
+
export const agreementsStoreAddress = '0xc7380BF441CB6D83322D1Eaf56e9270994f5f768';
|
|
1196
1196
|
export const agreementsStoreConfig = {
|
|
1197
1197
|
address: agreementsStoreAddress,
|
|
1198
1198
|
abi: agreementsStoreAbi,
|
|
@@ -2694,7 +2694,7 @@ export const assetsRegistryAbi = [
|
|
|
2694
2694
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
2695
2695
|
},
|
|
2696
2696
|
];
|
|
2697
|
-
export const assetsRegistryAddress = '
|
|
2697
|
+
export const assetsRegistryAddress = '0x6262dA4dBEF308fC0cc9Ccef61BA1D35850Ae5ff';
|
|
2698
2698
|
export const assetsRegistryConfig = {
|
|
2699
2699
|
address: assetsRegistryAddress,
|
|
2700
2700
|
abi: assetsRegistryAbi,
|
|
@@ -4399,6 +4399,60 @@ export const baseTestAbi = [
|
|
|
4399
4399
|
},
|
|
4400
4400
|
];
|
|
4401
4401
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
4402
|
+
// ConfigureAll
|
|
4403
|
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
4404
|
+
export const configureAllAbi = [
|
|
4405
|
+
{
|
|
4406
|
+
type: 'function',
|
|
4407
|
+
inputs: [],
|
|
4408
|
+
name: 'IS_SCRIPT',
|
|
4409
|
+
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
|
|
4410
|
+
stateMutability: 'view',
|
|
4411
|
+
},
|
|
4412
|
+
{
|
|
4413
|
+
type: 'function',
|
|
4414
|
+
inputs: [],
|
|
4415
|
+
name: 'debug',
|
|
4416
|
+
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
|
|
4417
|
+
stateMutability: 'view',
|
|
4418
|
+
},
|
|
4419
|
+
{
|
|
4420
|
+
type: 'function',
|
|
4421
|
+
inputs: [],
|
|
4422
|
+
name: 'feeReceiver',
|
|
4423
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
4424
|
+
stateMutability: 'view',
|
|
4425
|
+
},
|
|
4426
|
+
{
|
|
4427
|
+
type: 'function',
|
|
4428
|
+
inputs: [],
|
|
4429
|
+
name: 'governor',
|
|
4430
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
4431
|
+
stateMutability: 'view',
|
|
4432
|
+
},
|
|
4433
|
+
{
|
|
4434
|
+
type: 'function',
|
|
4435
|
+
inputs: [],
|
|
4436
|
+
name: 'networkFee',
|
|
4437
|
+
outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
|
|
4438
|
+
stateMutability: 'view',
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
type: 'function',
|
|
4442
|
+
inputs: [],
|
|
4443
|
+
name: 'owner',
|
|
4444
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
4445
|
+
stateMutability: 'view',
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
type: 'function',
|
|
4449
|
+
inputs: [],
|
|
4450
|
+
name: 'run',
|
|
4451
|
+
outputs: [],
|
|
4452
|
+
stateMutability: 'nonpayable',
|
|
4453
|
+
},
|
|
4454
|
+
];
|
|
4455
|
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
4402
4456
|
// ContextUpgradeable
|
|
4403
4457
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
4404
4458
|
export const contextUpgradeableAbi = [
|
|
@@ -6655,7 +6709,7 @@ export const distributePaymentsConditionAbi = [
|
|
|
6655
6709
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
6656
6710
|
},
|
|
6657
6711
|
];
|
|
6658
|
-
export const distributePaymentsConditionAddress = '
|
|
6712
|
+
export const distributePaymentsConditionAddress = '0xb5c88718C43b5bCF9E7c51348e526f3e19097680';
|
|
6659
6713
|
export const distributePaymentsConditionConfig = {
|
|
6660
6714
|
address: distributePaymentsConditionAddress,
|
|
6661
6715
|
abi: distributePaymentsConditionAbi,
|
|
@@ -7493,7 +7547,7 @@ export const fiatPaymentTemplateAbi = [
|
|
|
7493
7547
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
7494
7548
|
},
|
|
7495
7549
|
];
|
|
7496
|
-
export const fiatPaymentTemplateAddress = '
|
|
7550
|
+
export const fiatPaymentTemplateAddress = '0xC2395E198D5686C952dE4672693FcB2D41C0B06b';
|
|
7497
7551
|
export const fiatPaymentTemplateConfig = {
|
|
7498
7552
|
address: fiatPaymentTemplateAddress,
|
|
7499
7553
|
abi: fiatPaymentTemplateAbi,
|
|
@@ -7740,7 +7794,7 @@ export const fiatSettlementConditionAbi = [
|
|
|
7740
7794
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
7741
7795
|
},
|
|
7742
7796
|
];
|
|
7743
|
-
export const fiatSettlementConditionAddress = '
|
|
7797
|
+
export const fiatSettlementConditionAddress = '0x66F919E76b67E3a93bB58E964873E062B97Ba9C8';
|
|
7744
7798
|
export const fiatSettlementConditionConfig = {
|
|
7745
7799
|
address: fiatSettlementConditionAddress,
|
|
7746
7800
|
abi: fiatSettlementConditionAbi,
|
|
@@ -7986,7 +8040,7 @@ export const fixedPaymentTemplateAbi = [
|
|
|
7986
8040
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
7987
8041
|
},
|
|
7988
8042
|
];
|
|
7989
|
-
export const fixedPaymentTemplateAddress = '
|
|
8043
|
+
export const fixedPaymentTemplateAddress = '0x27d2896a033170C5e695f308668BA1c76eB66795';
|
|
7990
8044
|
export const fixedPaymentTemplateConfig = {
|
|
7991
8045
|
address: fixedPaymentTemplateAddress,
|
|
7992
8046
|
abi: fixedPaymentTemplateAbi,
|
|
@@ -11309,7 +11363,7 @@ export const lockPaymentConditionAbi = [
|
|
|
11309
11363
|
name: 'UnsupportedPriceTypeOption',
|
|
11310
11364
|
},
|
|
11311
11365
|
];
|
|
11312
|
-
export const lockPaymentConditionAddress = '
|
|
11366
|
+
export const lockPaymentConditionAddress = '0x16F24652A734Fd0E1ea213DdCBc60f1F9B2382Bc';
|
|
11313
11367
|
export const lockPaymentConditionConfig = {
|
|
11314
11368
|
address: lockPaymentConditionAddress,
|
|
11315
11369
|
abi: lockPaymentConditionAbi,
|
|
@@ -12520,7 +12574,7 @@ export const nft1155CreditsAbi = [
|
|
|
12520
12574
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
12521
12575
|
},
|
|
12522
12576
|
];
|
|
12523
|
-
export const nft1155CreditsAddress = '
|
|
12577
|
+
export const nft1155CreditsAddress = '0x36e1116E9796B612583BA479C4F63B204c7e0A6b';
|
|
12524
12578
|
export const nft1155CreditsConfig = {
|
|
12525
12579
|
address: nft1155CreditsAddress,
|
|
12526
12580
|
abi: nft1155CreditsAbi,
|
|
@@ -13665,7 +13719,7 @@ export const nft1155ExpirableCreditsAbi = [
|
|
|
13665
13719
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
13666
13720
|
},
|
|
13667
13721
|
];
|
|
13668
|
-
export const nft1155ExpirableCreditsAddress = '
|
|
13722
|
+
export const nft1155ExpirableCreditsAddress = '0x7415CBa165f8C6bA8842bA74A7da4BEA94A55d47';
|
|
13669
13723
|
export const nft1155ExpirableCreditsConfig = {
|
|
13670
13724
|
address: nft1155ExpirableCreditsAddress,
|
|
13671
13725
|
abi: nft1155ExpirableCreditsAbi,
|
|
@@ -14602,7 +14656,7 @@ export const nvmConfigAbi = [
|
|
|
14602
14656
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
14603
14657
|
},
|
|
14604
14658
|
];
|
|
14605
|
-
export const nvmConfigAddress = '
|
|
14659
|
+
export const nvmConfigAddress = '0xE0077b2899b216Db100D1eB66A334B275fD1A22A';
|
|
14606
14660
|
export const nvmConfigConfig = {
|
|
14607
14661
|
address: nvmConfigAddress,
|
|
14608
14662
|
abi: nvmConfigAbi,
|
|
@@ -15176,7 +15230,7 @@ export const oneTimeCreatorHookAbi = [
|
|
|
15176
15230
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
15177
15231
|
},
|
|
15178
15232
|
];
|
|
15179
|
-
export const oneTimeCreatorHookAddress = '
|
|
15233
|
+
export const oneTimeCreatorHookAddress = '0x821885E9805674D157450d636832B64E751df0Fe';
|
|
15180
15234
|
export const oneTimeCreatorHookConfig = {
|
|
15181
15235
|
address: oneTimeCreatorHookAddress,
|
|
15182
15236
|
abi: oneTimeCreatorHookAbi,
|
|
@@ -15495,7 +15549,7 @@ export const paymentsVaultAbi = [
|
|
|
15495
15549
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
15496
15550
|
},
|
|
15497
15551
|
];
|
|
15498
|
-
export const paymentsVaultAddress = '
|
|
15552
|
+
export const paymentsVaultAddress = '0x43C6ad5Eb4db2B144Bc79Ae6887e3471b0f4B677';
|
|
15499
15553
|
export const paymentsVaultConfig = {
|
|
15500
15554
|
address: paymentsVaultAddress,
|
|
15501
15555
|
abi: paymentsVaultAbi,
|
|
@@ -16085,7 +16139,7 @@ export const protocolStandardFeesAbi = [
|
|
|
16085
16139
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
16086
16140
|
},
|
|
16087
16141
|
];
|
|
16088
|
-
export const protocolStandardFeesAddress = '
|
|
16142
|
+
export const protocolStandardFeesAddress = '0x67d831A10F1eeE9Ad222bC5116538ac64418E795';
|
|
16089
16143
|
export const protocolStandardFeesConfig = {
|
|
16090
16144
|
address: protocolStandardFeesAddress,
|
|
16091
16145
|
abi: protocolStandardFeesAbi,
|
|
@@ -16168,6 +16222,60 @@ export const safeErc20Abi = [
|
|
|
16168
16222
|
},
|
|
16169
16223
|
];
|
|
16170
16224
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
16225
|
+
// SetNetworkFees
|
|
16226
|
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
16227
|
+
export const setNetworkFeesAbi = [
|
|
16228
|
+
{
|
|
16229
|
+
type: 'function',
|
|
16230
|
+
inputs: [],
|
|
16231
|
+
name: 'IS_SCRIPT',
|
|
16232
|
+
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
|
|
16233
|
+
stateMutability: 'view',
|
|
16234
|
+
},
|
|
16235
|
+
{
|
|
16236
|
+
type: 'function',
|
|
16237
|
+
inputs: [],
|
|
16238
|
+
name: 'debug',
|
|
16239
|
+
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
|
|
16240
|
+
stateMutability: 'view',
|
|
16241
|
+
},
|
|
16242
|
+
{
|
|
16243
|
+
type: 'function',
|
|
16244
|
+
inputs: [],
|
|
16245
|
+
name: 'feeReceiver',
|
|
16246
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
16247
|
+
stateMutability: 'view',
|
|
16248
|
+
},
|
|
16249
|
+
{
|
|
16250
|
+
type: 'function',
|
|
16251
|
+
inputs: [],
|
|
16252
|
+
name: 'governor',
|
|
16253
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
16254
|
+
stateMutability: 'view',
|
|
16255
|
+
},
|
|
16256
|
+
{
|
|
16257
|
+
type: 'function',
|
|
16258
|
+
inputs: [],
|
|
16259
|
+
name: 'networkFee',
|
|
16260
|
+
outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
|
|
16261
|
+
stateMutability: 'view',
|
|
16262
|
+
},
|
|
16263
|
+
{
|
|
16264
|
+
type: 'function',
|
|
16265
|
+
inputs: [],
|
|
16266
|
+
name: 'owner',
|
|
16267
|
+
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
|
16268
|
+
stateMutability: 'view',
|
|
16269
|
+
},
|
|
16270
|
+
{
|
|
16271
|
+
type: 'function',
|
|
16272
|
+
inputs: [],
|
|
16273
|
+
name: 'run',
|
|
16274
|
+
outputs: [],
|
|
16275
|
+
stateMutability: 'nonpayable',
|
|
16276
|
+
},
|
|
16277
|
+
];
|
|
16278
|
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
16171
16279
|
// Strings
|
|
16172
16280
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
16173
16281
|
export const stringsAbi = [
|
|
@@ -16365,7 +16473,7 @@ export const tokenUtilsAbi = [
|
|
|
16365
16473
|
name: 'InvalidTransactionAmount',
|
|
16366
16474
|
},
|
|
16367
16475
|
];
|
|
16368
|
-
export const tokenUtilsAddress = '
|
|
16476
|
+
export const tokenUtilsAddress = '0x9b2c41dE5Dc57C94E4ce17679718e7B784C85124';
|
|
16369
16477
|
export const tokenUtilsConfig = {
|
|
16370
16478
|
address: tokenUtilsAddress,
|
|
16371
16479
|
abi: tokenUtilsAbi,
|
|
@@ -16605,7 +16713,7 @@ export const transferCreditsConditionAbi = [
|
|
|
16605
16713
|
name: 'UUPSUnsupportedProxiableUUID',
|
|
16606
16714
|
},
|
|
16607
16715
|
];
|
|
16608
|
-
export const transferCreditsConditionAddress = '
|
|
16716
|
+
export const transferCreditsConditionAddress = '0x5Dd39De41d8A5831b830D6c636daAF4F473A37F3';
|
|
16609
16717
|
export const transferCreditsConditionConfig = {
|
|
16610
16718
|
address: transferCreditsConditionAddress,
|
|
16611
16719
|
abi: transferCreditsConditionAbi,
|
|
@@ -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,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,qBAAa,aAAc,SAAQ,YAAY;WAChB,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;IAS/E,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMxC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvC,QAAQ,CAAC,EACpB,OAAO,EACP,GAAG,EACH,KAAK,EACL,KAAK,EACL,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,KAAK,EAAE,OAAO,GAAG,YAAY,CAA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AWzC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,cAAc,CACzB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,GAAG,YAAY,EAC7B,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,kBAAkB,GAAG,oBAAoB,CAAC;IAIxC,mBAAmB,CAC9B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,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"}
|
|
@@ -29,7 +29,8 @@ export class AssetRegistry extends ContractBase {
|
|
|
29
29
|
async createPlan({ priceConfig, creditsConfig, owner, nonce = 0n, addFees = true, isTrialPlan = false, txParams, }) {
|
|
30
30
|
const _config = await this.planConfigPreFilter(priceConfig, creditsConfig, addFees);
|
|
31
31
|
if (isTrialPlan) {
|
|
32
|
-
|
|
32
|
+
const hooks = [oneTimeCreatorHookAddress];
|
|
33
|
+
return this.send('createPlanWithHooks', owner, [_config.priceConfig, _config.creditsConfig, hooks, nonce], txParams);
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
return this.send('createPlan', owner, [_config.priceConfig, _config.creditsConfig, nonce], txParams);
|
|
@@ -2,6 +2,12 @@ import { Abi, Account, Address, TransactionReceipt } from 'viem';
|
|
|
2
2
|
import { SmartAccount, UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
3
|
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract.js';
|
|
4
4
|
import { TxParameters } from '../models/Transactions.js';
|
|
5
|
+
export interface MulticallEntry {
|
|
6
|
+
contractAddress: Address;
|
|
7
|
+
abi: Abi;
|
|
8
|
+
functionName: string;
|
|
9
|
+
args: any[];
|
|
10
|
+
}
|
|
5
11
|
export declare abstract class ContractBase extends Instantiable {
|
|
6
12
|
readonly contractName: string;
|
|
7
13
|
contract: any;
|
|
@@ -14,8 +20,11 @@ export declare abstract class ContractBase extends Instantiable {
|
|
|
14
20
|
call<T>(functionName: string, args: any[], from?: string): Promise<T>;
|
|
15
21
|
getTransactionReceipt(txHash: UserOperationReceipt | TransactionReceipt): Promise<TransactionReceipt>;
|
|
16
22
|
getTransactionLogs(txReceipt: TransactionReceipt | UserOperationReceipt, eventName?: string): any[];
|
|
23
|
+
multicall(calls: MulticallEntry[], from: Account | SmartAccount, params?: TxParameters): Promise<TransactionReceipt | undefined>;
|
|
17
24
|
send(functionName: string, from: Account | SmartAccount, args: any[], params?: TxParameters): Promise<TransactionReceipt | UserOperationReceipt>;
|
|
25
|
+
private internalMulticallSmartAccount;
|
|
18
26
|
private internalSendSmartAccount;
|
|
19
27
|
private localAccountSend;
|
|
28
|
+
private localAccountMulticall;
|
|
20
29
|
}
|
|
21
30
|
//# sourceMappingURL=ContractBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractBase.d.ts","sourceRoot":"","sources":["../../src/contracts/ContractBase.ts"],"names":[],"mappings":"AACA,OAAO,EAC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B,CAChC,MAAM,EAAE,oBAAoB,GAAG,kBAAkB,GAChD,OAAO,CAAC,kBAAkB,CAAC;IAgBvB,kBAAkB,CACvB,SAAS,EAAE,kBAAkB,GAAG,oBAAoB,EACpD,SAAS,CAAC,EAAE,MAAM,GAOZ,GAAG,EAAE;IAGA,SAAS,CACpB,KAAK,EAAE,cAAc,EAAE,EACvB,IAAI,EAAE,OAAO,GAAG,YAAY,EAC5B,MAAM,GAAE,YAAiB;IAgBd,IAAI,CACf,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,GAAG,YAAY,EAC5B,IAAI,EAAE,GAAG,EAAE,EACX,MAAM,GAAE,YAAiB,GACxB,OAAO,CAAC,kBAAkB,GAAG,oBAAoB,CAAC;YAiBvC,6BAA6B;YA+E7B,wBAAwB;YA8HxB,gBAAgB;YAkGhB,qBAAqB;CAepC"}
|
|
@@ -2,8 +2,7 @@ import { createKernelAccountClient, createZeroDevPaymasterClient } from '@zerode
|
|
|
2
2
|
import { BaseError, ContractFunctionRevertedError, encodeFunctionData, getContract, http, parseAbi, parseEventLogs, } from 'viem';
|
|
3
3
|
import { ContractsError } from '../errors/index.js';
|
|
4
4
|
import { Instantiable } from '../Instantiable.abstract.js';
|
|
5
|
-
import { getInputsOfFunctionFormatted,
|
|
6
|
-
import { jsonReplacer } from '../utils/helpers.js';
|
|
5
|
+
import { getInputsOfFunctionFormatted, getTransactionReceipt } from '../nevermined/index.js';
|
|
7
6
|
import { getChain } from '../utils/Network.js';
|
|
8
7
|
export class ContractBase extends Instantiable {
|
|
9
8
|
contractName;
|
|
@@ -63,6 +62,23 @@ export class ContractBase extends Instantiable {
|
|
|
63
62
|
strict: false,
|
|
64
63
|
});
|
|
65
64
|
}
|
|
65
|
+
async multicall(calls, from, params = {}) {
|
|
66
|
+
if (from.type === 'local') {
|
|
67
|
+
this.logger.debug(`Blockchain Multicall using Local account`);
|
|
68
|
+
return await this.localAccountMulticall(calls, from, params, params.progress);
|
|
69
|
+
}
|
|
70
|
+
else if (from.type === 'json-rpc') {
|
|
71
|
+
this.logger.debug(`Blockchain Multicall using JSON-RPC account`);
|
|
72
|
+
return await this.localAccountMulticall(calls, from, params, params.progress);
|
|
73
|
+
}
|
|
74
|
+
else if (from.type === 'smart') {
|
|
75
|
+
this.logger.debug(`Blockchain Multicall using ZeroDev account`);
|
|
76
|
+
return await this.internalMulticallSmartAccount(calls, from, params, params.progress);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
throw new ContractsError(`Account not supported`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
66
82
|
async send(functionName, from, args, params = {}) {
|
|
67
83
|
if (from.type === 'local') {
|
|
68
84
|
this.logger.debug(`Blockchain Send using Local account with functionName: ${functionName} and following args: ${args}`);
|
|
@@ -80,6 +96,73 @@ export class ContractBase extends Instantiable {
|
|
|
80
96
|
throw new ContractsError(`Account not supported`);
|
|
81
97
|
}
|
|
82
98
|
}
|
|
99
|
+
async internalMulticallSmartAccount(calls, from, txparams, progress) {
|
|
100
|
+
if (progress) {
|
|
101
|
+
progress({
|
|
102
|
+
stage: 'multicall-sending',
|
|
103
|
+
args: [],
|
|
104
|
+
method: '',
|
|
105
|
+
from: from,
|
|
106
|
+
contractAddress: this.address,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const ZERODEV_RPC = `https://rpc.zerodev.app/api/v3/${this.config.zeroDevProjectId}/chain/${this.config.chainId}`;
|
|
110
|
+
const zerodevPaymaster = createZeroDevPaymasterClient({
|
|
111
|
+
chain: getChain(this.config.chainId),
|
|
112
|
+
transport: http(ZERODEV_RPC),
|
|
113
|
+
});
|
|
114
|
+
const kernelClient = createKernelAccountClient({
|
|
115
|
+
account: from,
|
|
116
|
+
chain: getChain(this.config.chainId),
|
|
117
|
+
bundlerTransport: http(ZERODEV_RPC),
|
|
118
|
+
client: this.contract.publicClient,
|
|
119
|
+
paymaster: {
|
|
120
|
+
getPaymasterData: (userOperation) => {
|
|
121
|
+
return zerodevPaymaster.sponsorUserOperation({
|
|
122
|
+
userOperation,
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
const encodedCalls = [];
|
|
128
|
+
calls.map((call) => {
|
|
129
|
+
encodedCalls.push({
|
|
130
|
+
to: call.contractAddress || this.address,
|
|
131
|
+
value: txparams.value || 0n,
|
|
132
|
+
data: encodeFunctionData({
|
|
133
|
+
abi: call.abi,
|
|
134
|
+
functionName: call.functionName,
|
|
135
|
+
args: call.args,
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
try {
|
|
140
|
+
const userOpHash = await kernelClient.sendUserOperation({
|
|
141
|
+
callData: await kernelClient.account.encodeCalls(encodedCalls),
|
|
142
|
+
});
|
|
143
|
+
if (progress) {
|
|
144
|
+
progress({
|
|
145
|
+
stage: 'multicall-sent',
|
|
146
|
+
args: [],
|
|
147
|
+
method: '',
|
|
148
|
+
from: from,
|
|
149
|
+
contractAddress: this.address,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// Wait for the transaction to be mined
|
|
153
|
+
this.logger.debug(`Waiting for transaction to be mined...`, userOpHash);
|
|
154
|
+
const txReceipt = await kernelClient.waitForUserOperationReceipt({ hash: userOpHash });
|
|
155
|
+
this.logger.debug(`Transaction mined: ${userOpHash}`);
|
|
156
|
+
return txReceipt.receipt;
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
if (err instanceof BaseError) {
|
|
160
|
+
const revertError = err.walk((err) => err instanceof ContractFunctionRevertedError);
|
|
161
|
+
this.logger.error('revertError', revertError);
|
|
162
|
+
}
|
|
163
|
+
throw new ContractsError(`Multicall failed: ${err}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
83
166
|
async internalSendSmartAccount(name, from, args, txparams, progress) {
|
|
84
167
|
const functionInputs = getInputsOfFunctionFormatted(this.contract.abi, name, args);
|
|
85
168
|
const { gasLimit, value } = txparams;
|
|
@@ -186,13 +269,13 @@ export class ContractBase extends Instantiable {
|
|
|
186
269
|
async localAccountSend(name, from, args, txparams, progress) {
|
|
187
270
|
const functionInputs = getInputsOfFunctionFormatted(this.contract.abi, name, args);
|
|
188
271
|
// Uncomment to debug contract calls
|
|
189
|
-
if (name === 'createAgreement') {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
272
|
+
// if (name === 'createAgreement') {
|
|
273
|
+
// const functionSignature = getSignatureOfFunction(this.contract.abi, name, args)
|
|
274
|
+
// this.logger.debug(`Making contract call ....: ${name} - ${from}`)
|
|
275
|
+
// this.logger.debug(`With args`, args)
|
|
276
|
+
// this.logger.debug(`And signature - ${JSON.stringify(functionSignature, jsonReplacer)}`)
|
|
277
|
+
// this.logger.debug('And amount: ', txparams.value)
|
|
278
|
+
// }
|
|
196
279
|
// abi.filter(({name, inputs}) => name === 'closeSignals' && inputs.length === 1)
|
|
197
280
|
// const abiFilter = this.contract.abi.filter((abi) => abi.name === name && abi.inputs.length === args.length)
|
|
198
281
|
// const abiFilter = this.contract.abi.filter((abi) => abi.name === name && abi.type === 'function')
|
|
@@ -267,4 +350,14 @@ export class ContractBase extends Instantiable {
|
|
|
267
350
|
}
|
|
268
351
|
return txReceipt;
|
|
269
352
|
}
|
|
353
|
+
async localAccountMulticall(calls, from, txparams, progress) {
|
|
354
|
+
const receipts = [];
|
|
355
|
+
for (const call of calls) {
|
|
356
|
+
receipts.push(await this.localAccountSend(call.functionName, from, call.args, txparams, progress));
|
|
357
|
+
}
|
|
358
|
+
if (receipts.length > 0)
|
|
359
|
+
return receipts.pop();
|
|
360
|
+
else
|
|
361
|
+
throw new ContractsError(`No receipts found for multicall`);
|
|
362
|
+
}
|
|
270
363
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Account } from 'viem';
|
|
1
|
+
import { Account, Address } from 'viem';
|
|
2
2
|
import { SmartAccount } from 'viem/account-abstraction';
|
|
3
3
|
import { InstantiableConfig } from '../Instantiable.abstract.js';
|
|
4
4
|
import { TxParameters } from '../models/Transactions.js';
|
|
5
5
|
import { ContractBase } from './ContractBase.js';
|
|
6
6
|
export declare class FixedPaymentTemplate extends ContractBase {
|
|
7
|
+
private TOKEN_APPROVE_ABI;
|
|
7
8
|
static getInstance(config: InstantiableConfig): Promise<FixedPaymentTemplate>;
|
|
8
9
|
createAgreement(planId: bigint, owner: Account | SmartAccount, txParams?: TxParameters): Promise<import("viem").TransactionReceipt | import("viem/account-abstraction").UserOperationReceipt>;
|
|
10
|
+
approveERC20(totalAmount: bigint, tokenAddress: Address, owner: Account | SmartAccount, txParams?: TxParameters): Promise<import("viem").TransactionReceipt | undefined>;
|
|
11
|
+
createAgreementWithApprovals(planId: bigint, totalAmount: bigint, tokenAddress: Address, owner: Account | SmartAccount, txParams?: TxParameters): Promise<import("viem").TransactionReceipt | undefined>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=FixedPaymentTemplate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixedPaymentTemplate.d.ts","sourceRoot":"","sources":["../../src/contracts/FixedPaymentTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FixedPaymentTemplate.d.ts","sourceRoot":"","sources":["../../src/contracts/FixedPaymentTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,OAAO,EAAY,MAAM,MAAM,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAA;AAEhE,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,OAAO,CAAC,iBAAiB,CAEhB;WAEoB,WAAW,CACtC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,oBAAoB,CAAC;IASnB,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GAAG,YAAY,EAC7B,QAAQ,CAAC,EAAE,YAAY;IAMZ,YAAY,CACvB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,OAAO,GAAG,YAAY,EAC7B,QAAQ,CAAC,EAAE,YAAY;IAmBZ,4BAA4B,CACvC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,OAAO,GAAG,YAAY,EAC7B,QAAQ,CAAC,EAAE,YAAY;CA0B1B"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseAbi } from 'viem';
|
|
2
|
+
import { fixedPaymentTemplateConfig, lockPaymentConditionAddress, paymentsVaultAddress, } from '../artifacts/generated.js';
|
|
2
3
|
import { generateZeroXId } from '../utils/helpers.js';
|
|
3
4
|
import { ContractBase } from './ContractBase.js';
|
|
4
5
|
export class FixedPaymentTemplate extends ContractBase {
|
|
6
|
+
TOKEN_APPROVE_ABI = parseAbi([
|
|
7
|
+
'function approve(address spender, uint256 amount) external returns (bool)',
|
|
8
|
+
]);
|
|
5
9
|
static async getInstance(config) {
|
|
6
10
|
const fixedPaymentTemplate = new FixedPaymentTemplate('FixedPaymentTemplate', fixedPaymentTemplateConfig.address);
|
|
7
11
|
await fixedPaymentTemplate.init(config, fixedPaymentTemplateConfig);
|
|
@@ -11,4 +15,45 @@ export class FixedPaymentTemplate extends ContractBase {
|
|
|
11
15
|
const agreementIdSeed = generateZeroXId();
|
|
12
16
|
return this.send('createAgreement', owner, [agreementIdSeed, planId, []], txParams);
|
|
13
17
|
}
|
|
18
|
+
async approveERC20(totalAmount, tokenAddress, owner, txParams) {
|
|
19
|
+
const calls = [
|
|
20
|
+
{
|
|
21
|
+
contractAddress: tokenAddress,
|
|
22
|
+
abi: this.TOKEN_APPROVE_ABI,
|
|
23
|
+
functionName: 'approve',
|
|
24
|
+
args: [lockPaymentConditionAddress, totalAmount],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
contractAddress: tokenAddress,
|
|
28
|
+
abi: this.TOKEN_APPROVE_ABI,
|
|
29
|
+
functionName: 'approve',
|
|
30
|
+
args: [paymentsVaultAddress, totalAmount],
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
return await this.multicall(calls, owner, txParams);
|
|
34
|
+
}
|
|
35
|
+
async createAgreementWithApprovals(planId, totalAmount, tokenAddress, owner, txParams) {
|
|
36
|
+
const agreementIdSeed = generateZeroXId();
|
|
37
|
+
const calls = [
|
|
38
|
+
{
|
|
39
|
+
contractAddress: tokenAddress,
|
|
40
|
+
abi: this.TOKEN_APPROVE_ABI,
|
|
41
|
+
functionName: 'approve',
|
|
42
|
+
args: [lockPaymentConditionAddress, totalAmount],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
contractAddress: tokenAddress,
|
|
46
|
+
abi: this.TOKEN_APPROVE_ABI,
|
|
47
|
+
functionName: 'approve',
|
|
48
|
+
args: [paymentsVaultAddress, totalAmount],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
contractAddress: this.address,
|
|
52
|
+
abi: this.contract.abi,
|
|
53
|
+
functionName: 'createAgreement',
|
|
54
|
+
args: [agreementIdSeed, planId, []],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
return await this.multicall(calls, owner, txParams);
|
|
58
|
+
}
|
|
14
59
|
}
|