Skip to content

Commit

Permalink
Rename Account to HotAccount and import Beet as needed (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-metaplex authored Sep 24, 2022
1 parent 7e331f2 commit df54253
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 34 deletions.
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/metaplex-foundation/metaplex-swift-program-library",
"state" : {
"branch" : "main",
"revision" : "4684d1b6a7a9e491adcc600c9cdd3cb73aec783d"
"branch" : "1.0.0",
"revision" : "07a5afc5d41218cbed778a40055d06724c765668"
}
},
{
Expand All @@ -41,17 +41,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/metaplex-foundation/Solana.Swift.git",
"state" : {
"branch" : "master",
"revision" : "2412155fd8855e98ae02917b0791b2fbc4646a01"
"branch" : "2.0.0",
"revision" : "2e39f78bb7fa25967bbd51dcac24a3c5510f675a"
}
},
{
"identity" : "solita-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/metaplex-foundation/solita-swift.git",
"state" : {
"branch" : "main",
"revision" : "eb36c8343870bc760c7e84ba3781a7f0c32af1a4"
"branch" : "1.0.1",
"revision" : "9c75ad06afd0e2823ac5d969df7e74e52a022442"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
targets: ["Metaplex"]),
],
dependencies: [
.package(url: "https://github.com/metaplex-foundation/metaplex-swift-program-library", branch: "main")
.package(url: "https://github.com/metaplex-foundation/metaplex-swift-program-library", branch: "1.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
5 changes: 3 additions & 2 deletions Sources/Metaplex/Drivers/Identity/KeypairIdentityDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ class KeypairIdentityDriver: IdentityDriver {

internal var publicKey: PublicKey
private let secretKey: Data
private let account: Account
private let account: HotAccount
private let solanaRPC: Api
init(solanaRPC: Api, account: Account) {

init(solanaRPC: Api, account: HotAccount) {
self.solanaRPC = solanaRPC
self.publicKey = account.publicKey
self.secretKey = account.secretKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public struct CreateMasterEditionV3 {
programId: PublicKey = TokenMetadataProgram.publicKey
) -> TransactionInstruction {
let keys = [
Account.Meta(publicKey: accounts.edition, isSigner: false, isWritable: true),
Account.Meta(publicKey: accounts.mint, isSigner: false, isWritable: true),
Account.Meta(publicKey: accounts.updateAuthority, isSigner: true, isWritable: false),
Account.Meta(publicKey: accounts.mintAuthority, isSigner: true, isWritable: false),
Account.Meta(publicKey: accounts.payer, isSigner: true, isWritable: true),
Account.Meta(publicKey: accounts.metadata, isSigner: false, isWritable: true),
Account.Meta(publicKey: accounts.tokenProgram ?? PublicKey.tokenProgramId, isSigner: false, isWritable: false),
Account.Meta(publicKey: accounts.systemProgram ?? PublicKey.systemProgramId, isSigner: false, isWritable: false),
Account.Meta(publicKey: accounts.rent ?? PublicKey.sysvarRent, isSigner: false, isWritable: false)
AccountMeta(publicKey: accounts.edition, isSigner: false, isWritable: true),
AccountMeta(publicKey: accounts.mint, isSigner: false, isWritable: true),
AccountMeta(publicKey: accounts.updateAuthority, isSigner: true, isWritable: false),
AccountMeta(publicKey: accounts.mintAuthority, isSigner: true, isWritable: false),
AccountMeta(publicKey: accounts.payer, isSigner: true, isWritable: true),
AccountMeta(publicKey: accounts.metadata, isSigner: false, isWritable: true),
AccountMeta(publicKey: accounts.tokenProgram ?? PublicKey.tokenProgramId, isSigner: false, isWritable: false),
AccountMeta(publicKey: accounts.systemProgram ?? PublicKey.systemProgramId, isSigner: false, isWritable: false),
AccountMeta(publicKey: accounts.rent ?? PublicKey.sysvarRent, isSigner: false, isWritable: false)
]

var data = [Index.create]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public struct CreateMetadataAccountV3 {
programId: PublicKey = TokenMetadataProgram.publicKey
) -> TransactionInstruction {
let keys = [
Account.Meta(publicKey: accounts.metadata, isSigner: false, isWritable: true),
Account.Meta(publicKey: accounts.mint, isSigner: false, isWritable: false),
Account.Meta(publicKey: accounts.mintAuthority, isSigner: true, isWritable: false),
Account.Meta(publicKey: accounts.payer, isSigner: true, isWritable: true),
Account.Meta(publicKey: accounts.updateAuthority, isSigner: false, isWritable: false),
Account.Meta(publicKey: accounts.systemProgram ?? PublicKey.systemProgramId, isSigner: false, isWritable: false),
Account.Meta(publicKey: accounts.rent ?? PublicKey.sysvarRent, isSigner: false, isWritable: false)
AccountMeta(publicKey: accounts.metadata, isSigner: false, isWritable: true),
AccountMeta(publicKey: accounts.mint, isSigner: false, isWritable: false),
AccountMeta(publicKey: accounts.mintAuthority, isSigner: true, isWritable: false),
AccountMeta(publicKey: accounts.payer, isSigner: true, isWritable: true),
AccountMeta(publicKey: accounts.updateAuthority, isSigner: false, isWritable: false),
AccountMeta(publicKey: accounts.systemProgram ?? PublicKey.systemProgramId, isSigner: false, isWritable: false),
AccountMeta(publicKey: accounts.rent ?? PublicKey.sysvarRent, isSigner: false, isWritable: false)
]

var data = [Index.create]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let mnemonic = ["across", "start", "ancient", "solid", "bid", "sentence", "visit

final class KeypairIdentityDriverTests: XCTestCase {

let account = Account(phrase: mnemonic, network: .mainnetBeta, derivablePath: .default)!
let account = HotAccount(phrase: mnemonic, network: .mainnetBeta, derivablePath: .default)!
let solanaConnection = SolanaConnectionDriver(endpoint: .mainnetBetaSolana)
var keypairIdentityDriver: KeypairIdentityDriver!

Expand All @@ -25,7 +25,7 @@ final class KeypairIdentityDriverTests: XCTestCase {

func testSetUpKeypairIdentityDriver() {
let solanaConnection = SolanaConnectionDriver(endpoint: .mainnetBetaSolana)
let keypairIdentityDriver = KeypairIdentityDriver(solanaRPC: solanaConnection.api, account: Account(phrase: mnemonic, network: .mainnetBeta, derivablePath: .default)!)
let keypairIdentityDriver = KeypairIdentityDriver(solanaRPC: solanaConnection.api, account: HotAccount(phrase: mnemonic, network: .mainnetBeta, derivablePath: .default)!)
XCTAssertEqual(keypairIdentityDriver.publicKey.base58EncodedString, "FJyTK5ggCyWaZoJoQ9YAeRokNZtHbN4UwzeSWa2HxNyy")
}

Expand Down Expand Up @@ -57,7 +57,4 @@ final class KeypairIdentityDriverTests: XCTestCase {
let serialized = try! transactionResult.serialize().get()
XCTAssertEqual(serialized.base64EncodedString(), expedtedSignedTransaction)
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
import Foundation
import XCTest
import Solana

@testable import Metaplex

final class CreateNftOnChainOperationTests: XCTestCase {
var account: Account!
var mintAccount: Account!
var account: HotAccount!
var mintAccount: HotAccount!
var metaplex: Metaplex!

override func setUpWithError() throws {
let phrase: [String] = "siege amazing camp income refuse struggle feed kingdom lawn champion velvet crystal stomach trend hen uncover roast nasty until hidden crumble city bag minute".components(separatedBy: " ")
account = Account(phrase: phrase, network: .devnet)!
mintAccount = Account(network: .devnet)
account = HotAccount(phrase: phrase, network: .devnet)!
mintAccount = HotAccount(network: .devnet)

let solanaConnection = SolanaConnectionDriver(endpoint: .devnetSolana)
let solanaIdentityDriver = KeypairIdentityDriver(solanaRPC: solanaConnection.api, account: account)
Expand Down

0 comments on commit df54253

Please sign in to comment.