Skip to content

Commit 2bf8868

Browse files
feat: add conduit for Abstract (#1715)
* add conduit for abstract * lint * improve * fix --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 06380ba commit 2bf8868

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

src/constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,16 @@ export const SHARED_STOREFRONT_LAZY_MINT_ADAPTER_CROSS_CHAIN_ADDRESS =
3131

3232
export const OPENSEA_FEE_RECIPIENT =
3333
"0x0000a26b00c1f0df003000390027140000faa719";
34+
35+
export const OPENSEA_CONDUIT_KEY =
36+
"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000";
37+
38+
// eslint-disable-next-line import/no-unused-modules
39+
export const OPENSEA_CONDUIT_ADDRESS =
40+
"0x1e0049783f008a0085193e00003d00cd54003c71";
41+
42+
export const OPENSEA_CONDUIT_KEY_2 =
43+
"0x61159fefdfada89302ed55f8b9e89e2d67d8258712b3a3f89aa88525877f1d5e";
44+
45+
export const OPENSEA_CONDUIT_ADDRESS_2 =
46+
"0x963f00d3ff000064ffcba824b800c0000000c300";

src/sdk.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import EventEmitter = require("events");
22
import { Seaport } from "@opensea/seaport-js";
3-
import {
4-
CROSS_CHAIN_SEAPORT_V1_6_ADDRESS,
5-
OPENSEA_CONDUIT_KEY,
6-
} from "@opensea/seaport-js/lib/constants";
3+
import { CROSS_CHAIN_SEAPORT_V1_6_ADDRESS } from "@opensea/seaport-js/lib/constants";
74
import {
85
AdvancedOrder,
96
ConsiderationInputItem,
@@ -24,6 +21,8 @@ import {
2421
import { OpenSeaAPI } from "./api/api";
2522
import { CollectionOffer, Listing, NFT, Order } from "./api/types";
2623
import {
24+
OPENSEA_CONDUIT_ADDRESS_2,
25+
OPENSEA_CONDUIT_KEY_2,
2726
INVERSE_BASIS_POINT,
2827
ENGLISH_AUCTION_ZONE_MAINNETS,
2928
ENGLISH_AUCTION_ZONE_TESTNETS,
@@ -54,6 +53,7 @@ import {
5453
AssetWithTokenId,
5554
} from "./types";
5655
import {
56+
getDefaultConduitKey,
5757
getMaxOrderExpirationTimestamp,
5858
hasErrorCode,
5959
getAssetItemType,
@@ -111,7 +111,10 @@ export class OpenSeaSDK {
111111

112112
// eslint-disable-next-line @typescript-eslint/no-explicit-any
113113
this.seaport_v1_6 = new Seaport(this._signerOrProvider as any, {
114-
overrides: { defaultConduitKey: OPENSEA_CONDUIT_KEY },
114+
conduitKeyToConduit: {
115+
[OPENSEA_CONDUIT_KEY_2]: OPENSEA_CONDUIT_ADDRESS_2,
116+
},
117+
overrides: { defaultConduitKey: getDefaultConduitKey(this.chain) },
115118
});
116119

117120
// Emit events

src/utils/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { ethers, FixedNumber } from "ethers";
66
import {
77
FIXED_NUMBER_100,
88
MAX_EXPIRATION_MONTHS,
9+
OPENSEA_CONDUIT_KEY,
10+
OPENSEA_CONDUIT_KEY_2,
911
SHARED_STOREFRONT_ADDRESSES,
1012
SHARED_STOREFRONT_LAZY_MINT_ADAPTER_CROSS_CHAIN_ADDRESS,
1113
} from "../constants";
@@ -395,6 +397,20 @@ export const requireValidProtocol = (protocolAddress: string) => {
395397
}
396398
};
397399

400+
/**
401+
* Get the default conduit key for a given chain.
402+
* @param chain The chain to get the conduit key for
403+
* @returns The conduit key for the chain
404+
*/
405+
export const getDefaultConduitKey = (chain: Chain): string => {
406+
switch (chain) {
407+
case Chain.Abstract:
408+
return OPENSEA_CONDUIT_KEY_2;
409+
default:
410+
return OPENSEA_CONDUIT_KEY;
411+
}
412+
};
413+
398414
/**
399415
* Decodes an encoded string of token IDs into an array of individual token IDs using bigint for precise calculations.
400416
*

0 commit comments

Comments
 (0)