@gvnrdao/dh-sdk 0.0.220 → 0.0.221
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/index.js +169 -89
- package/dist/index.mjs +169 -89
- package/dist/interfaces/chunks/contract-types.i.d.ts +1 -1
- package/dist/modules/diamond-hands-sdk.d.ts +5 -0
- package/dist/utils/mint-authorization.utils.d.ts +26 -10
- package/dist/utils/telegram-messaging.utils.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -14325,53 +14325,53 @@ var init_deployment_addresses = __esm({
|
|
|
14325
14325
|
},
|
|
14326
14326
|
upgraded: {
|
|
14327
14327
|
PositionManager: {
|
|
14328
|
-
previousImplementation: "
|
|
14329
|
-
newImplementation: "
|
|
14330
|
-
upgradedAt: "2026-04-
|
|
14328
|
+
previousImplementation: "0x1b854fE920AC409b5f407b3ABCd556C998F889E5",
|
|
14329
|
+
newImplementation: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
|
|
14330
|
+
upgradedAt: "2026-04-30T08:33:24.883Z",
|
|
14331
14331
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14332
14332
|
reason: "Shared upgrade script: PositionManager implementation update"
|
|
14333
14333
|
},
|
|
14334
14334
|
LoanOperationsManagerModule: {
|
|
14335
|
-
previousImplementation: "
|
|
14336
|
-
newImplementation: "
|
|
14337
|
-
upgradedAt: "2026-04-
|
|
14335
|
+
previousImplementation: "0x448Fb59Cad99FFe3d0766F6943E4B579A824d46b",
|
|
14336
|
+
newImplementation: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
|
|
14337
|
+
upgradedAt: "2026-04-30T08:34:13.649Z",
|
|
14338
14338
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14339
14339
|
reason: "Shared upgrade script: LoanOperationsManagerModule implementation update"
|
|
14340
14340
|
},
|
|
14341
14341
|
UCDController: {
|
|
14342
|
-
previousImplementation: "
|
|
14343
|
-
newImplementation: "
|
|
14344
|
-
upgradedAt: "2026-04-
|
|
14342
|
+
previousImplementation: "0xB5322F0D4a07d4342FA38137ebD95ac41D1c6036",
|
|
14343
|
+
newImplementation: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
|
|
14344
|
+
upgradedAt: "2026-04-30T08:24:24.765Z",
|
|
14345
14345
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14346
14346
|
reason: "Shared upgrade script: UCDController implementation update"
|
|
14347
14347
|
},
|
|
14348
14348
|
TermManagerModule: {
|
|
14349
|
-
previousImplementation: "
|
|
14350
|
-
newImplementation: "
|
|
14351
|
-
upgradedAt: "2026-04-
|
|
14349
|
+
previousImplementation: "0x1D5E5A93215E49aA7260dA8d3B3de9faA686C087",
|
|
14350
|
+
newImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
|
|
14351
|
+
upgradedAt: "2026-04-30T08:26:37.176Z",
|
|
14352
14352
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14353
14353
|
reason: "Shared upgrade script: TermManagerModule implementation update"
|
|
14354
14354
|
},
|
|
14355
14355
|
CircuitBreakerModule: {
|
|
14356
|
-
previousImplementation: "
|
|
14357
|
-
newImplementation: "
|
|
14358
|
-
upgradedAt: "2026-04-
|
|
14356
|
+
previousImplementation: "0xa4940082a7b58c45C3885C4B59714C0dD048cDdC",
|
|
14357
|
+
newImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
|
|
14358
|
+
upgradedAt: "2026-04-30T08:29:37.131Z",
|
|
14359
14359
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14360
14360
|
reason: "Shared upgrade script: CircuitBreakerModule implementation update"
|
|
14361
14361
|
},
|
|
14362
14362
|
AdminModule: {
|
|
14363
|
-
previousImplementation: "
|
|
14364
|
-
newImplementation: "
|
|
14365
|
-
upgradedAt: "2026-04-
|
|
14363
|
+
previousImplementation: "0x8bDe850573a947b816D1EC5C5Ca177853bDfD049",
|
|
14364
|
+
newImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
|
|
14365
|
+
upgradedAt: "2026-04-30T08:31:13.444Z",
|
|
14366
14366
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14367
|
-
reason: "
|
|
14367
|
+
reason: "Shared upgrade script: AdminModule implementation update"
|
|
14368
14368
|
},
|
|
14369
14369
|
PositionManagerViews: {
|
|
14370
|
-
previousImplementation: "
|
|
14371
|
-
newImplementation: "
|
|
14372
|
-
upgradedAt: "2026-04-
|
|
14370
|
+
previousImplementation: "0xE8b4D4b6E3163EdfF8958da4cF8267ACa369D486",
|
|
14371
|
+
newImplementation: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
|
|
14372
|
+
upgradedAt: "2026-04-30T08:32:48.463Z",
|
|
14373
14373
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14374
|
-
reason: "
|
|
14374
|
+
reason: "Shared upgrade script: PositionManagerViews implementation update"
|
|
14375
14375
|
},
|
|
14376
14376
|
TestPositionManager: {
|
|
14377
14377
|
previousImplementation: "0x0B46Ee1a9C6b42559758B7FF78294Cd867BB08f8",
|
|
@@ -14381,51 +14381,51 @@ var init_deployment_addresses = __esm({
|
|
|
14381
14381
|
reason: "Add setPositionExpiry() for expiry-liquidation E2E testing"
|
|
14382
14382
|
},
|
|
14383
14383
|
UCDToken: {
|
|
14384
|
-
previousImplementation: "
|
|
14385
|
-
newImplementation: "
|
|
14386
|
-
upgradedAt: "2026-04-
|
|
14384
|
+
previousImplementation: "0xEFFF6f32Fc33C4Cb58a4d6858Bf90B8feA7D1D33",
|
|
14385
|
+
newImplementation: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
|
|
14386
|
+
upgradedAt: "2026-04-30T08:25:01.929Z",
|
|
14387
14387
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14388
14388
|
reason: "Shared upgrade script: UCDToken implementation update"
|
|
14389
14389
|
},
|
|
14390
14390
|
PositionManagerCoreModule: {
|
|
14391
|
-
previousImplementation: "
|
|
14392
|
-
newImplementation: "
|
|
14393
|
-
upgradedAt: "2026-04-
|
|
14391
|
+
previousImplementation: "0xeA5234c8E3a5F61c660db529d9d6f91fd989B56E",
|
|
14392
|
+
newImplementation: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
|
|
14393
|
+
upgradedAt: "2026-04-30T09:32:01.570Z",
|
|
14394
14394
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14395
14395
|
reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
|
|
14396
14396
|
},
|
|
14397
14397
|
CollateralManagerModule: {
|
|
14398
|
-
previousImplementation: "
|
|
14399
|
-
newImplementation: "
|
|
14400
|
-
upgradedAt: "2026-04-
|
|
14398
|
+
previousImplementation: "0x84C5B89f60415F8df3Fee46Ef1a10a6484aa8e0A",
|
|
14399
|
+
newImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
|
|
14400
|
+
upgradedAt: "2026-04-30T08:27:24.702Z",
|
|
14401
14401
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14402
14402
|
reason: "Shared upgrade script: CollateralManagerModule implementation update"
|
|
14403
14403
|
},
|
|
14404
14404
|
LiquidationManagerModule: {
|
|
14405
|
-
previousImplementation: "
|
|
14406
|
-
newImplementation: "
|
|
14407
|
-
upgradedAt: "2026-04-
|
|
14405
|
+
previousImplementation: "0xBb625E44d72f3F1acDCbB08F73AFdAc38fCE3F64",
|
|
14406
|
+
newImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
|
|
14407
|
+
upgradedAt: "2026-04-30T08:29:01.327Z",
|
|
14408
14408
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14409
14409
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
14410
14410
|
},
|
|
14411
14411
|
BTCSpendAuthorizer: {
|
|
14412
|
-
previousImplementation: "
|
|
14413
|
-
newImplementation: "
|
|
14414
|
-
upgradedAt: "2026-04-
|
|
14412
|
+
previousImplementation: "0x0B46DCdB63CB9928789ef1979C367da6ef04beAf",
|
|
14413
|
+
newImplementation: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
|
|
14414
|
+
upgradedAt: "2026-04-30T08:32:02.761Z",
|
|
14415
14415
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14416
14416
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
14417
14417
|
},
|
|
14418
14418
|
SimplePSMV2: {
|
|
14419
|
-
previousImplementation: "
|
|
14420
|
-
newImplementation: "
|
|
14421
|
-
upgradedAt: "2026-04-
|
|
14419
|
+
previousImplementation: "0xBdEFa375db7F9A498B81bcfdDd14FD16D02ca0BF",
|
|
14420
|
+
newImplementation: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
|
|
14421
|
+
upgradedAt: "2026-04-30T08:35:01.138Z",
|
|
14422
14422
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14423
14423
|
reason: "Shared upgrade script: SimplePSMV2 implementation update"
|
|
14424
14424
|
},
|
|
14425
14425
|
UpgradeValidator: {
|
|
14426
|
-
previousImplementation: "
|
|
14427
|
-
newImplementation: "
|
|
14428
|
-
upgradedAt: "2026-04-
|
|
14426
|
+
previousImplementation: "0xE410d1028Cdf2D94E3F5049F2D04B573703A2804",
|
|
14427
|
+
newImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
|
|
14428
|
+
upgradedAt: "2026-04-30T09:32:25.094Z",
|
|
14429
14429
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14430
14430
|
reason: "Shared upgrade script: UpgradeValidator implementation update"
|
|
14431
14431
|
},
|
|
@@ -14502,26 +14502,26 @@ var init_deployment_addresses = __esm({
|
|
|
14502
14502
|
POSITION_MANAGER_VIEWS: "0x3b970E41a0668508B4B2ACb83653b2A402F745AE",
|
|
14503
14503
|
CIRCUIT_BREAKER_MODULE: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
|
|
14504
14504
|
ADMIN_MODULE: "0xAcd1f07915b17CA3727e7fE89BdF618A1545a1ed",
|
|
14505
|
-
UCD_CONTROLLER_IMPL: "
|
|
14506
|
-
LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "
|
|
14507
|
-
TERM_MANAGER_MODULE_IMPL: "
|
|
14508
|
-
CIRCUIT_BREAKER_MODULE_IMPL: "
|
|
14509
|
-
ADMIN_MODULE_IMPL: "
|
|
14510
|
-
POSITION_MANAGER_VIEWS_IMPL: "
|
|
14511
|
-
POSITION_MANAGER_IMPL: "
|
|
14505
|
+
UCD_CONTROLLER_IMPL: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
|
|
14506
|
+
LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
|
|
14507
|
+
TERM_MANAGER_MODULE_IMPL: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
|
|
14508
|
+
CIRCUIT_BREAKER_MODULE_IMPL: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
|
|
14509
|
+
ADMIN_MODULE_IMPL: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
|
|
14510
|
+
POSITION_MANAGER_VIEWS_IMPL: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
|
|
14511
|
+
POSITION_MANAGER_IMPL: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
|
|
14512
14512
|
SIMPLE_PSM_V2: "0x19EcF7BA26e054fd4Ff06009A03070103dbBB058",
|
|
14513
|
-
SIMPLE_PSM_V2_IMPL: "
|
|
14514
|
-
UCD_TOKEN_IMPL: "
|
|
14513
|
+
SIMPLE_PSM_V2_IMPL: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
|
|
14514
|
+
UCD_TOKEN_IMPL: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
|
|
14515
14515
|
POSITION_MANAGER_CORE_MODULE: "0xfFAA39a08887FeFB697eBC8691A8630CbCC33391",
|
|
14516
|
-
POSITION_MANAGER_CORE_MODULE_IMPL: "
|
|
14516
|
+
POSITION_MANAGER_CORE_MODULE_IMPL: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
|
|
14517
14517
|
COLLATERAL_MANAGER_MODULE: "0x967E92c976Fc0fa8268D37D4d6B7245d912aA7dB",
|
|
14518
|
-
COLLATERAL_MANAGER_MODULE_IMPL: "
|
|
14518
|
+
COLLATERAL_MANAGER_MODULE_IMPL: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
|
|
14519
14519
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
14520
|
-
LIQUIDATION_MANAGER_MODULE_IMPL: "
|
|
14520
|
+
LIQUIDATION_MANAGER_MODULE_IMPL: "0xf74d5437691df92087170861213e26064358A7fb",
|
|
14521
14521
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
14522
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
14522
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
|
|
14523
14523
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
14524
|
-
UPGRADE_VALIDATOR_IMPL: "
|
|
14524
|
+
UPGRADE_VALIDATOR_IMPL: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
|
|
14525
14525
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
14526
14526
|
BITCOIN_PROVIDER_REGISTRY_IMPL: "0x225309A4ae6D146ba93A3278A7b40224FfC81448",
|
|
14527
14527
|
LIT_ACTION_VALIDATOR: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
|
|
@@ -31184,11 +31184,62 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signer)
|
|
|
31184
31184
|
signature: signature2
|
|
31185
31185
|
};
|
|
31186
31186
|
}
|
|
31187
|
-
|
|
31187
|
+
function isChipotlePkpId(pkpTokenId) {
|
|
31188
31188
|
const rawHex = pkpTokenId.startsWith("0x") ? pkpTokenId.slice(2) : pkpTokenId;
|
|
31189
|
-
|
|
31189
|
+
return rawHex.length === 64 && rawHex.startsWith("000000000000000000000000") && rawHex !== "0".repeat(64);
|
|
31190
|
+
}
|
|
31191
|
+
async function deriveChipotlePublicKeyViaService(pkpTokenId, fallback) {
|
|
31192
|
+
const url = `${fallback.serviceEndpoint}/api/lit/pkp/derive-public-key`;
|
|
31193
|
+
const controller = new AbortController();
|
|
31194
|
+
const timeout = setTimeout(
|
|
31195
|
+
() => controller.abort(),
|
|
31196
|
+
fallback.timeoutMs ?? 6e4
|
|
31197
|
+
);
|
|
31198
|
+
try {
|
|
31199
|
+
const headers = {
|
|
31200
|
+
"Content-Type": "application/json"
|
|
31201
|
+
};
|
|
31202
|
+
if (fallback.serviceAuthToken) {
|
|
31203
|
+
headers["Authorization"] = `Bearer ${fallback.serviceAuthToken}`;
|
|
31204
|
+
}
|
|
31205
|
+
const response = await fetch(url, {
|
|
31206
|
+
method: "POST",
|
|
31207
|
+
headers,
|
|
31208
|
+
body: JSON.stringify({
|
|
31209
|
+
pkpId: pkpTokenId,
|
|
31210
|
+
...fallback.borrowerAddress && {
|
|
31211
|
+
borrowerAddress: fallback.borrowerAddress
|
|
31212
|
+
}
|
|
31213
|
+
}),
|
|
31214
|
+
signal: controller.signal
|
|
31215
|
+
});
|
|
31216
|
+
if (!response.ok) {
|
|
31217
|
+
const errorText = await response.text();
|
|
31218
|
+
throw new Error(
|
|
31219
|
+
`derive-public-key service error (${response.status}): ${errorText}`
|
|
31220
|
+
);
|
|
31221
|
+
}
|
|
31222
|
+
const envelope = await response.json();
|
|
31223
|
+
const publicKey = envelope?.data?.publicKey;
|
|
31224
|
+
if (!envelope?.success || !publicKey) {
|
|
31225
|
+
throw new Error(
|
|
31226
|
+
`derive-public-key returned no publicKey (envelope keys: ${Object.keys(
|
|
31227
|
+
envelope ?? {}
|
|
31228
|
+
).join(", ")})`
|
|
31229
|
+
);
|
|
31230
|
+
}
|
|
31231
|
+
return publicKey.startsWith("0x") ? publicKey : `0x${publicKey}`;
|
|
31232
|
+
} finally {
|
|
31233
|
+
clearTimeout(timeout);
|
|
31234
|
+
}
|
|
31235
|
+
}
|
|
31236
|
+
async function getPKPPublicKeyFromTokenId(pkpTokenId, provider, pkpNftContractAddress, chipotleFallback) {
|
|
31237
|
+
if (isChipotlePkpId(pkpTokenId)) {
|
|
31238
|
+
if (chipotleFallback?.serviceEndpoint) {
|
|
31239
|
+
return deriveChipotlePublicKeyViaService(pkpTokenId, chipotleFallback);
|
|
31240
|
+
}
|
|
31190
31241
|
throw new Error(
|
|
31191
|
-
`pkpId ${pkpTokenId} is a Chipotle wallet address (ABI-encoded ETH address). Chipotle PKPs are not NFTs and have no on-chain public key lookup.
|
|
31242
|
+
`pkpId ${pkpTokenId} is a Chipotle wallet address (ABI-encoded ETH address). Chipotle PKPs are not NFTs and have no on-chain public key lookup. Provide chipotleFallback.serviceEndpoint to recover via lit-ops-server, or ensure the PKP public key is populated in cache during position creation.`
|
|
31192
31243
|
);
|
|
31193
31244
|
}
|
|
31194
31245
|
if (!provider) {
|
|
@@ -31483,7 +31534,7 @@ function extractOptionalLitSignature(raw) {
|
|
|
31483
31534
|
|
|
31484
31535
|
// src/modules/contract/contract-manager.module.ts
|
|
31485
31536
|
var POSITION_MANAGER_ABI = [
|
|
31486
|
-
"function createPosition(bytes32 pkpId, bytes calldata validatorSignature, string mainnetVaultAddress, string regtestVaultAddress, uint256 selectedTermMonths, uint256 validatorVersion) external returns (bytes32 positionId)",
|
|
31537
|
+
"function createPosition(bytes32 pkpId, bytes calldata validatorSignature, string mainnetVaultAddress, string regtestVaultAddress, uint256 selectedTermMonths, uint256 validatorVersion, bytes calldata pkpPublicKey) external returns (bytes32 positionId)",
|
|
31487
31538
|
"function mintUCD(bytes32 positionId, uint256 mintAmount, uint256 mintFee, uint256 newDebt, uint256 newCollateral, uint256 btcPrice, bytes32 authorizedSpendsHash, bytes32 ucdDebtHash, bytes32 contractHash, uint256 quantumTimestamp, bytes calldata mintValidatorSignature) external returns (bool)",
|
|
31488
31539
|
"function makePayment(bytes32 positionId, uint256 paymentAmount, uint256 quantumTimestamp, uint256 btcPrice, bytes calldata paymentValidatorSignature) external returns (bool)",
|
|
31489
31540
|
"function extendPosition(bytes32 positionId, uint256 selectedTerm, uint256 quantumTimestamp, uint256 btcPrice, uint256 availableBTCBalance, uint256 proRataRenewalFee, bytes calldata extensionValidatorSignature) external returns (bool)",
|
|
@@ -33132,6 +33183,10 @@ var LoanCreator = class {
|
|
|
33132
33183
|
ethers_exports.utils.hexlify(BigInt(pkpData.tokenId)),
|
|
33133
33184
|
32
|
|
33134
33185
|
);
|
|
33186
|
+
const pkpPublicKeyUncompressed = ethers_exports.utils.computePublicKey(
|
|
33187
|
+
pkpData.publicKey,
|
|
33188
|
+
false
|
|
33189
|
+
);
|
|
33135
33190
|
console.log("\n\u{1F50D} PKP TOKEN ID CONVERSION TRACE (SDK):");
|
|
33136
33191
|
console.log("==========================================");
|
|
33137
33192
|
console.log(
|
|
@@ -33182,7 +33237,8 @@ var LoanCreator = class {
|
|
|
33182
33237
|
mainnetVaultAddress,
|
|
33183
33238
|
regtestVaultAddress,
|
|
33184
33239
|
request.selectedTerm,
|
|
33185
|
-
validatorVersion
|
|
33240
|
+
validatorVersion,
|
|
33241
|
+
pkpPublicKeyUncompressed
|
|
33186
33242
|
]);
|
|
33187
33243
|
console.log("\u{1F50D} ENCODED CALLDATA (first 256 chars):", encoded.substring(0, 256));
|
|
33188
33244
|
console.log("\u{1F50D} ENCODED CALLDATA full length:", encoded.length);
|
|
@@ -33195,7 +33251,8 @@ var LoanCreator = class {
|
|
|
33195
33251
|
mainnetVaultAddress,
|
|
33196
33252
|
regtestVaultAddress,
|
|
33197
33253
|
request.selectedTerm,
|
|
33198
|
-
validatorVersion
|
|
33254
|
+
validatorVersion,
|
|
33255
|
+
pkpPublicKeyUncompressed
|
|
33199
33256
|
);
|
|
33200
33257
|
if (!tx) {
|
|
33201
33258
|
return failure(
|
|
@@ -33747,8 +33804,8 @@ var LoanQuery = class {
|
|
|
33747
33804
|
batch.map(async (loan) => {
|
|
33748
33805
|
try {
|
|
33749
33806
|
const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
|
|
33750
|
-
const
|
|
33751
|
-
if (
|
|
33807
|
+
const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
|
|
33808
|
+
if (isChipotlePkpId2) {
|
|
33752
33809
|
if (this.config.positionManagerCoreAddress && this.config.provider) {
|
|
33753
33810
|
const pmContract = new ethers_exports.Contract(
|
|
33754
33811
|
this.config.positionManagerCoreAddress,
|
|
@@ -36898,7 +36955,7 @@ function formatLoanCreationMessage(positionId, pkpId, vaultAddress) {
|
|
|
36898
36955
|
}
|
|
36899
36956
|
function formatBTCWithdrawalFailureMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId) {
|
|
36900
36957
|
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
36901
|
-
return
|
|
36958
|
+
return `\u274C BTC withdrawal FAILED: ${formattedAmount} from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}`;
|
|
36902
36959
|
}
|
|
36903
36960
|
function formatLoanRenewalMessage(positionId, txHash) {
|
|
36904
36961
|
return `Loan id ${positionId} was successfully renewed. Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
@@ -36912,9 +36969,10 @@ function formatBalanceConfirmationMessage(loanId) {
|
|
|
36912
36969
|
function formatBalanceConfirmationFailureMessage(loanId) {
|
|
36913
36970
|
return `FAILED to update to PENDING_MINT for loan id ${loanId}`;
|
|
36914
36971
|
}
|
|
36915
|
-
function formatBTCWithdrawalSuccessMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId) {
|
|
36972
|
+
function formatBTCWithdrawalSuccessMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId, btcTxId) {
|
|
36916
36973
|
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
36917
|
-
|
|
36974
|
+
const txSuffix = btcTxId ? ` (tx: ${btcTxId})` : "";
|
|
36975
|
+
return `\u2705 BTC withdrawal SUCCEEDED: ${formattedAmount} sent from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}${txSuffix}`;
|
|
36918
36976
|
}
|
|
36919
36977
|
function formatLiquidationSkippedMessage(loanId, ratio, threshold, btcVault, btcVaultBalance, ucdDebt, btcPrice) {
|
|
36920
36978
|
const formattedPrice = formatBTCPrice(btcPrice);
|
|
@@ -37954,7 +38012,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
37954
38012
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
37955
38013
|
position2.pkpId,
|
|
37956
38014
|
this.getProviderOrThrow(),
|
|
37957
|
-
nagaPkpNftAddress
|
|
38015
|
+
nagaPkpNftAddress,
|
|
38016
|
+
this.getChipotlePublicKeyFallback()
|
|
37958
38017
|
);
|
|
37959
38018
|
pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
37960
38019
|
pkpCache.set(request.positionId, {
|
|
@@ -39057,7 +39116,8 @@ Error data: ${errorData || "none"}`
|
|
|
39057
39116
|
const pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
39058
39117
|
position.pkpId,
|
|
39059
39118
|
this.getProviderOrThrow(),
|
|
39060
|
-
nagaPkpNftAddressLiq
|
|
39119
|
+
nagaPkpNftAddressLiq,
|
|
39120
|
+
this.getChipotlePublicKeyFallback()
|
|
39061
39121
|
);
|
|
39062
39122
|
const pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
39063
39123
|
pkpData = {
|
|
@@ -41140,7 +41200,8 @@ Error data: ${errorData || "none"}`
|
|
|
41140
41200
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
41141
41201
|
position.pkpId,
|
|
41142
41202
|
this.getProviderOrThrow(),
|
|
41143
|
-
nagaPkpNftAddress
|
|
41203
|
+
nagaPkpNftAddress,
|
|
41204
|
+
this.getChipotlePublicKeyFallback()
|
|
41144
41205
|
);
|
|
41145
41206
|
pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
41146
41207
|
pkpCache.set(positionId, {
|
|
@@ -41610,22 +41671,6 @@ Error data: ${errorData || "none"}`
|
|
|
41610
41671
|
gasUsed: receipt.gasUsed?.toString() || "unknown"
|
|
41611
41672
|
});
|
|
41612
41673
|
}
|
|
41613
|
-
try {
|
|
41614
|
-
const position = await this.getPosition(positionId);
|
|
41615
|
-
const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
|
|
41616
|
-
const message = formatBTCWithdrawalSuccessMessage(
|
|
41617
|
-
btcAmount,
|
|
41618
|
-
position?.vaultAddress || "unknown",
|
|
41619
|
-
validationResponse.destinationAddress,
|
|
41620
|
-
positionId
|
|
41621
|
-
);
|
|
41622
|
-
await this._relayNotification(message);
|
|
41623
|
-
} catch (telegramError) {
|
|
41624
|
-
console.error(
|
|
41625
|
-
"Telegram notification failed:",
|
|
41626
|
-
telegramError instanceof Error ? telegramError.message : String(telegramError)
|
|
41627
|
-
);
|
|
41628
|
-
}
|
|
41629
41674
|
return {
|
|
41630
41675
|
success: true,
|
|
41631
41676
|
positionId,
|
|
@@ -41798,7 +41843,8 @@ Error data: ${errorData || "none"}`
|
|
|
41798
41843
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
41799
41844
|
pkpId,
|
|
41800
41845
|
this.getProviderOrThrow(),
|
|
41801
|
-
nagaPkpNftAddress
|
|
41846
|
+
nagaPkpNftAddress,
|
|
41847
|
+
this.getChipotlePublicKeyFallback()
|
|
41802
41848
|
);
|
|
41803
41849
|
pkpCache.set(request.positionId, {
|
|
41804
41850
|
publicKey: pkpPublicKey,
|
|
@@ -42514,6 +42560,27 @@ Error data: ${errorData || "none"}`
|
|
|
42514
42560
|
txid: executionResult.txid
|
|
42515
42561
|
});
|
|
42516
42562
|
}
|
|
42563
|
+
try {
|
|
42564
|
+
const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
|
|
42565
|
+
const message = executionResult.success ? formatBTCWithdrawalSuccessMessage(
|
|
42566
|
+
btcAmount,
|
|
42567
|
+
vaultAddress,
|
|
42568
|
+
withdrawalAddress,
|
|
42569
|
+
positionId,
|
|
42570
|
+
executionResult.txid
|
|
42571
|
+
) : formatBTCWithdrawalFailureMessage(
|
|
42572
|
+
btcAmount,
|
|
42573
|
+
vaultAddress,
|
|
42574
|
+
withdrawalAddress,
|
|
42575
|
+
positionId
|
|
42576
|
+
);
|
|
42577
|
+
await this._relayNotification(message);
|
|
42578
|
+
} catch (telegramError) {
|
|
42579
|
+
console.error(
|
|
42580
|
+
"Telegram notification failed:",
|
|
42581
|
+
telegramError instanceof Error ? telegramError.message : String(telegramError)
|
|
42582
|
+
);
|
|
42583
|
+
}
|
|
42517
42584
|
const transfers = [
|
|
42518
42585
|
{
|
|
42519
42586
|
success: executionResult.success,
|
|
@@ -42921,6 +42988,19 @@ Error data: ${errorData || "none"}`
|
|
|
42921
42988
|
// ============================================================================
|
|
42922
42989
|
// PRIVATE HELPER METHODS
|
|
42923
42990
|
// ============================================================================
|
|
42991
|
+
/**
|
|
42992
|
+
* Build the Chipotle service-mode fallback config for getPKPPublicKeyFromTokenId.
|
|
42993
|
+
* Returns undefined in standalone mode so the helper falls back to throwing.
|
|
42994
|
+
*/
|
|
42995
|
+
getChipotlePublicKeyFallback() {
|
|
42996
|
+
if (!this.config.serviceEndpoint)
|
|
42997
|
+
return void 0;
|
|
42998
|
+
return {
|
|
42999
|
+
serviceEndpoint: this.config.serviceEndpoint,
|
|
43000
|
+
serviceAuthToken: this.config.serviceAuthToken,
|
|
43001
|
+
debug: this.config.debug
|
|
43002
|
+
};
|
|
43003
|
+
}
|
|
42924
43004
|
/**
|
|
42925
43005
|
* Get provider or throw error
|
|
42926
43006
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -14331,53 +14331,53 @@ var init_deployment_addresses = __esm({
|
|
|
14331
14331
|
},
|
|
14332
14332
|
upgraded: {
|
|
14333
14333
|
PositionManager: {
|
|
14334
|
-
previousImplementation: "
|
|
14335
|
-
newImplementation: "
|
|
14336
|
-
upgradedAt: "2026-04-
|
|
14334
|
+
previousImplementation: "0x1b854fE920AC409b5f407b3ABCd556C998F889E5",
|
|
14335
|
+
newImplementation: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
|
|
14336
|
+
upgradedAt: "2026-04-30T08:33:24.883Z",
|
|
14337
14337
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14338
14338
|
reason: "Shared upgrade script: PositionManager implementation update"
|
|
14339
14339
|
},
|
|
14340
14340
|
LoanOperationsManagerModule: {
|
|
14341
|
-
previousImplementation: "
|
|
14342
|
-
newImplementation: "
|
|
14343
|
-
upgradedAt: "2026-04-
|
|
14341
|
+
previousImplementation: "0x448Fb59Cad99FFe3d0766F6943E4B579A824d46b",
|
|
14342
|
+
newImplementation: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
|
|
14343
|
+
upgradedAt: "2026-04-30T08:34:13.649Z",
|
|
14344
14344
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14345
14345
|
reason: "Shared upgrade script: LoanOperationsManagerModule implementation update"
|
|
14346
14346
|
},
|
|
14347
14347
|
UCDController: {
|
|
14348
|
-
previousImplementation: "
|
|
14349
|
-
newImplementation: "
|
|
14350
|
-
upgradedAt: "2026-04-
|
|
14348
|
+
previousImplementation: "0xB5322F0D4a07d4342FA38137ebD95ac41D1c6036",
|
|
14349
|
+
newImplementation: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
|
|
14350
|
+
upgradedAt: "2026-04-30T08:24:24.765Z",
|
|
14351
14351
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14352
14352
|
reason: "Shared upgrade script: UCDController implementation update"
|
|
14353
14353
|
},
|
|
14354
14354
|
TermManagerModule: {
|
|
14355
|
-
previousImplementation: "
|
|
14356
|
-
newImplementation: "
|
|
14357
|
-
upgradedAt: "2026-04-
|
|
14355
|
+
previousImplementation: "0x1D5E5A93215E49aA7260dA8d3B3de9faA686C087",
|
|
14356
|
+
newImplementation: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
|
|
14357
|
+
upgradedAt: "2026-04-30T08:26:37.176Z",
|
|
14358
14358
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14359
14359
|
reason: "Shared upgrade script: TermManagerModule implementation update"
|
|
14360
14360
|
},
|
|
14361
14361
|
CircuitBreakerModule: {
|
|
14362
|
-
previousImplementation: "
|
|
14363
|
-
newImplementation: "
|
|
14364
|
-
upgradedAt: "2026-04-
|
|
14362
|
+
previousImplementation: "0xa4940082a7b58c45C3885C4B59714C0dD048cDdC",
|
|
14363
|
+
newImplementation: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
|
|
14364
|
+
upgradedAt: "2026-04-30T08:29:37.131Z",
|
|
14365
14365
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14366
14366
|
reason: "Shared upgrade script: CircuitBreakerModule implementation update"
|
|
14367
14367
|
},
|
|
14368
14368
|
AdminModule: {
|
|
14369
|
-
previousImplementation: "
|
|
14370
|
-
newImplementation: "
|
|
14371
|
-
upgradedAt: "2026-04-
|
|
14369
|
+
previousImplementation: "0x8bDe850573a947b816D1EC5C5Ca177853bDfD049",
|
|
14370
|
+
newImplementation: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
|
|
14371
|
+
upgradedAt: "2026-04-30T08:31:13.444Z",
|
|
14372
14372
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14373
|
-
reason: "
|
|
14373
|
+
reason: "Shared upgrade script: AdminModule implementation update"
|
|
14374
14374
|
},
|
|
14375
14375
|
PositionManagerViews: {
|
|
14376
|
-
previousImplementation: "
|
|
14377
|
-
newImplementation: "
|
|
14378
|
-
upgradedAt: "2026-04-
|
|
14376
|
+
previousImplementation: "0xE8b4D4b6E3163EdfF8958da4cF8267ACa369D486",
|
|
14377
|
+
newImplementation: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
|
|
14378
|
+
upgradedAt: "2026-04-30T08:32:48.463Z",
|
|
14379
14379
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14380
|
-
reason: "
|
|
14380
|
+
reason: "Shared upgrade script: PositionManagerViews implementation update"
|
|
14381
14381
|
},
|
|
14382
14382
|
TestPositionManager: {
|
|
14383
14383
|
previousImplementation: "0x0B46Ee1a9C6b42559758B7FF78294Cd867BB08f8",
|
|
@@ -14387,51 +14387,51 @@ var init_deployment_addresses = __esm({
|
|
|
14387
14387
|
reason: "Add setPositionExpiry() for expiry-liquidation E2E testing"
|
|
14388
14388
|
},
|
|
14389
14389
|
UCDToken: {
|
|
14390
|
-
previousImplementation: "
|
|
14391
|
-
newImplementation: "
|
|
14392
|
-
upgradedAt: "2026-04-
|
|
14390
|
+
previousImplementation: "0xEFFF6f32Fc33C4Cb58a4d6858Bf90B8feA7D1D33",
|
|
14391
|
+
newImplementation: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
|
|
14392
|
+
upgradedAt: "2026-04-30T08:25:01.929Z",
|
|
14393
14393
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14394
14394
|
reason: "Shared upgrade script: UCDToken implementation update"
|
|
14395
14395
|
},
|
|
14396
14396
|
PositionManagerCoreModule: {
|
|
14397
|
-
previousImplementation: "
|
|
14398
|
-
newImplementation: "
|
|
14399
|
-
upgradedAt: "2026-04-
|
|
14397
|
+
previousImplementation: "0xeA5234c8E3a5F61c660db529d9d6f91fd989B56E",
|
|
14398
|
+
newImplementation: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
|
|
14399
|
+
upgradedAt: "2026-04-30T09:32:01.570Z",
|
|
14400
14400
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14401
14401
|
reason: "Shared upgrade script: PositionManagerCoreModule implementation update"
|
|
14402
14402
|
},
|
|
14403
14403
|
CollateralManagerModule: {
|
|
14404
|
-
previousImplementation: "
|
|
14405
|
-
newImplementation: "
|
|
14406
|
-
upgradedAt: "2026-04-
|
|
14404
|
+
previousImplementation: "0x84C5B89f60415F8df3Fee46Ef1a10a6484aa8e0A",
|
|
14405
|
+
newImplementation: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
|
|
14406
|
+
upgradedAt: "2026-04-30T08:27:24.702Z",
|
|
14407
14407
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14408
14408
|
reason: "Shared upgrade script: CollateralManagerModule implementation update"
|
|
14409
14409
|
},
|
|
14410
14410
|
LiquidationManagerModule: {
|
|
14411
|
-
previousImplementation: "
|
|
14412
|
-
newImplementation: "
|
|
14413
|
-
upgradedAt: "2026-04-
|
|
14411
|
+
previousImplementation: "0xBb625E44d72f3F1acDCbB08F73AFdAc38fCE3F64",
|
|
14412
|
+
newImplementation: "0xf74d5437691df92087170861213e26064358A7fb",
|
|
14413
|
+
upgradedAt: "2026-04-30T08:29:01.327Z",
|
|
14414
14414
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14415
14415
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
14416
14416
|
},
|
|
14417
14417
|
BTCSpendAuthorizer: {
|
|
14418
|
-
previousImplementation: "
|
|
14419
|
-
newImplementation: "
|
|
14420
|
-
upgradedAt: "2026-04-
|
|
14418
|
+
previousImplementation: "0x0B46DCdB63CB9928789ef1979C367da6ef04beAf",
|
|
14419
|
+
newImplementation: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
|
|
14420
|
+
upgradedAt: "2026-04-30T08:32:02.761Z",
|
|
14421
14421
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14422
14422
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
14423
14423
|
},
|
|
14424
14424
|
SimplePSMV2: {
|
|
14425
|
-
previousImplementation: "
|
|
14426
|
-
newImplementation: "
|
|
14427
|
-
upgradedAt: "2026-04-
|
|
14425
|
+
previousImplementation: "0xBdEFa375db7F9A498B81bcfdDd14FD16D02ca0BF",
|
|
14426
|
+
newImplementation: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
|
|
14427
|
+
upgradedAt: "2026-04-30T08:35:01.138Z",
|
|
14428
14428
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14429
14429
|
reason: "Shared upgrade script: SimplePSMV2 implementation update"
|
|
14430
14430
|
},
|
|
14431
14431
|
UpgradeValidator: {
|
|
14432
|
-
previousImplementation: "
|
|
14433
|
-
newImplementation: "
|
|
14434
|
-
upgradedAt: "2026-04-
|
|
14432
|
+
previousImplementation: "0xE410d1028Cdf2D94E3F5049F2D04B573703A2804",
|
|
14433
|
+
newImplementation: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
|
|
14434
|
+
upgradedAt: "2026-04-30T09:32:25.094Z",
|
|
14435
14435
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
14436
14436
|
reason: "Shared upgrade script: UpgradeValidator implementation update"
|
|
14437
14437
|
},
|
|
@@ -14508,26 +14508,26 @@ var init_deployment_addresses = __esm({
|
|
|
14508
14508
|
POSITION_MANAGER_VIEWS: "0x3b970E41a0668508B4B2ACb83653b2A402F745AE",
|
|
14509
14509
|
CIRCUIT_BREAKER_MODULE: "0x3D0B2cAE481821E57BA9CC3807bCC0d0D7F18bd8",
|
|
14510
14510
|
ADMIN_MODULE: "0xAcd1f07915b17CA3727e7fE89BdF618A1545a1ed",
|
|
14511
|
-
UCD_CONTROLLER_IMPL: "
|
|
14512
|
-
LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "
|
|
14513
|
-
TERM_MANAGER_MODULE_IMPL: "
|
|
14514
|
-
CIRCUIT_BREAKER_MODULE_IMPL: "
|
|
14515
|
-
ADMIN_MODULE_IMPL: "
|
|
14516
|
-
POSITION_MANAGER_VIEWS_IMPL: "
|
|
14517
|
-
POSITION_MANAGER_IMPL: "
|
|
14511
|
+
UCD_CONTROLLER_IMPL: "0x2d4d689A70B56b6E0B9F70BffA6265A55173A4A1",
|
|
14512
|
+
LOAN_OPERATIONS_MANAGER_MODULE_IMPL: "0x8880D85Da2F8e60D4e91AE2457C34d76659dfa71",
|
|
14513
|
+
TERM_MANAGER_MODULE_IMPL: "0x2EaF1052706120CAa6B6F75354F70f77ef2261eB",
|
|
14514
|
+
CIRCUIT_BREAKER_MODULE_IMPL: "0x8e9e10B14E6a91ec271FBEb4FD3fB1FE06b545dD",
|
|
14515
|
+
ADMIN_MODULE_IMPL: "0x67AE2F872c37f33db9bC631e135432B2845d308b",
|
|
14516
|
+
POSITION_MANAGER_VIEWS_IMPL: "0xadF8e0F34082a8fC23e727276e0aEf3af183C8Fd",
|
|
14517
|
+
POSITION_MANAGER_IMPL: "0xd163965Ea2e33d58635bf24B7539f0df3D384933",
|
|
14518
14518
|
SIMPLE_PSM_V2: "0x19EcF7BA26e054fd4Ff06009A03070103dbBB058",
|
|
14519
|
-
SIMPLE_PSM_V2_IMPL: "
|
|
14520
|
-
UCD_TOKEN_IMPL: "
|
|
14519
|
+
SIMPLE_PSM_V2_IMPL: "0x4107104fDF61AACC674f1F168c275f034c8112BF",
|
|
14520
|
+
UCD_TOKEN_IMPL: "0x155Da00Ee0beb1d9D5BA34Aeb62c9ad4E8227d5D",
|
|
14521
14521
|
POSITION_MANAGER_CORE_MODULE: "0xfFAA39a08887FeFB697eBC8691A8630CbCC33391",
|
|
14522
|
-
POSITION_MANAGER_CORE_MODULE_IMPL: "
|
|
14522
|
+
POSITION_MANAGER_CORE_MODULE_IMPL: "0x41168d9BF8e696eBAB05ea539321ac212859d80b",
|
|
14523
14523
|
COLLATERAL_MANAGER_MODULE: "0x967E92c976Fc0fa8268D37D4d6B7245d912aA7dB",
|
|
14524
|
-
COLLATERAL_MANAGER_MODULE_IMPL: "
|
|
14524
|
+
COLLATERAL_MANAGER_MODULE_IMPL: "0xd021ca6Dc2377F361E3c64f60C93E0e4075c2840",
|
|
14525
14525
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
14526
|
-
LIQUIDATION_MANAGER_MODULE_IMPL: "
|
|
14526
|
+
LIQUIDATION_MANAGER_MODULE_IMPL: "0xf74d5437691df92087170861213e26064358A7fb",
|
|
14527
14527
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
14528
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
14528
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0x4CD021181bD2583d10aB37D27FE2994b75c41b77",
|
|
14529
14529
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
14530
|
-
UPGRADE_VALIDATOR_IMPL: "
|
|
14530
|
+
UPGRADE_VALIDATOR_IMPL: "0x974C6F4e0F67Fa9d7Ab1aee8C10Bd85B201ec5D7",
|
|
14531
14531
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
14532
14532
|
BITCOIN_PROVIDER_REGISTRY_IMPL: "0x225309A4ae6D146ba93A3278A7b40224FfC81448",
|
|
14533
14533
|
LIT_ACTION_VALIDATOR: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
|
|
@@ -31112,11 +31112,62 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signer)
|
|
|
31112
31112
|
signature: signature2
|
|
31113
31113
|
};
|
|
31114
31114
|
}
|
|
31115
|
-
|
|
31115
|
+
function isChipotlePkpId(pkpTokenId) {
|
|
31116
31116
|
const rawHex = pkpTokenId.startsWith("0x") ? pkpTokenId.slice(2) : pkpTokenId;
|
|
31117
|
-
|
|
31117
|
+
return rawHex.length === 64 && rawHex.startsWith("000000000000000000000000") && rawHex !== "0".repeat(64);
|
|
31118
|
+
}
|
|
31119
|
+
async function deriveChipotlePublicKeyViaService(pkpTokenId, fallback) {
|
|
31120
|
+
const url = `${fallback.serviceEndpoint}/api/lit/pkp/derive-public-key`;
|
|
31121
|
+
const controller = new AbortController();
|
|
31122
|
+
const timeout = setTimeout(
|
|
31123
|
+
() => controller.abort(),
|
|
31124
|
+
fallback.timeoutMs ?? 6e4
|
|
31125
|
+
);
|
|
31126
|
+
try {
|
|
31127
|
+
const headers = {
|
|
31128
|
+
"Content-Type": "application/json"
|
|
31129
|
+
};
|
|
31130
|
+
if (fallback.serviceAuthToken) {
|
|
31131
|
+
headers["Authorization"] = `Bearer ${fallback.serviceAuthToken}`;
|
|
31132
|
+
}
|
|
31133
|
+
const response = await fetch(url, {
|
|
31134
|
+
method: "POST",
|
|
31135
|
+
headers,
|
|
31136
|
+
body: JSON.stringify({
|
|
31137
|
+
pkpId: pkpTokenId,
|
|
31138
|
+
...fallback.borrowerAddress && {
|
|
31139
|
+
borrowerAddress: fallback.borrowerAddress
|
|
31140
|
+
}
|
|
31141
|
+
}),
|
|
31142
|
+
signal: controller.signal
|
|
31143
|
+
});
|
|
31144
|
+
if (!response.ok) {
|
|
31145
|
+
const errorText = await response.text();
|
|
31146
|
+
throw new Error(
|
|
31147
|
+
`derive-public-key service error (${response.status}): ${errorText}`
|
|
31148
|
+
);
|
|
31149
|
+
}
|
|
31150
|
+
const envelope = await response.json();
|
|
31151
|
+
const publicKey = envelope?.data?.publicKey;
|
|
31152
|
+
if (!envelope?.success || !publicKey) {
|
|
31153
|
+
throw new Error(
|
|
31154
|
+
`derive-public-key returned no publicKey (envelope keys: ${Object.keys(
|
|
31155
|
+
envelope ?? {}
|
|
31156
|
+
).join(", ")})`
|
|
31157
|
+
);
|
|
31158
|
+
}
|
|
31159
|
+
return publicKey.startsWith("0x") ? publicKey : `0x${publicKey}`;
|
|
31160
|
+
} finally {
|
|
31161
|
+
clearTimeout(timeout);
|
|
31162
|
+
}
|
|
31163
|
+
}
|
|
31164
|
+
async function getPKPPublicKeyFromTokenId(pkpTokenId, provider, pkpNftContractAddress, chipotleFallback) {
|
|
31165
|
+
if (isChipotlePkpId(pkpTokenId)) {
|
|
31166
|
+
if (chipotleFallback?.serviceEndpoint) {
|
|
31167
|
+
return deriveChipotlePublicKeyViaService(pkpTokenId, chipotleFallback);
|
|
31168
|
+
}
|
|
31118
31169
|
throw new Error(
|
|
31119
|
-
`pkpId ${pkpTokenId} is a Chipotle wallet address (ABI-encoded ETH address). Chipotle PKPs are not NFTs and have no on-chain public key lookup.
|
|
31170
|
+
`pkpId ${pkpTokenId} is a Chipotle wallet address (ABI-encoded ETH address). Chipotle PKPs are not NFTs and have no on-chain public key lookup. Provide chipotleFallback.serviceEndpoint to recover via lit-ops-server, or ensure the PKP public key is populated in cache during position creation.`
|
|
31120
31171
|
);
|
|
31121
31172
|
}
|
|
31122
31173
|
if (!provider) {
|
|
@@ -31411,7 +31462,7 @@ function extractOptionalLitSignature(raw) {
|
|
|
31411
31462
|
|
|
31412
31463
|
// src/modules/contract/contract-manager.module.ts
|
|
31413
31464
|
var POSITION_MANAGER_ABI = [
|
|
31414
|
-
"function createPosition(bytes32 pkpId, bytes calldata validatorSignature, string mainnetVaultAddress, string regtestVaultAddress, uint256 selectedTermMonths, uint256 validatorVersion) external returns (bytes32 positionId)",
|
|
31465
|
+
"function createPosition(bytes32 pkpId, bytes calldata validatorSignature, string mainnetVaultAddress, string regtestVaultAddress, uint256 selectedTermMonths, uint256 validatorVersion, bytes calldata pkpPublicKey) external returns (bytes32 positionId)",
|
|
31415
31466
|
"function mintUCD(bytes32 positionId, uint256 mintAmount, uint256 mintFee, uint256 newDebt, uint256 newCollateral, uint256 btcPrice, bytes32 authorizedSpendsHash, bytes32 ucdDebtHash, bytes32 contractHash, uint256 quantumTimestamp, bytes calldata mintValidatorSignature) external returns (bool)",
|
|
31416
31467
|
"function makePayment(bytes32 positionId, uint256 paymentAmount, uint256 quantumTimestamp, uint256 btcPrice, bytes calldata paymentValidatorSignature) external returns (bool)",
|
|
31417
31468
|
"function extendPosition(bytes32 positionId, uint256 selectedTerm, uint256 quantumTimestamp, uint256 btcPrice, uint256 availableBTCBalance, uint256 proRataRenewalFee, bytes calldata extensionValidatorSignature) external returns (bool)",
|
|
@@ -33060,6 +33111,10 @@ var LoanCreator = class {
|
|
|
33060
33111
|
ethers_exports.utils.hexlify(BigInt(pkpData.tokenId)),
|
|
33061
33112
|
32
|
|
33062
33113
|
);
|
|
33114
|
+
const pkpPublicKeyUncompressed = ethers_exports.utils.computePublicKey(
|
|
33115
|
+
pkpData.publicKey,
|
|
33116
|
+
false
|
|
33117
|
+
);
|
|
33063
33118
|
console.log("\n\u{1F50D} PKP TOKEN ID CONVERSION TRACE (SDK):");
|
|
33064
33119
|
console.log("==========================================");
|
|
33065
33120
|
console.log(
|
|
@@ -33110,7 +33165,8 @@ var LoanCreator = class {
|
|
|
33110
33165
|
mainnetVaultAddress,
|
|
33111
33166
|
regtestVaultAddress,
|
|
33112
33167
|
request.selectedTerm,
|
|
33113
|
-
validatorVersion
|
|
33168
|
+
validatorVersion,
|
|
33169
|
+
pkpPublicKeyUncompressed
|
|
33114
33170
|
]);
|
|
33115
33171
|
console.log("\u{1F50D} ENCODED CALLDATA (first 256 chars):", encoded.substring(0, 256));
|
|
33116
33172
|
console.log("\u{1F50D} ENCODED CALLDATA full length:", encoded.length);
|
|
@@ -33123,7 +33179,8 @@ var LoanCreator = class {
|
|
|
33123
33179
|
mainnetVaultAddress,
|
|
33124
33180
|
regtestVaultAddress,
|
|
33125
33181
|
request.selectedTerm,
|
|
33126
|
-
validatorVersion
|
|
33182
|
+
validatorVersion,
|
|
33183
|
+
pkpPublicKeyUncompressed
|
|
33127
33184
|
);
|
|
33128
33185
|
if (!tx) {
|
|
33129
33186
|
return failure(
|
|
@@ -33675,8 +33732,8 @@ var LoanQuery = class {
|
|
|
33675
33732
|
batch.map(async (loan) => {
|
|
33676
33733
|
try {
|
|
33677
33734
|
const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
|
|
33678
|
-
const
|
|
33679
|
-
if (
|
|
33735
|
+
const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
|
|
33736
|
+
if (isChipotlePkpId2) {
|
|
33680
33737
|
if (this.config.positionManagerCoreAddress && this.config.provider) {
|
|
33681
33738
|
const pmContract = new ethers_exports.Contract(
|
|
33682
33739
|
this.config.positionManagerCoreAddress,
|
|
@@ -36826,7 +36883,7 @@ function formatLoanCreationMessage(positionId, pkpId, vaultAddress) {
|
|
|
36826
36883
|
}
|
|
36827
36884
|
function formatBTCWithdrawalFailureMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId) {
|
|
36828
36885
|
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
36829
|
-
return
|
|
36886
|
+
return `\u274C BTC withdrawal FAILED: ${formattedAmount} from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}`;
|
|
36830
36887
|
}
|
|
36831
36888
|
function formatLoanRenewalMessage(positionId, txHash) {
|
|
36832
36889
|
return `Loan id ${positionId} was successfully renewed. Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
@@ -36840,9 +36897,10 @@ function formatBalanceConfirmationMessage(loanId) {
|
|
|
36840
36897
|
function formatBalanceConfirmationFailureMessage(loanId) {
|
|
36841
36898
|
return `FAILED to update to PENDING_MINT for loan id ${loanId}`;
|
|
36842
36899
|
}
|
|
36843
|
-
function formatBTCWithdrawalSuccessMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId) {
|
|
36900
|
+
function formatBTCWithdrawalSuccessMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId, btcTxId) {
|
|
36844
36901
|
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
36845
|
-
|
|
36902
|
+
const txSuffix = btcTxId ? ` (tx: ${btcTxId})` : "";
|
|
36903
|
+
return `\u2705 BTC withdrawal SUCCEEDED: ${formattedAmount} sent from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}${txSuffix}`;
|
|
36846
36904
|
}
|
|
36847
36905
|
function formatLiquidationSkippedMessage(loanId, ratio, threshold, btcVault, btcVaultBalance, ucdDebt, btcPrice) {
|
|
36848
36906
|
const formattedPrice = formatBTCPrice(btcPrice);
|
|
@@ -37882,7 +37940,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
37882
37940
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
37883
37941
|
position2.pkpId,
|
|
37884
37942
|
this.getProviderOrThrow(),
|
|
37885
|
-
nagaPkpNftAddress
|
|
37943
|
+
nagaPkpNftAddress,
|
|
37944
|
+
this.getChipotlePublicKeyFallback()
|
|
37886
37945
|
);
|
|
37887
37946
|
pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
37888
37947
|
pkpCache.set(request.positionId, {
|
|
@@ -38985,7 +39044,8 @@ Error data: ${errorData || "none"}`
|
|
|
38985
39044
|
const pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
38986
39045
|
position.pkpId,
|
|
38987
39046
|
this.getProviderOrThrow(),
|
|
38988
|
-
nagaPkpNftAddressLiq
|
|
39047
|
+
nagaPkpNftAddressLiq,
|
|
39048
|
+
this.getChipotlePublicKeyFallback()
|
|
38989
39049
|
);
|
|
38990
39050
|
const pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
38991
39051
|
pkpData = {
|
|
@@ -41068,7 +41128,8 @@ Error data: ${errorData || "none"}`
|
|
|
41068
41128
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
41069
41129
|
position.pkpId,
|
|
41070
41130
|
this.getProviderOrThrow(),
|
|
41071
|
-
nagaPkpNftAddress
|
|
41131
|
+
nagaPkpNftAddress,
|
|
41132
|
+
this.getChipotlePublicKeyFallback()
|
|
41072
41133
|
);
|
|
41073
41134
|
pkpEthAddress = ethers_exports.utils.computeAddress(pkpPublicKey);
|
|
41074
41135
|
pkpCache.set(positionId, {
|
|
@@ -41538,22 +41599,6 @@ Error data: ${errorData || "none"}`
|
|
|
41538
41599
|
gasUsed: receipt.gasUsed?.toString() || "unknown"
|
|
41539
41600
|
});
|
|
41540
41601
|
}
|
|
41541
|
-
try {
|
|
41542
|
-
const position = await this.getPosition(positionId);
|
|
41543
|
-
const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
|
|
41544
|
-
const message = formatBTCWithdrawalSuccessMessage(
|
|
41545
|
-
btcAmount,
|
|
41546
|
-
position?.vaultAddress || "unknown",
|
|
41547
|
-
validationResponse.destinationAddress,
|
|
41548
|
-
positionId
|
|
41549
|
-
);
|
|
41550
|
-
await this._relayNotification(message);
|
|
41551
|
-
} catch (telegramError) {
|
|
41552
|
-
console.error(
|
|
41553
|
-
"Telegram notification failed:",
|
|
41554
|
-
telegramError instanceof Error ? telegramError.message : String(telegramError)
|
|
41555
|
-
);
|
|
41556
|
-
}
|
|
41557
41602
|
return {
|
|
41558
41603
|
success: true,
|
|
41559
41604
|
positionId,
|
|
@@ -41726,7 +41771,8 @@ Error data: ${errorData || "none"}`
|
|
|
41726
41771
|
pkpPublicKey = await getPKPPublicKeyFromTokenId(
|
|
41727
41772
|
pkpId,
|
|
41728
41773
|
this.getProviderOrThrow(),
|
|
41729
|
-
nagaPkpNftAddress
|
|
41774
|
+
nagaPkpNftAddress,
|
|
41775
|
+
this.getChipotlePublicKeyFallback()
|
|
41730
41776
|
);
|
|
41731
41777
|
pkpCache.set(request.positionId, {
|
|
41732
41778
|
publicKey: pkpPublicKey,
|
|
@@ -42442,6 +42488,27 @@ Error data: ${errorData || "none"}`
|
|
|
42442
42488
|
txid: executionResult.txid
|
|
42443
42489
|
});
|
|
42444
42490
|
}
|
|
42491
|
+
try {
|
|
42492
|
+
const btcAmount = (Number(withdrawalAmount) / 1e8).toFixed(8);
|
|
42493
|
+
const message = executionResult.success ? formatBTCWithdrawalSuccessMessage(
|
|
42494
|
+
btcAmount,
|
|
42495
|
+
vaultAddress,
|
|
42496
|
+
withdrawalAddress,
|
|
42497
|
+
positionId,
|
|
42498
|
+
executionResult.txid
|
|
42499
|
+
) : formatBTCWithdrawalFailureMessage(
|
|
42500
|
+
btcAmount,
|
|
42501
|
+
vaultAddress,
|
|
42502
|
+
withdrawalAddress,
|
|
42503
|
+
positionId
|
|
42504
|
+
);
|
|
42505
|
+
await this._relayNotification(message);
|
|
42506
|
+
} catch (telegramError) {
|
|
42507
|
+
console.error(
|
|
42508
|
+
"Telegram notification failed:",
|
|
42509
|
+
telegramError instanceof Error ? telegramError.message : String(telegramError)
|
|
42510
|
+
);
|
|
42511
|
+
}
|
|
42445
42512
|
const transfers = [
|
|
42446
42513
|
{
|
|
42447
42514
|
success: executionResult.success,
|
|
@@ -42849,6 +42916,19 @@ Error data: ${errorData || "none"}`
|
|
|
42849
42916
|
// ============================================================================
|
|
42850
42917
|
// PRIVATE HELPER METHODS
|
|
42851
42918
|
// ============================================================================
|
|
42919
|
+
/**
|
|
42920
|
+
* Build the Chipotle service-mode fallback config for getPKPPublicKeyFromTokenId.
|
|
42921
|
+
* Returns undefined in standalone mode so the helper falls back to throwing.
|
|
42922
|
+
*/
|
|
42923
|
+
getChipotlePublicKeyFallback() {
|
|
42924
|
+
if (!this.config.serviceEndpoint)
|
|
42925
|
+
return void 0;
|
|
42926
|
+
return {
|
|
42927
|
+
serviceEndpoint: this.config.serviceEndpoint,
|
|
42928
|
+
serviceAuthToken: this.config.serviceAuthToken,
|
|
42929
|
+
debug: this.config.debug
|
|
42930
|
+
};
|
|
42931
|
+
}
|
|
42852
42932
|
/**
|
|
42853
42933
|
* Get provider or throw error
|
|
42854
42934
|
*/
|
|
@@ -12,7 +12,7 @@ import type { BigNumber } from "ethers";
|
|
|
12
12
|
* Based on contracts/src/interfaces/IPositionManager.sol
|
|
13
13
|
*/
|
|
14
14
|
export interface PositionManager extends ethers5.Contract {
|
|
15
|
-
createPosition(pkpId: string, validatorSignature: string, mainnetVaultAddress: string, regtestVaultAddress: string, selectedTermMonths: number | BigNumber, validatorVersion: number | BigNumber): Promise<ethers5.ContractTransaction>;
|
|
15
|
+
createPosition(pkpId: string, validatorSignature: string, mainnetVaultAddress: string, regtestVaultAddress: string, selectedTermMonths: number | BigNumber, validatorVersion: number | BigNumber, pkpPublicKey: string): Promise<ethers5.ContractTransaction>;
|
|
16
16
|
mintUCD(positionId: string, mintAmount: BigNumber, mintFee: BigNumber, newDebt: BigNumber, newCollateral: BigNumber, btcPrice: BigNumber, authorizedSpendsHash: string, ucdDebtHash: string, contractHash: string, quantumTimestamp: BigNumber, mintValidatorSignature: string): Promise<ethers5.ContractTransaction>;
|
|
17
17
|
liquidatePosition(positionId: string, btcPrice: BigNumber, quantumTimestamp: BigNumber, liquidationValidatorSignature: string): Promise<ethers5.ContractTransaction>;
|
|
18
18
|
getPosition(positionId: string): Promise<{
|
|
@@ -589,6 +589,11 @@ export declare class DiamondHandsSDK {
|
|
|
589
589
|
* Will be integrated into core methods in Round 2
|
|
590
590
|
*/
|
|
591
591
|
private extractLitActionError;
|
|
592
|
+
/**
|
|
593
|
+
* Build the Chipotle service-mode fallback config for getPKPPublicKeyFromTokenId.
|
|
594
|
+
* Returns undefined in standalone mode so the helper falls back to throwing.
|
|
595
|
+
*/
|
|
596
|
+
private getChipotlePublicKeyFallback;
|
|
592
597
|
/**
|
|
593
598
|
* Get provider or throw error
|
|
594
599
|
*/
|
|
@@ -132,24 +132,40 @@ export declare function generatePaymentAuthorization(positionId: string, amount:
|
|
|
132
132
|
* - LIT Action validates recovered address === position owner
|
|
133
133
|
*/
|
|
134
134
|
export declare function generateExtendAuthorization(positionId: string, selectedTerm: number, chainId: number, signer: ethers5.Signer): Promise<ExtendOwnerAuthorization>;
|
|
135
|
+
/**
|
|
136
|
+
* Optional Chipotle service fallback for `getPKPPublicKeyFromTokenId`.
|
|
137
|
+
*
|
|
138
|
+
* Chipotle PKPs have no on-chain `getPubkey(tokenId)` lookup, so when the
|
|
139
|
+
* SDK's in-memory `pkp-data` cache is empty (page reload, new device, cleared
|
|
140
|
+
* browser data) we recover the public key by re-running pkp-validator via the
|
|
141
|
+
* lit-ops-server `/api/lit/pkp/derive-public-key` endpoint. Chipotle key
|
|
142
|
+
* derivation is deterministic from `pkpId`, so this returns the same key.
|
|
143
|
+
*/
|
|
144
|
+
export interface ChipotleServiceFallback {
|
|
145
|
+
serviceEndpoint: string;
|
|
146
|
+
serviceAuthToken?: string;
|
|
147
|
+
borrowerAddress?: string;
|
|
148
|
+
timeoutMs?: number;
|
|
149
|
+
debug?: boolean;
|
|
150
|
+
}
|
|
135
151
|
/**
|
|
136
152
|
* Get PKP public key from PKP token ID.
|
|
137
153
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* and the PKP NFT contract address for that chain.
|
|
154
|
+
* For datil/naga-era PKPs minted as NFTs on Chronicle Yellowstone: looks up
|
|
155
|
+
* via `getPubkey(tokenId)` on the supplied PKP NFT contract.
|
|
141
156
|
*
|
|
142
|
-
* Chipotle PKPs
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
157
|
+
* For Chipotle PKPs (ABI-encoded ETH address): there is no on-chain lookup, so
|
|
158
|
+
* if `chipotleFallback.serviceEndpoint` is configured, the public key is
|
|
159
|
+
* derived by calling lit-ops-server. If the fallback is not configured, this
|
|
160
|
+
* throws with a clear diagnostic.
|
|
146
161
|
*
|
|
147
162
|
* @param pkpTokenId - PKP token ID (bytes32 hex string)
|
|
148
|
-
* @param provider - Ethereum provider connected to the PKP NFT chain
|
|
149
|
-
* @param pkpNftContractAddress - PKP NFT contract address on that chain (
|
|
163
|
+
* @param provider - Ethereum provider connected to the PKP NFT chain (datil/naga only)
|
|
164
|
+
* @param pkpNftContractAddress - PKP NFT contract address on that chain (datil/naga only)
|
|
165
|
+
* @param chipotleFallback - Service-mode fallback used when pkpTokenId is a Chipotle id
|
|
150
166
|
* @returns PKP public key as hex string with '0x' prefix
|
|
151
167
|
*/
|
|
152
|
-
export declare function getPKPPublicKeyFromTokenId(pkpTokenId: string, provider?: ethers5.providers.Provider, pkpNftContractAddress?: string): Promise<string>;
|
|
168
|
+
export declare function getPKPPublicKeyFromTokenId(pkpTokenId: string, provider?: ethers5.providers.Provider, pkpNftContractAddress?: string, chipotleFallback?: ChipotleServiceFallback): Promise<string>;
|
|
153
169
|
/**
|
|
154
170
|
* Withdraw Owner Authorization Interface (matches lit-actions)
|
|
155
171
|
*/
|
|
@@ -132,7 +132,7 @@ export declare function formatBalanceConfirmationFailureMessage(loanId: string):
|
|
|
132
132
|
* @param loanId - Position/loan ID
|
|
133
133
|
* @returns Formatted message string
|
|
134
134
|
*/
|
|
135
|
-
export declare function formatBTCWithdrawalSuccessMessage(withdrawalAmount: number | string, btcVault: string, btcDestinationAddress: string, loanId: string): string;
|
|
135
|
+
export declare function formatBTCWithdrawalSuccessMessage(withdrawalAmount: number | string, btcVault: string, btcDestinationAddress: string, loanId: string, btcTxId?: string): string;
|
|
136
136
|
/**
|
|
137
137
|
* Format a liquidation skipped notification message
|
|
138
138
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.221",
|
|
4
4
|
"description": "TypeScript SDK for Diamond Hands Protocol - Bitcoin-backed lending with LIT Protocol PKPs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@gvnrdao/dh-lit-actions": "^0.0.
|
|
74
|
-
"@gvnrdao/dh-lit-ops": "^0.0.
|
|
73
|
+
"@gvnrdao/dh-lit-actions": "^0.0.285",
|
|
74
|
+
"@gvnrdao/dh-lit-ops": "^0.0.258",
|
|
75
75
|
"@noble/hashes": "^1.5.0",
|
|
76
76
|
"axios": "^1.15.2",
|
|
77
77
|
"bech32": "^2.0.0",
|